As part of my work with modbus I’ve created several tools that make testing node-red modbus flows easier.
In particular I’ve created two dashboards . These dashboards are identical in appearance and they let you send modbus read and write commands from the browser using input forms.
However the first dashboard interfaces directly with the modbus getter and write nodes whereas the second sends the commands via MQTT to remote getter and setter nodes .
Using the MQTT Modbus dashboard gives you remote control of the modbus server via MQTT.
The MQTT commands are converted into modbus commands and the modbus responses are then converted to to MQTT.
In the video I will be using a modbus simulator to simulate a modbus TCP/IP device and the modbus node-red nodes.
The flow consists of a dashboard that lets you set the function code,IP address,unit id, etc for reading and writing.
For the local dashboard the command is then set directly to the modbus node and the response is collected and displayed.
For the remote MQTT dashboard the command is collected and JSON encoded and sent via MQTT to the remote flow which decodes the data and sends the command to modbus. The response is placed in a JSON string and sent via MQTT to the remote Dashboard.
The remote flow is a very basic MQTT to Modbus bridge or Gateway.
The video shows you how to send and receive data from Modbus using a local Node-red dashboard and also remotely using MQTT.
To create these tutorials and videos I used a modbus simulator. It is available for free here.
You should also have a basic knowledge of modbus.
I didn’t know anything about it when I started with my first project and so I had to do a lot of research.
I created a page of my notes along with useful links to resources that I found useful. See Modbus working notes
Flows for video1,video2 and dashboad
If you are interested in seeing this bridge developed further than let me know using the comments section below
- Writing Modbus Data with node-red
- How to Use Node-Red with Modbus
- My Modbus Working Notes
- Understanding and Using Buffers In Node-Red