Objective: Create a simple Node-RED flow that controls a digital output of a Revolution Pi system including a RevPi DIO and thus switches an external LED on and off.
Node-RED is a browser-based programming environment that does not require in-depth programming knowledge. It is based on a flow principle: Function blocks (nodes) are visually connected to each other in order to define data flows.
This tutorial applies to all base modules of the RevPi Core and RevPi Connect series, as well as the expansion modules RevPi DIO or RevPi MIO. In this example, a RevPi Connect 4 with a RevPi DIO is used.
Prerequisites #
Devices #
✓ Base module RevPi Connect 4
✓ Expansion module RevPi DIO
✓ External LED indicator lamp, 24 V
Hardware Installation #
✓ RevPi base module and expansion module are connected via the PiBridge.
✓ RevPi base module is connected to the network.
✓ RevPi base module is connected to the power supply.
✓ RevPi expansion module and inputs and outputs are connected to the power supply.
✓ External indicator lamp is connected to the first output channel of the RevPi expansion module.
Software Installation #
✓ RevPi Bookworm or higher is installed on the RevPi.
✓ Web browser on your PC
✓ There is a network connection between the RevPi and your PC.
1. Configuring Hardware in PiCtory #
The connected hardware needs to be configured using the PiCtory application before Node-RED can access the inputs and outputs of the RevPi. This specifies which modules are connected and how their inputs and outputs are named in the process image. These names are later used in Node-RED to specifically address individual outputs.
❯ The Cockpit application opens.
▷ Open PiCtory.
▷ Drag the RevPi base module from the Device Catalog to the empty slot 0.
▷ Drag the RevPi DIO from the Device Catalog to the slot to the left of the base module.
▷ In the Value Editor, assign the name Output1_LED to the O_1 output for the RevPi DIO.

▷ Save the configuration using .
▷ Restart the piControl driver using to apply the changes.
2. Creating Flow in Node-RED #
-
Option 1: Creating flow manually
-
Option 2: Ready-to-use Flow
Creating Flow Manually #
Starting Node-RED
▷ Set up Node-RED when you use it for the first time.
▷ Configure and open Node-RED.
Installing the Dashboard Package
▷ Select Manage palette from the menu.
❯ The Palette window opens.
▷ Switch to the Install tab.
▷ Search for the package node-red-dashboard.
▷ Select Install if the package is not yet installed.
❯ Additional dashboard nodes are available in the palette.
Creating Dashboard Node Switch
▷ Drag a node switch from the dashboard palette onto the workspace. Using this node switches the LED status.
▷ Open the switch node to configure it.
▷ Assign a group name, e.g. LED Control.
▷ Enter a name, e.g. ON/OFF.
▷ Confirm with Done.
Creating Node RevPi Output
The RevPi Output node from the Revolution Pi palette forwards the signal to the physical output.
▷ Drag the revpi-output node onto the workspace.
▷ Open the node to configure it.
▷ Select the pencil icon next to Server to create a new server.
▷ Enter the IP address of the RevPi as Host and Port 8000.
▷ Enter User and Password of the RevPi.
▷ Confirm with Update.
▷ Select the output PIN: Output1_LED in the Pin field.
▷ Confirm with Done.
▷ Connect the output of the switch node to the input of the output node on the workspace.
Creating Debug Node
The purpose of the Debug node is to display debugging information. It assists with troubleshooting by listing the messages that pass through the flow.
▷ Drag the debug node onto the workspace.
▷ Connect the output of the switch node to the input of the debug node.
▷ Select Deploy in the top right corner of the interface to apply the Node-RED flow.
❯ The flow is activated.
Alternative: Ready-to-use Flow #
Alternatively, this flow can be created using the JSON export provided below. It contains all the necessary nodes correctly configured and connected.
✓ Dashboard package is installed.
▷ Copy the following JSON export:
[
{
"id": "45371098831c2f50",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "dd91c103fca0df54",
"type": "ui_switch",
"z": "45371098831c2f50",
"name": "ON/OFF",
"label": "switch",
"tooltip": "",
"group": "c5aa454786599927",
"order": 0,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "topic",
"topicType": "msg",
"style": "",
"onvalue": "true",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"animate": false,
"className": "",
"x": 340,
"y": 300,
"wires": [
[
"b97624cf8482ce4c",
"76cf80f93d913ac5"
]
]
},
{
"id": "b97624cf8482ce4c",
"type": "revpi-output",
"z": "45371098831c2f50",
"server": "23bf8ad0f3c174d6",
"outputpin": "Output1_LED",
"overwritevalue": false,
"outputvalue": "",
"x": 620,
"y": 300,
"wires": []
},
{
"id": "76cf80f93d913ac5",
"type": "debug",
"z": "45371098831c2f50",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 460,
"wires": []
},
{
"id": "c5aa454786599927",
"type": "ui_group",
"name": "Standard",
"tab": "dfde44665fc52d64",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "23bf8ad0f3c174d6",
"type": "revpi-server",
"host": "<your IP_address>",
"port": "8000",
"user": "pi",
"password": "<your_password>",
"rejectUnauthorized": false,
"ca": ""
},
{
"id": "dfde44665fc52d64",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
▷ In the Node-RED editor, select Import from the menu.
▷ Paste the JSON export into the empty window.
▷ Confirm with Import.
▷ Place the imported nodes on the workspace and select Deploy to activate the flow.
3. Testing Flow #
▷ Open the Node-RED dashboard in your web browser using:
http://<revpi_ip_address>:41880/ui
▷ Use the ON/OFF button switch in the dashboard to test the application.
❯ When the switch is switched, a Boolean value (true or false) is sent to the node Pin: Output1_LED, which simulates the LED status.
❯ The payload is displayed in the debug area of the Node-RED editor.
❯ The LED lights up when the switch in the Node-RED dashboard is set to ON.