What is Node Red? –Node red is a flow based tool and IOT Dashboard developed by IBM and written in Node.js.It is an Open Source project
Node red lets you easily create program flows by joining together black box functions using a web interface.
In this tutorial you will learn how to install Node red on Windows and Linux and how to navigate the Web Interface and install use the node red dashboard to create an IOT dashboard.
Installing Node Red
Before you Install node red you will need to install node.
Note: In response to a comment from Julian I have removed the instruction to update the package manager before installing.
Install node red using these instructions
Starting Node Red
To start node red on Windows go to a command prompt and type:
Note: you may need to change into the node directory.
Firstly running node by typing node may not work as apparently node is a shortcut to nodejs and the shortcut may not be present.
In addition there appears to be a naming conflict with another package. see this explanation
The screenshot show how to create the symbolic link
Now that node is working you can run node-red
Type node-red at the command prompt. If that doesn’t work it’s probable because the link isn’t configured as shown above. You can try the alternative.
As shown below
At the bottom of the screen it tells you the url to use to access the node-red web interface to create your flows
This consoles stays open and you will find it useful as when you start creating flows you will see log information appearing there.
.Now open a web browser to 127.0.0.1:1880 if you are running the browser on the same machines as node-red.
I prefer to run node-red on a LInux machine and use a second machine to access it
You should start with an empty work space as shown above.
Installing The Node-Red Dashboard
The node red dashboard is an add-on module that lets you create live dashboards and is optional but recommended.
Here are the install instructions and a brief description.
- On Linux you need to have created the link to node or the install fails.
- You get a series of warnings at the end as shown belowThe warnings are nothing to worry about.
- You need to go to the ~/.node-red folder (Linux) to do the install otherwise when you open the node-red interface the dashboard icons will be missing.
Using Node Red and creating Flows
You should start with an empty work space as shown in the screen shot above.
The default view is a three column layout nodes on the left ,flows work space in the middle and a third column with three tabs( info,debug and dashboard).
To add nodes to a flow drag them from the left column into the main screen.
You can link the flows together by dragging a wire between them.
The nodes are grouped based on function. There is a input group, output group,functional nodes,dashboard or display nodes etc..
The dashboard or display nodes appear on the User Interface (UI) dashboard.
To access this dashboard use the url – host:1800/ui or in my example: steve-laptop:1880/ui
An example UI dashboard is shown below:
The layout of the UI screen can be controlled in the dashboard tab (third column main screen) .
Node Red Demo Videos
The following videos shows you how to use the web interface to create a basic flows.
In this video tutorial I use Node-red to subscribe to an MQTT broker and display messages on a topic.
This video follows on from the first and in it we create an MQTT dashboard to control and display two MQTT sensors as well as learning more about using node-red..
I couldn’t find this setting but a reader pointed it out.
Open the flow go to the menu (top right) and select flows> rename flow and there is a toggle to enable/disable it.
You need then to redeploy for the setting to take effect.
You can export a flow to install on another system.To do this you need to highlight each node in the flow and then click on Menu>export>clipboard.
The contains of the export file will be displayed click on export to clipboard.
You then need to open a file editor and paste the contents into the file using CTRL+V. Give the file a name and save it.
Deleting a Flow
To delete the flow click menu select flow and delete.
Importing a Flow
To import a flow you need to open it with a text editor and copy it then go to menu>import>clipboard
and paste in the flow.
Related Tutorials and Resources:
- Node red Documentation
- Understanding the Node-Red Message Object
- Google icons on W3Schools
- Creating a simple MQTT sensor in Python
- How to create an MQTT Dashboard with Thingsboard