Node-RED Tutorial: How to read analog inputs from Raspberry PLC
Learn how to develop your application with open-source software!
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 kind of applications with Node-RED, which is a powerful programming tool for the open-source industry.

In this blog, we will learn how to read analog inputs from our Raspberry PLC using Node-RED.

Related Links

How to

Connect Raspberry PLC to Wi-Fi

Read 

Raspberry PLC

Family products

See 

How to

Program Raspberry PLC Interrupt inputs with Python

Read 

Basics about

Raspberry Pi PLC Analog Outputs

Read 

Touchberry Pi

Family products

See 

How to

Find your perfect industrial PLC

Read 


REQUIREMENTS

  • Either Ethernet or HDMI cable with an external screen to connect to your Raspberry PLC.

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:

Odoo • Image and Text

In this blog, we will test the analog read node.

ANALOG READ NODE

The analog read node is an input node for reading the Raspberry PLC analog input pins.

Drag & drop the node to the flow, double-click and add new Raspberry PLC configuration by clicking on the pen.

Just select the model of the Raspberry 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.

Odoo • Image and Text

DASHBOARD

Optionally, double-click on the inject node, click on the check button to "inject once after 0.1 seconds, then" and repeat -> select interval every 3 seconds, for example.

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 the 1880 like: localhost:1880/ui and control your temperature!

Odoo • Image and Text

 

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 PLC?

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!