Fotolia

With Node-Red, IoT development gets simplified

The Node-Red programming tool uses a flow-based development model to simplify IoT development, but it's not without its challenges.

The Node-Red IoT development tool allows developers to wire together hardware devices, APIs and online services using a graphical user interface. It draws on a flow-based development paradigm, which better matches IoT use cases compared to traditional procedural development tools. It also works in conjunction with JavaScript and Node.js and allows developers to take advantage of a rich library of prebuilt components.

The language was initially developed at IBM and has drawn support from a variety of IoT partners. IoT platform vendors are discovering that Node-Red can be used as a spring board for developing better tools. Hitachi Vantara Corp. plans to use it as the tooling for its Lumada platform, and Sense Tecnic Systems decided that Node-Red made it easier to focus on higher-level tools that bring enterprises the most value.

Rob Muir, director of product at Sense Tecnic, said, "We come from a background of developing our own IoT platform some years ago, but then discovered that's a very crowded space. During that time, we came across Node-Red, which solved many of the ease-of-use issues we saw with other platforms."

Opto 22 has embedded the Node-Red IoT tool directly into its edge-computing hardware products for industrial automation. This makes it easier for a larger audience to connect various web and cloud services to real-world industrial applications. Benson Hougland, vice president at Opto 22, said, "Our customers are engineers and technicians, and [are] largely rooted in operational technology systems, not information technology systems. Therefore, a rapid development platform using a graphical node- and flow-based methodology makes sense and allows them to accomplish these tasks quickly and effectively."

Focus on event-driven nature of IoT

IBM invented flow-based programming in the 1970s. It represents a way of thinking about a programming task in terms of the flow of the data in the system. Data is passed between discrete function units that act as black boxes. They are given some data, they operate on the data and then they pass on the data. These black boxes, or nodes as they are called in Node-Red, act independently from what they are connected to.

Nick O'LearyNick O'Leary

This model works well for the IoT domain due to its event-driven nature. A flow can be created that defines how data should flow from a sensor all the way through to whatever analytics it gets passed to. Nick O'Leary, Node-Red project lead and Watson IoT developer advocate at IBM, said, "In a large decentralized architecture, being able to visualize all of the components involved, how they relate and how they interact gives a much more powerful way of understanding the system."

With Node-Red, IoT abstraction is easier to understand

The main goal of all programming tools is to abstract away the underlying complexity of compute hardware. As programming languages and techniques have evolved since the dawn of computers, each major advance has represented a higher level of abstraction. For example, programming languages like Java and JavaScript make it possible for developers to write code once, after which it may be compiled to run on a wide variety of hardware. This approach works well when an app runs on one machine and only needs to interact with a single server. But the logic can get more complex when programmers have to think about coordinating application logic across hundreds of IoT devices, edge gateways, analytics services and web apps.

Screenshot of the Node-Red IoT development tool
The flow wires together the Watson Conversation service and the Watson IoT Platform to create a chatbot that can be used to control an IoT device

Flow-based tools like Node-Red add another layer of abstraction that makes it easier to understand logic flow across applications that span these more complex architectures. Each node in a flow has a well-defined purpose. It provides a simple interface and hides the underlying complexity from the developer. If developers can break down a problem into simple steps and identify a node suitable for each step, their problem becomes much easier to solve. "The visual aspect of flow-based programming is also a key benefit here -- it lets the developer see the steps taken by their program in a clear way, without having to step through individual lines of code," O'Leary said.

This makes flow-based programming more accessible to a wider audience. Domain experts, such as building maintenance engineers, may understand how they want a system to behave, but not have the programming knowledge to write every line of code needed. A tool like Node-Red allows them to create their desired solution with a minimum of coding. This reduces the time to create value and makes it easier to iterate on a technology and find new and unexpected value.

Addressing Node-Red, IoT early challenges

The danger with making it easier for a wider audience to write applications is that it also makes it easier to write bad applications. The visual aspect of Node-Red does not remove the need for developers to think about how to best structure their code.

There are currently over 1,300 third-party node modules available for Node-Red. IoT developers may find it challenging to make sense of the component nodes available to work with, as there is already some duplication. And just because another developer published their node for other IoT developers does not mean it is of high quality. "As with any package ecosystem, knowing what's available and their relative quality can be a challenge," O'Leary said. "This is something we're looking to improve in our own flow library."

Benson HouglandBenson Hougland

Also, Node-Red lacks a solid security framework. "Because our systems are used with industrial equipment, security is paramount," Opto 22's Hougland said. "For this reason, we've added both encryption and authentication to the Node-Red environment we provide, so our customers don't have to worry about implementing security on their own."

A growing community for IoT development

Going forward, the Node-Red team plans to address several high-level things around improving developer workflow within the editor and improving its extensibility. Other efforts are focusing on continuing to grow the nontechnical aspects of the project to ensure its long-term sustainability, like attracting new community members. This is enhanced by the social network around Node-Red. Hougland said, "Node-Red was built with social development in mind, permitting anyone to share their nodes or flows by simply sending textual files."

There have been over a million downloads of the Node-Red package, and it is also preinstalled on the Raspberry Pi. "The install rate is only increasing as more people learn about Node-Red and see that flow-based programming provides an easy way to create meaningful applications quickly," O'Leary said.

Dig Deeper on Internet of things platform