At Industrial Shields ®, we love developing all kinds of applications with Node-RED, which is a powerful programming tool for the open-source industry.
In this post, we will learn how to read analog inputs from our industrial Raspberry Pi industrial PLC using Node-RED.
Either Ethernet or HDMI cable with an external screen to connect to your Raspberry PLC.
First of all, make sure you have Node-RED rightly installed:
Then, there are two ways of installing the node-red-contrib-rpiplc-node:
1. To install the stable version use the Menu - Manage palette - Install option and search for node-red-contrib-rpiplc-node
2. Go to your /home/pi/.node-red directory, and run the following command:
npm i node-red-contrib-rpiplc-node
Industrial Shields Nodes
Once the Industrial Shields® nodes are successfully installed, you will see four nodes in the nodes section:
In this post, we will test the analog read node.
Analog Read Node
The analog read node is an input node for reading the industrial Raspberry Pi PLC analog input pins.
Drag & drop the node to the flow, double-click and add a new Raspberry Pi PLC controller configuration by clicking on the pen.
Just select the model of the Raspberry Pi based PLC, click on Add and select an input. Optionally, type a name for this node.
Now, wire an inject node before the analog read, and add a debug node to get the analog values.
Physically, we connect a wire from the 5V to the I0.2 input, and then, we disconnect it.
As we can see, this is how we get the result.
After the analog read node, add a gauge Dashboard node. Edit it and add new ui_group and new ui_tab. Select a sample size, like 6x5. And set the range between 0 and 2048.
Edit the parameter you want, save changes and deploy. Go to your dashboard either through the menu or add a /ui in your URL after 1880 like: localhost:1880/ui and control your temperature with your open source PLC Raspberry Pi!