Introduction: ESP8266 12E Modbus RTU Master (Improved) Industrial
We have performed several tests regarding Arduino integrating Arduino-PLC and Arduino-HMI Panasonic for Industrial applications, in this opportunity we have found other libraries for Arduino as Master Modbus RTU, which we will use only in Modules ESP8266, main advantages of the library has Easier facility regarding read and write log settings.
Initially the libraries only worked for Arduino, have been made a series of modifications to be compiled in Arduino IDE and work correctly with the module ESP8266. This time we will highlight the origin of these libraries and the contributions of a community called cooking-hacks.com which market and test platforms such as Arduino, Raspberry pi and Intel galileo, together libelium.com create modules for the integration of The previously mentioned platforms with some existing known protocols.
Complete tutorials available
Tutorial completo: PDAControl Español Tutorial ESP8266 12E Modbus RTU Maestro (Mejorado)
Full Tutorial: PDAControl English Tutorial ESP8266 12E Modbus RTU Master (Improved)
cooking-hacks : www.cooking-hacks.com
libelium :www.libelium.com
Step 1: Video Tutorial ESP8266 12E Modbus RTU Master / Arduino IDE Code
Arduino IDE Code
The test strategy performs two-way communication of Holding Registers records.
ESP8266 Slave Simulator
Holding Register[4] <- 00005 (Control diode led -GPIO 04)
Holding Register[5] 00006 -> int random (1 a 999 )
Holding Register[6] 00007 -> Valor ADC0 (LDR- Photoresistor)
Note: ADC0 is valid in ESP versions with this pin available.
Downloads available at PDAControlen.com
Step 2: Components and Materials Required for Testing
Components and materials required for testing
Step 3: More Info: Conecctions & Donwloads
The ModbusMaster232.h library is under GNU (General Public License), in this page there are 2 versions available from this library RS232 and RS485, in this case we will use the RS232 version, since the other was created for a module with different hardware To the common Max485.
More Info: Conecctions & Donwloads
Complete tutorials available
Tutorial completo: PDAControl Español Tutorial ESP8266 12E Modbus RTU Maestro (Mejorado)
Full Tutorial: PDAControl English Tutorial ESP8266 12E Modbus RTU Master (Improved)

Participated in the
Microcontroller Contest 2017
4 Comments
3 years ago
I am getting compilation error :
C:\Program Files (x86)\Arduino\hardware\espressif\esp32\libraries\RS485_05_modbus_write_single_coil/avr/sleep.h:224:6: error: #error "No SLEEP mode defined for this device."
Reply 3 years ago
Hi, In this example the sleep mode is not used, very strange that errror,
Reassemble modified Modbus libraries for ESP8266.
Migrate these tests to another site and channel trialcommand, you could also test these tests
http://en.trialcommand.com/blog/esp8266-master-mod...
https://www.youtube.com/channel/UCFAN12FCdg9W4Yq6g...
regards
4 years ago
I think you mean Modbus TCP (Ethernet and TCP) not Modbus RTU (RS485)
Reply 4 years ago
Hi, In this case is modbus RTU serial for RS232 No TCP / IP,
In case you have a Slave modbus meter or controller, you could do more routines. Example an Mqtt API
Check this if it is a test Modbus Slave TCP / IP EThernet,
NodeMCU ESP8266 12E Modbus TCP/IP Control I/O
greetings