Introduction: Gateway: Node-RED + ESP8266 Modbus RTU MQTT + HMI Industrial Panasonic

Given the growth of IoT applications using the MQTT protocol as a base and the Node-RED platform, we have created a possibility for industrial devices or devices using Modbus RTU protocol (RS232 or RS485) to interact with applications or IoT platforms that use MQTT in This Node-RED case.

In the industry there is a large number of Monitoring and Control Devices that have Modbus RTU such as Counters, Meters (Flow, Electrical, Temperature, Humidity, etc.), Industrial Controllers PLC, PAC, HMI Screens, Speed Inverters, For which the only possibility of extracting and concentrating data through OPC servers.

Some of the components required for building & testing:

Note:You could use any ESP8266, but in this case it is used (softwareserial), if you want to use ESP8266 01 you must modify the Modbus library to replace the "SoftwareSerial" port with the "Serial" port by default.

For more info, please visit:http://en.trialcommand.com/blog/gateway-esp8266-mo...

Para mas información visita:http://es.trialcommand.com/blog/gateway-esp8266-mo...

Step 1: Modbus RTU MAX232 (RS232) to MQTT Client

Picture of Modbus RTU MAX232 (RS232) to MQTT Client

We have configured a module ESP8266 12E NodeMCU as Master Modbus RTU serial via RS232 (CHIP MAX232) to request and send data to a GT01 Industrial Screen Panasonic brand, the reference I have is fed to 5V, The same ESP module is configured as an MQTT client, The routine created in Arduino IDE bridges Modbus read and write registers in this case "Holding Registers" and by the MQTT subscribing and publishing topics.

Since the ESP8266 module has a serial port, we used the softwareserial library to create a second port that would be used only for Modbus RTU allowing programming and debugging without physically interrupting the modbus communication, we added an integrated MAX232 for protocol conversion to RS232.

Step 2: Componets

Picture of Componets

In this specific case the test we will perform will be based on an industrial device, we will connect a Panasonic HMI GT01 Screen configured as a Modbus RTU slave (RS232) with GTWIN software, why a screen? It would be very boring and simple to use a simulator and we want to implement real hardware.

Some of the components required for building & testing:


  1. ESP8266 12E Node MCU
  2. MAX232 (RS232 to TTL)
  3. HMI GT05 Panasonic RS232 (Any device or PLC controller that supports Modbus RTU RS232)
  4. Power supply Meanwell 5v

Software

  1. Node-RED / Dashboard
  2. MQTT Broker Mosquitto (Or any other)
  3. GTWIN Panasonic (Program HMI)

Step 3: Tests

Picture of Tests

We have done 2 tests one for presentation and one for explanation:

1 - Rapid HMI Test Panasonic and Node-RED Dashboard

We use only 2 modbus 1 registers for reading and one for writing.

We perform visualization and control with dashboard.

2- Complete explanation and test 10 Reading 10 writing

We will use 10 read registers and 10 write registers between Node-red and the HMI.

We will explain the sending and receiving methods in Node-Red.

Step 4: Quick Test HMI Panasonic and Node-RED Dashboard

In this example the HMI is configured as a slave modbus rtu only we will use 2 available registers:

  1. Holding Register [0] - Read
  2. Holding Register [10] - Write

A dashboard has been created in Node-RED and 2 MQTT nodes assigned to Send and Receive Topics have been previously set to the code in ESP8266. The value entered on the screen will be sent to an MQTT Topic and the value sent from Node-RED for a topic will reach a screen record.

Step 5: Node RED & Node RED Dashboard / Panasonic HMI GT01 Design in GTWIN

Picture of Node RED & Node RED Dashboard / Panasonic HMI GT01 Design in GTWIN

Node-RED

In previous tutorials we taught to install Node-RED available on Linux Windows and Raspberry pi among others.

  1. Install lubuntu (Ubuntu) from Scratch
  2. Installation Node red Platform
  3. Installation Node Red dashboard
  4. Installation Mosquitto Broker MQTT in lubuntu (Ubuntu) Linux
  5. Tutorial ESP8266 DS18B20 Temperature Node-RED MQTT (Mosquitto) IoT
  6. ESP8266 & Public MQTT Broker mosquitto.org & Node-RED

Panasonic HMI GT01 design in GTWIN

The screen is configured as slave Modbus RTU connection RS232, Previously on the GT01 Screen 2 screens have been designed the GTWIN Configuration software:

  1. Reading from 3 Holding Registers [0] [1] [2] from 3 MQTT records.
  2. Writing 3 Holding Registers [10] [11] [12] to 3 MQTT records.

Step 6: Full Explanation

Tutorial Complete

Step 7: Panasonic HMI GT01 Design in GTWIN

Picture of Panasonic HMI GT01 Design in GTWIN

Conclusions
In the industry we have seen devices such as Modbus RTU meters, and adding an ESP8266 and a TTL to RS232 (RS485 or RS485) we could monitor our electricity consumption without requiring an OPC or specific Hardware, as mentioned earlier MQTT protocol has been implemented in a variety of IoT applications and there are now a large variety of local and cloud platforms that could host our data.

To take into account, if you want to implement the tests described above in a real project, we detail that we have not tested 24/7 hardware esp8266, should take into account materials (pcb, welding, wiring), electrical protections, electrical insulation , Ambient temperature, Wifi signal strength, among other variables, but we consider that for basic automation applications taking into account the above mentioned would work correctly.

For more info, please visit: http://en.trialcommand.com/blog/gateway-esp8266-m...

Para mas información visita: http://es.trialcommand.com/blog/gateway-esp8266-m...

Youtube Channels

https://www.youtube.com/channel/UCFAN12FCdg9W4Yq6g...

https://www.youtube.com/c/JhonValenciaPDAcontrol?s...

Comments

About This Instructable

1,299views

20favorites

Bio: Share - Learn - Makers. Projects, Articles, #automation, #PLC, #Arduino, #IoT and More PDAControl
More by Jhon_Control:Introduction Library WifiManager for Esp8266Test Module SD / MicroSD Via SPI for Arduino & ESP8266Installation Arduino IDE & Boards ESP8266 in Lubuntu
Add instructable to: