Node-RED Tutorial: How to read digital inputs from Raspberry PLC
24 August, 2021 by
Node-RED Tutorial: How to read digital inputs from Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez


For some time now Industrial Shields® has been using Node-RED as it is a very powerful programming tool for developing all kind of applications. So we have decided to create Industrial Shields® official nodes of Node-RED for you to use the inputs and outputs in a very easy way.

In this blog post, we will learn how to use the digital read node



  •  Install Node-RED in your Raspberry PLC, if it is not yet.

  • Install the node-red-contrib-rpiplc-node nodes. There are two ways:

    • In Node-RED, go to Menu - Manage palette - Install - search for node-red-contrib-rpiplc-node - Install.

    • In a terminal window, go to the ~/.node-red directory and run the following command:
      npm i node-red-contrib-rpiplc-node


Once the nodes are downloaded, you will be able to see the four nodes in the nodes section, as shown below:

Odoo • Image and Text


In this blog, we will focus on the digital read node, which is an input node for reading the Raspberry PLC digital input pins.

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


  • Select the model of the Raspberry PLC.

  • Click on Add.

  • Select an input.

  • Wire a debug node after the digital read node to get the value. And an inject node before the node to start getting the value.

  • Physically, connect 24V to the I0.5 input to turn on the LED and get a 1 digital value.

Add an additional analog-read node, and get the resolution with a debug node.

As we can see in the picture below, this is how we will get the result:

Odoo • Image and Text


In order to control the data graphically, we are going to add a Dashboard widget and request the temperature every 2 seconds to monitor it.

  1. In the inject node, select the option: Inject once after 0.1 seconds, then repeat: Interval every 2 seconds.

  2. Add a gauge node after the digital-read node.

    1. Add a new ui_group and a new ui_tab.

    2. Select 6x5 size.

    3. Select your prefered type, in our case "Level".

    4. Change the label for the input name

    5. Set the range between 0 and 1

    3. Go to your dashboard and monitor your input!

Odoo • Image and Text
[{"id":"f5e89d62.2ca78","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ac4ab640.7daf98","type":"rpiplc-digital-read","z":"f5e89d62.2ca78","rpiplc":"9a660914.ca7488","pin":"I0.5","name":"","x":420,"y":160,"wires":[["b8859091.b1ec6","64fac913.dab2f8"]]},{"id":"db0d26d4.246ce8","type":"inject","z":"f5e89d62.2ca78","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":160,"wires":[["ac4ab640.7daf98"]]},{"id":"b8859091.b1ec6","type":"debug","z":"f5e89d62.2ca78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":220,"wires":[]},{"id":"64fac913.dab2f8","type":"ui_gauge","z":"f5e89d62.2ca78","name":"","group":"33d04b74.74e3e4","order":0,"width":"6","height":"5","gtype":"wave","title":"","label":"","format":"{{value}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":570,"y":160,"wires":[]},{"id":"9a660914.ca7488","type":"rpiplc-config","model":"RPIPLC_57R","name":""},{"id":"33d04b74.74e3e4","type":"ui_group","name":"Default","tab":"9882cc2c.3cb1d","order":1,"disp":false,"width":"6","collapse":false},{"id":"9882cc2c.3cb1d","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}
Odoo • Image and Text
Node-RED Tutorial: How to read digital inputs from Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
24 August, 2021
Share this post

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!