Node-RED Tutorial: How to set analog outputs to Raspberry PLC
How to develop your own application using open-source software
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 this is why Industrial Shields® team loves developing all kind of applications with it.

In this blog, we are going to learn how to set analog outputs to 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

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

Odoo • Image and Text

ANALOG WRITE NODE

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

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

Then:

- Select the model of the Raspberry PLC

- Click on Add

- Select an output

- Add a value between 0 and 4095

Odoo • Image and Text

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.

Odoo • Image and Text

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":""}]
Odoo • Image and Text
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 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!