Learn node red tutorial with examples

why node-red tools required?

Learn nodered  tutorials with examples

From 2000 onwards, We have computers and desktop that runs web and desktop applications.  A few years back, mobiles and tablets came into existences and popular still continues. The industry started developing mobile apps that run on these devices. overall programmers write a software code for web, desktop and mobile applications. With recent advancements in technology. a lot of devices came into existence. different devices are sensors in cars/motors/home and electronic devices. Internet of things is a concept where these group of devices connected to the internet to exchange the data. We have to write a program/embed a code on this hardware devices to share data across cloud and DB servers.

A lot of Devices types introduced and a lot of data.  there are many things to dealing with devices.

It is very difficult to write an embed program or code and test it on each device type as it takes too much time to get it running and these devices produce/consumes a lot of data which needs Service API interaction with external services. To simplify this, we need to rapid application development to deal with devices. Because of all these things, Node-red visual flow tool Editor was introduced to link/integrate with different services without complex coding knowledge. It just needs to connect wires/flows node points in the editor and deploy the code easily. Mainly Node-red is useful for design, develop and testing  Internet of things  applications

These devices already have support for programming services via different devices like Raspberry Pi,  Android Arduino based devices

there are many Internet of things sample applications types

1. An electric motor can be controlled using Android devices to start/stop. 

2 Home applications like door lock and fan sensors to switch on/off via mobile

3. Weather sensors

From all these devices, a lot of data produced and stored in the cloud which we can use it for the analytical purpose to process and make better decisions for future purposes. 

 What is a node-red tool?

Node-red is the flow-based editor and it is an opensource application.  

It provides browser-based visual flow editor and it is very easy for developers/designers to wire the different nodes and services. here nodes are hardware devices This is a lightweight tool and built on the node.js framework. performance is good.

Node-red Installation and setup

To configure node-red tool, node.js installation is required. Please see steps documented at Npm and node installation.

Once NPM and node command is set up and running successfully. next step is to install node-red software

Setup on windows

-g option is to install the node-red globally

npm install -g ‚Äďunsafe-perm node-red

Setup on Linux based operating systems

sudo npm install -g ‚Äďunsafe-perm node-red

this installs node red successfully, run node-red command. this starts the node-red server on your machine and logs the below message to console.

17 Jul 22:28:41 - [info] Starting flows

17 Jul 22:28:41 - [info] Started flows

17 Jul 22:28:41 - [info] Server now running at

then access in your browser, admin UI opened. By default user login details not required.

node red dashboard

dashboard admin tutorials

This screen has three columns. the left column has node section center column flow editor where nodes dragged, dropped and wiring using API endpoints.
Right side column has info and debugging tabs to test the flow
Top right side has an option for production deployment.

Different types of nodes available

Inject node is to manual triggering of a node during the scheduled interval. Time will be configured.
Debug nodes are used to log the payload and object message to console.
template node supports mustache based template
dashboard section has different nodes for HTML form components
social section has nodes supports social media providers.
storage section nodes has support for file storage

there are nodes for TCP/WebSocket protocols support for communication with services

Features of the Node-red application

  • It is built on Nodejs architecture
  • Simple to use graphical flow editor
  • Very easy to set up the local environment
  • There are lot cloud providers like Microsoft Bluemix, Bluemix and amazon web services¬†
  • support for accessing third party services
  • Easily save and get the data from the database.
  • Rapid application development for Internet of things
  • Created Flows are stored as a JSON object. So you can do import/export flows
  • Docker support

node red MQTT protocol support

MQTT is abbreviated as Message Queuing Telemetry Transport. This is protocol based on messaging model using publish and subscribe pattern. This is implemented on top of the HTTP protocol. This is used in Internet of things - physical devices or mobile devices to communicate the messages over this protocol with limited network bandwidth.Facebook used this protocol for their online chat messenger application.

Node red provides MQTT Input node and MQTT output Node, MQTT Config node to connect to MQTT brokers to allow publish and subscribe messaging.

To have pub-sub model, Need server/broker which accepted published messages and send a notification to subscribers.

MQTT Input node

This node is available in node-red admin panel under input section. This connect and subscribe to the server for message notification. This act as subscriber

MQTT output Node

This node is available in the node-red admin panel under the output section.  This allows to publish messages to the server and act as publisher

messaging protocol
MQTT Broker - Eclipse Mosquitto
Mosquitto is an opensource messaging server for supporting MQTT protocol. It is lightweight and supports all devices. You can install on the same host where node red tool is running. In the Node-red, you need to provide a configuration in MQTT config node

nodered alternative tools

Nodered is flow level programming tool.

there is another alternative flow tool to nodered is a total.js platform available for the Internet of things (IOT) and Apache Nifi framework for communicate with different devices.. This is also based on nodejs framework

I will write next articles on Learn nodered examples on using raspberry PI devices.

Similar Posts