Arduino Slave Modbus RTU (RS232)

We have seen the large number of Arduino tests in which industrial protocols have been implemented in these modbus protocol RTU (binary) in this test has done tests configuring Arduino as Slave Modbus RTU.

trialcommand.com

Tests

Since it is intended that industrial integrations be performed the arduino will communicate with a modbus simulator via RS232, in this case we use an Arduino Mega 2560 which has more serial ports, we have made a number of modifications to the modbus slave library so our Arduino can be programmed by the main Serial port And the Serial1 is only modbus this in order to facilitate the programming that case to make modification and / or corrections.

We will use an additional Max232 chip to convert the modbus protocol of ttl voltages to 5v to RS232, although this converter is sold normally we have decided to assemble it (MAX232 DIY) in order not to lose the tradition of making PCB ships.

Initially our Arduino MEGA 2560 R3 will be connected to a Modbus Simulator that will work as a Master via RS232.

Arduino Mega 2560 Slave Modbus RTU (RS232)

Arduino MAX232 Connection 

Arduino Mega 2560 R3

 

Converter MAX232 Datasheet 

trialcommand.com

 

Conclusions

The modbus library works very well respecting the speeds, recommended to use it at 9600 bauds, does not mean that 115200 does not work only that we want more security in the transitions.

The library was modified to work with the Serial1, in this case with the Arduino Mega, to require that it work with the default port of arduino edit the library and replace in all cases Serial1 with Serial1 and should work normally.

We recommend the use of the Arduino library as a Modbus slave in the case of basic applications automatically, such as reading of I / O peripherals and later sending data to a master, either PLC, PAC HMI, SCADA opc or IoT devices, custom That we advance in our tests we will realize integrations with PLC, HMI, SCADA and IoT (Node-RED).

References

Downloads




Leave a Reply