Node-RED Tutorial: How to read analog inputs from Raspberry PLC
Learn how to develop your application with open-source software for Raspberry Pi automation!
24 August, 2021 by
Node-RED Tutorial: How to read analog inputs from Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

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

How to

Connect Raspberry PLC to Wi-Fi

Read 

Raspberry PLC

Family products for industrial automation

See 

How to

Send emails using Raspberry PLC

Read 

Basics about

Raspberry Pi PLC Analog Outputs

Read 

Touchberry Pi

Family products for industrial control

See 

How to

Find your perfect industrial PLC

Read 


Requirements

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. 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:

Industrial Shields Nodes-Node-RED Tutorial: How to read analog inputs from Raspberry PLC

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.

Analog Read Node-Node-RED Tutorial: How to read analog inputs from Raspberry PLC

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!

Dashboard-Node-RED Tutorial: How to read analog inputs from Raspberry PLC
Node-RED Tutorial: How to read analog inputs from Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
24 August, 2021
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!