ESP8266 Master Modbus RTU (RS232)

There are certain applications and a great variety of equipment that have the Modbus RTU communication protocol. In this case we will perform tests with the module ESP8266 configured as Master Modbus RTU Serial via RS232, modifications have been made to the master modbus library used in previous tutorials With Arduino Maestro Modbus RTU, the SoftwareSerial library has also been used for the ESP8266 module to generate a second serial port for the use of modbus rtu.

  1. The main serial port will be used for programming, debugging and visualization of data.
  2. The second serial port created with SoftwareSerial will be destined for the Modbus RTU Master protocol.

References

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) so as not to lose the tradition of manufacturing PCBs.

trialcommand.com

 

Tests

The following addresses have been configured in the ESP8266 module:

  • 10 Holding Read Registers for display on the ESP8266 serial terminal.
  • 10 Holding Writing Registers in which we will send Random values to validate the changes in the Modbus Master (Simulator).

ESP8266 MasterModbus RTU (RS232)

Connections

ESP8266 12E NodeMCU Lolin –  SoftwareSerial Port

trialcommand.com

Converter MAX232 DIY – to SoftwareSerial port

trialcommand.com



Conclusions

  • This is an initial basic test, in the next tutorials we will use WIFI the main property of our module mixing modbus with other protocols and industrial integrations.
  • This application is valid in cases of requiring your ESP8266 module to perform monitoring and control of Modbus Master RTU devices.
  • In this case we have used an ESP8266 12E but this library works correctly in ESP8266 01 without problems.

Recommendations

  • In this test the ESP8266 has 5V from the USB, the ESP8266 feeds the MAX232, although it works well, it is recommended to feed the MAX232 independently and unify lands.
  • Set up maximum to 9600 bauds, of course they can be configured at higher speeds but at low speeds we guarantee stable communication.

References

Downloads




Leave a Reply