ESP8266 Slave Modbus TCP/IP No libraries

A large number of devices have the TCP/IP modbus protocol becoming one of the most commonly used protocols at industrial level, this time we created a routine for ESP8266 as a slave Mobdus TCP/IP, we created this routine based on this Example Update ESP8266 Industrial Modbus TCP IP V2.0.


No additional libraries

We performed numerous tests of the modbus library which used the Tinker library, with the result that certain applications that use delay’s affect communication, in that case we take the library and select the connection routines, master frame reading, frame creation, Reading and writing functions.

This routine created in Arduino IDE for ESP8266 performs master – slave communication without adding extra libraries, since the communication is done step by step.



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).
  • Additionally from Holding register [14] we will activate the 14 – pin GPIO (D5)

ESP8266 Modbus Slave TCP / IP, No extra libraries

Arduino IDE Code



We have tested this library for several hours and consider that implementing the esp8266 with more robust hardware, could be used in monitoring and control applications of Controllers. PAC, PLC, OPC, SCADA and Node-RED.


Verify that adding delay or libraries with delay’s do not affect the communication between Master and slave since a continuous communication must be maintained and the master’s timeout could determine the communication as failed.


One Reply to “ESP8266 Slave Modbus TCP/IP No libraries”

  1. Roslan

    Great work on node esp8266.
    Functions 03 and 06 work perfectly.
    Sorry, there is a problem with Functions 16.
    I use the PLS Schneider M251, which does not support Functions 6.
    and I need to use function 16.
    Has this feature been built with you?
    After all the attempts I failed to use.

Leave a Reply