Given previous post, this time it has been implemented ESP8266 Bridge Industrial Modbus protocol, in next tutorials will make the connection ARDUINO ESP8266 and SCADA HMI.
Post Recommended: ESP8266 As Slave Modbus TCP IP
Arquitecture
Tutorial Recommended for TrialCommand.com 2017
Explaining project
ESP8266 module,
1 – It is configured by your serial port Modbus RTU Slave Serial, complementing a MAX 232 chip can convert from TTL to RS232.
2 – It is set by the wireless part – WLAN is configured as Modbus Slave TCP IP through the port 502,
3 – internally in the module 20 records both Modbus TCP IP Modbus RTU as follows redirected:
Modbus RTU -> Modbus TCP IP
From the Registry 0-9 Modbus RTU slave to the registers 0-9 Modbus TCP slave, all that is written in the first 10 records Slave RTU will be sent in the first 10 TCP Slave:
//// Write Modbus TCP in Modbus RTU 10 Holding Registers //// Escritura de Modbus TCP en Registros 10 Modbus RTU regBank.set(40001, Mb.MBHoldingRegister[0]); regBank.set(40002, Mb.MBHoldingRegister[1]); regBank.set(40003, Mb.MBHoldingRegister[2]); regBank.set(40004, Mb.MBHoldingRegister[3]); regBank.set(40005, Mb.MBHoldingRegister[4]); regBank.set(40006, Mb.MBHoldingRegister[5]); regBank.set(40007, Mb.MBHoldingRegister[6]); regBank.set(40008, Mb.MBHoldingRegister[7]); regBank.set(40009, Mb.MBHoldingRegister[8]); regBank.set(40010, Mb.MBHoldingRegister[9]);
Modbus TCP IP –> Modbus RTU
From the Registry 10-19 Modbus TCP slave IP to records 10-19 Modbus RTU slave, all that is written from register 10 Modbus TCP slave IP registers be sent from the RTU Slave 10.
//// Write Modbus RTU in Modbus TCP 10 Holding Registers //// Escritura de Modbus RTU en Registros 10 Modbus TCP Mb.MBHoldingRegister[10] = regBank.get(40011); Mb.MBHoldingRegister[11] = regBank.get(40012); Mb.MBHoldingRegister[12] = regBank.get(40013); Mb.MBHoldingRegister[13] = regBank.get(40014); Mb.MBHoldingRegister[14] = regBank.get(40015); Mb.MBHoldingRegister[15] = regBank.get(40016); Mb.MBHoldingRegister[16] = regBank.get(40017); Mb.MBHoldingRegister[17] = regBank.get(40018); Mb.MBHoldingRegister[18] = regBank.get(40019); Mb.MBHoldingRegister[19] = regBank.get(40020);
Run Slaves
slave.run(); /// Run Slave Modbus RTU Mb.Run(); /// Run Slave Modbus TCP
Materials Very cheaps!!!
1 ESP8266
2 Converter FTDI Serial USB
3 Regulator de 5 a 3.3v for supply ESP8266
Video Test Mode Modbus Bridge ESP8266
ESP8266 Bridge Slave Modbus TCP – Slave Modbus RTU
ESP8266 slave modbus TCP IP Industrial Applications
Connections
Downloads:
Part 1
Part 2