wfscheffrahn
Hi all,
 
I have a 12 relay Modbus TCP board that can be congifured through http webpage to act either as UDP. TCP Client, TCP Server, Modbus Slave, Modbus Master or MQTT.
 
When I configure it as Modbus Slave I can operate all relays through a TCP connection in ModbusPoll on a workstation on the netwerk. This means that the board is operating correctly.
 
When I configure OpenPLC to use this board as a Output extension and run a PLC program (PLC runtime is running on Raspberry PI) OpePLC is trying to connect to the board set as Modbus Slave but is states that the connection is refused.
 
I have tried several settings but that mostly leads to a timeout.
 
Anyone that may have a suggestion to get this to work. Since I have no problems connecting and operating the relays in ModbusPoll I believe that it is something minor I am either doing wrong or over look.
 
Many thanks in advance!
thiagoralves
Reply 0 0
wfscheffrahn
After some trial-and-error testing, I managed to establish a serial RTU connection with the board. When I set the slave configuration for Holding Registers – Read and Holding Registers – Write from 0 and size to 12 (for the 12 relays on the board), I do not get any timeouts, and the runtime log indicates that there is an RTU connection with the board and the board's indicator shows that there is a live serial RTU connection. However, as soon as I set the Coils starting at 0 with a size of 12, I encounter a timeout.
Reply 0 0
thiagoralves
It is possible that this board simply does not accept the Modbus commands that the runtime uses. I’ve seen many “broken” Modbus implementations out there on cheap Modbus devices that only uses a subset of Modbus commands. OpenPLC uses write multiple coils function code to write to all coils at once. If your device does not support that, then there is no way to integrate it with OpenPLC, unless you change OpenPLC’s code
Reply 0 0
wfscheffrahn
It is possible that this board simply does not accept the Modbus commands that the runtime uses. I’ve seen many “broken” Modbus implementations out there on cheap Modbus devices that only uses a subset of Modbus commands. OpenPLC uses write multiple coils function code to write to all coils at once. If your device does not support that, then there is no way to integrate it with OpenPLC, unless you change OpenPLC’s code
Many thanks for your feedback. Since I was able to change relay status with ModbusPoll and also with Radzio I thought it would be okay for OpenPLC but did not expect that poor quality could be the cause. Do you have any recommendations for a relay board product that will work as a output expansion for a Raspberry Pi running OpenPlc? Many thanks for your guidance
Reply 0 0
thiagoralves
SLM-MX from Synergy is a great option with robust and affordable hardware. See https://www.plctalk.net/news/synergy-logic-launches-onto-the-scene-with-new-modbus-i-o-modules/
 
Other options include Advantech ADAM modules, Moxa ioLogik E1200 Series and other industrial-grade brands should work just fine.
 
If you don’t want to spend extra money on hardware you might be able to make this board work with OpenPLC through an intermediate Python script with PyModbus. You can have the script talk to your board using the Modbus functions it supports, and then have OpenPLC talk to your Python script using Modbus. Essentially your script will be a Modbus gateway for your hardware
Reply 0 0
wfscheffrahn
SLM-MX from Synergy is a great option with robust and affordable hardware. See https://www.plctalk.net/news/synergy-logic-launches-onto-the-scene-with-new-modbus-i-o-modules/
 
Other options include Advantech ADAM modules, Moxa ioLogik E1200 Series and other industrial-grade brands should work just fine.
 
If you don’t want to spend extra money on hardware you might be able to make this board work with OpenPLC through an intermediate Python script with PyModbus. You can have the script talk to your board using the Modbus functions it supports, and then have OpenPLC talk to your Python script using Modbus. Essentially your script will be a Modbus gateway for your hardware
First and foremost many thanks for your support and the great OpenPLC product. With regards to the expanding relais over Modbus RTU am I correct in saying that within the OpenPLC architecture a board should be compatible with function code 15 (write multiple coils)?
Reply 0 0
thiagoralves
Yes, that’s precisely it. Your board needs to support FC 15
Reply 0 0
wfscheffrahn
Yes, that’s precisely it. Your board needs to support FC 15
Many thanks for your reply! I am a mechanical engineer trying to master this but making good progress thanks to your guidance.
Reply 1 0
wfscheffrahn
I thought it would be good to provide one final update.
I was able to lay my hands on a 12 DI/12(relay)DO unit for around 35 USD. This board works like a charm with OpenPLC. It's a 10IOA12 ModbusRTU board from Eletechsup from China.
Reply 1 0
Reply