Node-RED has multiple applications such as monitoring different values from inputs and outputs from open source projects.
So, in this blog you will learn how to activate different outputs, and how to check what is the value for the inputs from your open source Panel PC.
If you want to know more about basics about inputs and outputs from our 7" Panel PC for industrial monitoring, check out the link below:
In this blog, you are going to learn how to make a UI dashboard with Node-RED. By doing this, you will be able to enable or disable the outputs, and if outputs are enabled, you will be able to get the input values.
So let's start creating our Node-RED Application!
1. First of all, plug the Ethernet cable in your hmi industrial Panel PC, and power it on.
2. Next, let's make sure that you already have Node-RED installed in your Panel PC for industrial automation by typing the following in a terminal window:
sudo systemctl status nodered.service
If you see that it is activated and running like in the picture below, it is working:
3. Go to your browser, and type the following to connect through SSH to the Node-RED from the panel PC for industrial control:
4. Once you can see the browser-based editor, let's install first some nodes so that you can make a Dashboard easily:
1. Go to the right menu
2. Click on Manage palette.
3. Go to Install.
4. Type and install: node-red-dashboard
5. Type and install: node-red-contrib-ui-led
5. Now, add 5 switch nodes from Dashboard, one for each output. And configure each of them so that, when pressed, it sends a number 1 if it is On, and a number 0 when the switch node is Off:
6. Now, add five led nodes for each output, just to show the status for the switch nodes and the outputs. Connect them:
7. Let's execute the commands and set the digital outputs when the switch nodes change their status. So, add five exec nodes and connect them to the switch nodes:
8. To keep getting the values of the inputs, you will follow only if the msg.payload.code is 0 while executing the command "set-digital-output" in your Industrial Panel PC monitoring. So, to each exec node, connect a switch node from the Return code output like shown below:
9. Once you have checked that the configuration of the digital output has been succesful, let's get the values of the digital inputs. Add five exec node next to the switch nodes, connect them and configure each one like this:
10. As the value you get from getting the input value is a string + '\n', you are going to delete the '\n' and convert it to a single number. Also, let's set it to the msg.payload, to be able to get it from the ui led node:
11. Once the msg.payload is the number that you get from the get-digital-input command, let's add five more nodes to add a led for each input:
12. Then, go to the Dashboard menu on the right > Layout > Tabs & Links > Hover on your tab > Layout.
13. You will see the Dashboard layout editor to display your Dashboard as you like!
14. Finally, click on the Deploy red button to save your changes and display your Dashboard succesfully in:
If in the Dashboard layout editor, you cannot resize the widgets, go to each Dashboard node, and modify the size section. Replace the Auto with any other, like 3x1. You will be able to modify them later on the Dashboard layout editor.
Now, enjoy your application using Node-RED and the Industrial Panel PC control from Industrial Shields to create as many open source projects as you want!