IoT Fundamentals

IoT Application Development with Node-RED

What is Node-RED

One tool that continues to make IoT and industrial solutions easier is Node-RED. Designed and built by IBM, Node-RED is a free, open source logic engine that allows programmers of any level to interconnect physical I/O, cloud-based systems, databases, and API’s. Users interact with Node-RED via a browser-based flow editor that makes multi-device and multi-API integrations as easy as linking together nodes into easily understood flows.

The flows in Node-RED are managed by the different type of “nodes”, where each node has a well-defined purpose or function; it is given some data, it does something with that data, and then it passes that data on to the next node in the flow or completes the data processing. The network is responsible for the flow of data between the nodes. Node-RED is based on flow-based programming which describes an application’s behavior as a network of black-boxes (nodes). These black-boxes exchange data across predefined message passing methods ultimately resulting in a visual representation of the Application in action. As an example, with Node-RED an Application can be broken down into discrete steps, then look at a flow to get a sense of what it is doing without having to understand the individual lines of code within each node. This not only saves time but is a major help when designing or troubleshooting IoT and Industrial IoT Applications.

The default Node-RED installation contains a large number of node types pre-installed for analyzing texts, running commands, sending and receiving HTTP / UDP/TCP / MQTT requests, queuing and dequeuing messages, and processing CSV files, HTML, JSON and XML messages. Also, services such as MongoDB and MySQL can be integrated and utilized with Node-RED.

Node-RED runs on Windows, Mac, and Linux computers, even such lightweight computers like the Raspberry Pi and BeagleBone Black, plus Industrials IoT gateways such as Siemens SIMATIC IoT 2000, Multitech MultiConnect Conduit AEP, Advantech IoT gateways, Rigado IoT Gateway, and much more… The Node-RED website provides all the supplemental documentation required to get run this program on your system, including installation instructions.

Who uses Node-RED?

With the expansion and adoption of Internet of Things (IoT) solutions around the world, Node-RED has become an invaluable tool for solution architects and developers because of its ease-of-use in flow-based programming and solution mapping. IoT solutions, otherwise known as Applications, are the convergence of the physical world with the digital world to extract valuable data to create insights that increase efficiency in a process or system. This convergence results in countless cause-and-event actions needing to be executed for controlling systems or notifying those in charge when a system is acting beyond its expectations. The flow-based programming is perfect for IoT Solution developers to visualize and control the workflow of data maintain and manage a series of cause-based events. Mix in the fact that Node-RED can be run basically anywhere you can install NodeJS, this program is IoT solution developer’s cheat sheet for solution mapping and maintenance.

How can I use Node-RED?

For a better understanding, let’s explore an HVAC System design using Node-RED. The data acquired from the room sensor (temperature & humidity) is being sent to a Siemens IoT Gateway over RS-485. The beauty of Node-RED is in the display and as you can see in the image below the first node “rs-485” is the serial communication after establishing the communication with the sensor. To pass the data from our sensor to an Application Enablement Platform (in this case Ubidots) to be interpreted by end-users a second node is used to parse the data into a format supported by the Application Platform (JSON). Now with the raw data flowing through the RS-485 node, through the parse function, to the MQTT node which establishes communication with the Application Platform’s broker and publishes the data passed through the parse function node.

By modeling an IoT Application in this simple to see and understand display, Node-RED makes the connection and processing of data easier than ever for solution architects. Plus, with the debug node availability, any message that computes or parses information in the Node-RED can be easily identified for coding errors and solution troubleshooting.

Communicate with Ubidots IoT App Development Platform with the pre-defined Ubidots node found in Node-RED.

Node-RED simplifies code development by providing a user a set of pre-built, easily connectable nodes to configure your data communication and functions from a sensor to its application for visualization and understanding. Now it’s up to you create new flows from your hardware to better economize and control systems of their environments.

Looking to get more from Node-RED? As was mentioned above, in the Node-RED documentation you can find new nodes, share your flows, and see what others have done with Node-RED. Plus, there are plenty of online Webinars to take you through the steps of device integration and Node-RED solution development. Lastly, if you have the hardware and are looking to develop your first solution or IoT Application, this guide contains a step-by-step integration for establishing a connection with the IoT and Cloud Application Development service Ubidots where you can simply integrate the power of Node-RED to deliver IoT Solutions. For a quick guide to Node-RED installation, Pravin Ganone’s article “What Is Node-RED And How To Perform its Installation?” is a great way to get started if the previously provided links do not provide the information you’re looking for.