Introduction
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.
Related Links
Requirements
- Industrial Raspberr​​​​y PLC
- Power​​ Supply
- Either Ethernet or HDMI cable with an external screen to connect to your Raspberry PLC.
- Node-RED-Dashboard library
Installation
First of all, make sure you have Node-RED rightly installed: Know how >>
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. Follow the steps of this link.
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.
Dashboard
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!
Node-RED Tutorial: How to read analog inputs from Raspberry PLC