Node-RED

Node-RED provides “Flow-based programming for the Internet of Things”, we will find out what that means by diving right in.

Node-RED is already installed on your Raspberry Pis, so all you need to do is start it on the commandline:

[user@computer ~]$ node-red
Welcome to Node-RED
===================
…
1 Jan 00:00:09 - [info] Starting flows
1 Jan 00:00:09 - [info] Started flows
1 Jan 00:00:09 - [info] Server now running at http://127.0.0.1:1880/

You can now open the Node-RED interface by right-clicking on the URL in the last line and selecting “Open Link”.


The video below shows how to setup your first Node-RED flow:

Task: Try replicating the steps seen in the video.


So what did just happen there?

First we start with the blank Node-RED interface.

Node-RED interface

Then we drag the “inject” and “debug “nodes from the pool of available nodes into our flow window.

Node-RED inject inject

Next we connect the Nodes. That means whenever the “inject” node produces output it will go into the input of the “debug” node.

Node-RED connect nodes

Next we start the flow…

Node-RED deploy

… open the debug output…

Node-RED debug output

… and trigger the inject node.

Node-RED

The inject node sends, via the connection we made, a message to the debug node and the debug node prints that message to the debug output window.