Creating a Chart on node-RED and displaying data from Modbus TCP

This time we will create an example flow on node-RED which is used to read data from Modbus TCP and then display it in the Chart. Ok right away...



1. Prepare the palette library first, okay?
Here I use the palettes: node-red-contrib-modbustcp, and node-red-dashboard
The trick is in the top right corner menu, select 'Management Pallete' --> Pallete --> Install --> type the palette you're looking for.




2. Next we create a flow, select the TCP modbus input as shown below



Double click on the modbus tcp flow, enter the configuration data as follows


Please adjust this setting to your modbus address and data", here I will read the TCP modbus data with the Function Code Read Holding Register, the address is 0000, the quantity is 1

Next, we add a new server here I name it ModbusTCP1


For the Host address, please adjust the host address of your TCP modbus.

3. Next we add a chart to the flow by taking it from the dashboard on the left.




In my chart settings we will only focus on the part that is given the red box.

Type, please select the line chart
X-axis, please enter the last value: 1 hours
For the Y-axis, please fill it in according to the range from your modbus data. Here I use 0-1023.
For colors, etc., please set according to taste.
Next, please click Done.

4. Next we need flow function, to convert modbus data to 'number', please add 'function'.

Enter the program code as follows:

msg.payload=Number(msg.payload)
return msg;



5. Connect the flow components as follows:

6. Next, click Deploy in the upper right corner, and please open the web page from the chart that has been created.

And here are the results of the chart that I made


إرسال تعليق

0 تعليقات