Node-RED Tutorial: How to set analog outputs to Raspberry PLC
How to develop your own application using open-source software for Raspberry Pi automation
24 August, 2021 by
Node-RED Tutorial: How to set analog outputs to Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

Introduction

Node-RED is a powerful programming tool for the open-source industry and industrial control, and this is why the Industrial Shields® team loves developing all kinds of applications with it.

In this post, we are going to learn how to set analog outputs to our industrial Raspberry Pi PLC controller 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 industrial PLC Analog Outputs

Read 

Touchberry Pi

Family products

See 

How to

Find your perfect industrial PLC for industrial automation

Read 


Requirements

  • Power Supply

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

Installation

  • If it is not yet, install Node-RED in your Raspberry Pi based PLC.

  • Install the node-red-contrib-rpiplc-node nodes:

Either by going to Menu - Manage - Palette - Install. And search for node-red-contrib-rpiplc-node

Or by going to your /home/pi/.node-red directory, and running the following command:

npm i node-red-contrib-rpiplc-node

Industrial Shields Nodes

Once the nodes are successfully installed, you will be able to see the four nodes in the nodes section.

Industrial Shields Nodes - Node-RED Tutorial: How to set analog outputs to Raspberry PLC

Analog Write Node

In this post, we will focus on the analog write node, which is an output node for writing the industrial Raspberry PLC analog output pins.

So, drag and drop the node to the flow, double-click and add a new open source PLC Raspberry Pi configuration by clicking on the pen.

Then:

  1. Select the model of the Raspberry PLC

  2. Click on Add

  3. Select an output

  4. Add a value between 0 and 4095

Edit analog write node - Node-RED Tutorial: How to set analog outputs to Raspberry PLC

Optionally, write an inject node with a numeric msg.payload to the analog write node, to inject the msg.payload instead of writing it in the analog output node value field.

Edit inject node - Node-RED Tutorial: How to set analog outputs to Raspberry PLC

Node-RED flow

Now, it is your turn. Get the flow and start playing!

[{"id":"e96f1640.f0f8a8","type":"rpiplc-analog-write","z":"bd29c16a.ab096","rpiplc":"4d45e51a.5424fc","pin":"A0.0","value":"4095","name":"Analog Write node","x":430,"y":100,"wires":[]},{"id":"912ca990.962458","type":"inject","z":"bd29c16a.ab096","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":80,"wires":[["e96f1640.f0f8a8"]]},{"id":"d956e346.656b8","type":"inject","z":"bd29c16a.ab096","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4095","payloadType":"num","x":170,"y":120,"wires":[["e96f1640.f0f8a8"]]},{"id":"4d45e51a.5424fc","type":"rpiplc-config","model":"RPIPLC_57R","name":""}]
Node-RED flow - Node-RED Tutorial: How to set analog outputs to Raspberry PLC
Node-RED Tutorial: How to set analog outputs to 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!