Вы находитесь на странице: 1из 11

IoT Lab

Node Red Installation on

Node Red Installation on Windows
Linux (Debian)
• Install Node.js from the official page. • Use the command sudo apt install
• Check if Node.js is installed by the nodejs
command npm --version in cmd • Check if Node.js is installed by the
• Then use the command npm install -g -- command npm --version in terminal
unsafe-perm node-red • Then use the command sudo npm
• To start Node-RED, open cmd and use the install -g --unsafe-perm node-red
command node-red • To start Node-RED, open terminal and
go into the installation directory by cd
• Then use the command node-red

Node-RED can also be installed in Raspberry Pi, Beaglebone Black by similar method
About Node-RED
• Flow based development
environment for rapid prototyping
• Web-browser based flow editor
• Can be used to design web pages
• Can be used to design APIs
• General programming can be done
by using JavaScript
• Node-RED Dashboard can be used to
design UI for IoT applications
Basic Node-RED Flows
• A flow is like a block of code in Node-RED
• Different nodes with different functionalities are just wired together to
define a flow
• Data flows as JSON object between the flows
• Serial execution occurs within a flow
• All flows get executed concurrently

Stimulus/Input Programming Logic Response/Output

JSON object between the flows
• In a flow, by default, “msg” object
carries all the information
• The output of each node is treated as
msg.payload in the next load
• The msg object also has other fields
like msg_id, topic etc.
• The user may add other fields as well.
Basic Nodes
Debug Node:
This is used for displaying values from the output of a node. It is widely used to
display msg.payload

Function Node:
This is used to define a custom function using JavaScript. By default, the input to the
function node is received by the msg object. An object has to be returned at the last
to pass it to the next node.

Template Node:
This is used to design webpages. It supports HTML formatting and mustache
Node-RED Dashboard
• It is the most useful feature of Node-RED for
IoT applications
• The Dashboard package contains a lot of
nodes which can be directly used to build
Dashboard styled UI in a webpage without
the requirement of HTML, CSS and JS
• There are various input nodes like button,
slider, forms that can be used to give inputs.
• There are various output nodes like Meters,
Charts and Graphs and many more…
• There is a template node in Dashboard which
can be used to add HTML elements (like a
table, a form, a picture, an entire website…)
Installing new nodes
Interfacing Arduino with Node-RED
• Upload the standard firmata code on the Arduino
• Then take an Arduino output node and configure
the COM port and the pin
• Then connect the input source (switch) to the
output node.
• Since a node of the dashboard has been selected, it
has to be assigned a particular tab and group

• Similarly for reading an analog value from the
sensor, use the Arduino input node
• Wire it to a gauge/ chart to display the output
Further scope
• Can be used to design the backend of any
application service
• Can be used to design APIs for database
• Can be used to design dashboards to monitor
the index of anything
• To develop remote monitoring and control for
• For Industrial IoT processes
• To design SCADA software