Node-RED on Windows

Node-RED on Windows

Overview

Node-RED is a programming tool for connecting hardware devices, APIs, and online services in new and interesting ways. It provides a browser-based editor for linking flows using a wide range of nodes in the palette, where the flows can be deployed to its runtime in a single-click.

It was developed using Node.js taking full advantage of event-driven, non-blocking model. It has a light-weight and browser oriented user interface. This light-weight nature makes it ideal to run on low-cost hardware or devices such as Raspberry Pi, BeagleBone Black, and so on, and in the cloud such as Amazon Web Services (AWS), Microsoft Azure, and so on.

The three major features of Node-RED are:

  • Browser-based flow editor
  • Built on Node.js
  • Online flow library for social development

In this blog, we will explain about installing Node-RED on Windows machine.

Pre-requisites

Download the following from the provided links for your platform:

Installing Node-RED

Installing Node.js

The best and easiest way to install Node.js is to use Node’s Package Manager (NPM).

To install Node.js, perform the following steps:

select

Note: If you have already installed Node.js in your system, ensure that you have installed the latest version of it.

Installing Node-RED

To install Node-RED, use the below command:

select

Creating Node-RED Dashboard

To create Node-RED dashboard, use the below command:

select

Starting Node-RED

To start Node-RED, use the below command:

select

To enter Node-RED web workflow, copy the local host IP with Port and access via browser.

select

Understanding Node-RED Components

Before starting Node-RED flow creation process, let us know the name of the components and its uses.

The components of Node-RED are:

  • Node library
  • Visual Editor: Current Flow
  • Help/Info
  • Deploy
  • Debug
  • Node
  • Pipe

select

Creating Node-RED Flow with Dashboard

In this section, we are going to create a simple flow with inject and debug nodes to check debug output. The following nodes are used:

  • Inject Node (Time stamp) – To inject messages into a flow
  • Function Node (Random number) – To generate and pass each message
  • Debug Node (Message payload) – To display payload of the message or entire message
  • Chart Node – To visualize data in the form of charts

A simple random data generator is used for visualization.

To create a Node-RED flow, perform the following:

  • On the left pane, drag the inject (timstamp), function (Random number), debug (msg.payload), and chart nodes and drop it on editor.
  • Wire all the nodes as shown in the below diagram:

select

  • Open the inject node and set the time intervals.

select

  • Open the function node and provide the random data generator code as shown in the below diagram:

select

  • Open the chart node and set chart properties such as label names, colors, and so on.

select

  • Deploy the flow and check the debug node.
  • On successfully printing msg.payload random numbers, check the visualization dashboard.

Viewing Node-RED Dashboard

On successfully creating the process, check the visualization dashboard for real-time streaming data. A sample line chart dashboard output was created as shown in the below diagram:

select

Conclusion

In this blog, we discussed about quickly installing Node-RED on Windows and creating Node-RED flow to generate random values so as to create dashboard chart. Similarly, you can also install Node-RED on Linux, Mac OS, and so on, and create some complex flows and data collect from endpoints and Internet of Things (IoT) devices.

References

2484 Views 7 Views Today