IoT NodeRed Tutorial 2023
IoT NodeRed Tutorial 2023
Tutorial
F. Ferrero, J. Lanteri
V.1.3
1
Node Red – InFluxDB - GRAFANA
3
Node Red
• Node-RED is a programming tool for wiring together hardware devices, APIs
and online services in new and interesting ways.
• It provides a browser-based editor that makes it easy to wire together flows
using the wide range of nodes in the palette that can be deployed to its
runtime in a single-click.
• Built on Node.js
• The light-weight runtime is built on Node.js, taking full advantage of its event-driven,
non-blocking model. This makes it ideal to run at the edge of the network on low-
cost hardware such as the Raspberry Pi as well as in the cloud.
4
Outline
1/ Definition
2/ Tutorial
5
Node-Red
First install Node.JS : https://nodejs.org/en/download/
6
Connecting to TTN
• Start NODE.js command prompt
• Run : node-red
• Open your web browser and go
to http://127.0.0.1:1880
7
Connecting to TTN
• You have the graphical Node-red
editor
• Add mqtt in node
• Edit mqtt
• Choose « Add new mqtt-broker
… » in App and click on edit
• Output is a parsed JSON object
8
Connecting to TTN
• Update security and topic:
9
Connecting to TTN
11
Connecting to TTN
12
Add a Dashboard
• Go to Manage Palette, select Install
• Install : node-red-dashboard
• Add a function to extract sensor values
(Temp, Hum, luminosity…)
var tmp = {};
• Add Gauge and Graph for Dashboard tmp.payload = msg.payload.uplink_message.decoded_payload.luminosity_4
return tmp;
section
• Add a new UI group in the Gauge and
Graph
• Go to : http://127.0.0.1:1880/ui/
var tmp = {};
tmp.payload = msg.payload.uplink_message.decoded_payload.luminosity_4
return tmp;
13
Send an email
• Go to Manage Palette, select Install
• Install : node-red-node-email
• Configure your email with unice credential (use
your ENT account)
• Use a timestamp to test (click to trigger it)
• Email object is defined in msg.topic
• Email content is defined in msg.payload
14
Send an email triggered on luminosity level
• Add a function to detect is the
luminosity overpass a threshold
• Send an email with a sentence
16