Lab Notes: Exploring the Capabilities of Node-Red

Mission Data
Mission Data Journal
4 min readJan 5, 2017

As the Internet of Things (IoT) continues to grow, we continue to learn about the various platforms that have emerged. Last time around we wrote about our experience with the AWS IoT platform, and since then we have been experimenting with Node-Red.

This was a considerably different experience from previous IoT platforms we’ve worked with, as Node-Red is run by users on their local machines, rather than remotely as a closed platform, and its goal is to simplify and streamline the process of developing IoT projects and applications. This is achieved by enabling the users to do a considerable amount of work visually using nodes that can be connected and chained with no more than a mouse.

Coding is still necessary, but the ability to work visually removes a considerable amount of tedium and is an enjoyable change of pace from more traditional development platforms. Key to this is the concept of “flows” and “nodes”, of which Node-Red maintains a library.

In spite of setting itself apart with its novel interface however, Node-Red shares the same shortcoming that seems to be common to many IoT platforms of lacking a knowledge base that is both detailed and centralized. Keeping all this in mind, we set out to see what Node-Red has to offer.

What We Did

To learn about Node-Red, we worked on implementing our standard IoT benchmark: a climate sensor. On the hardware side, we installed Raspbian on a Raspberry Pi and then wired it up to a DHT22 climate sensor. For software, we followed the instructions on the Node-Red website to get a fresh install of Node-Red and the DHT22 climate sensor node. It is worth noting that Raspbian comes with a pre-installed version of Node-Red but it is outdated. To store the data we used the same Python Server and Postgres Database system that we used for our previous IoT projects.

Although there is the option to do a global install of nodes for Node-Red, we found that it was more reliable to install needed nodes directly in the user directory. The current user directory is displayed when starting Node-Red from the terminal, and in our case was the default ~/.node-red as described in the Node-Red setup instructions.

Once the DHT22 node was installed, we ran Node-Red on the Raspberry Pi and could interact with it via a web browser. At this point it was a simple process of dragging nodes from the task bar onto the “flow” and chaining them in order. We used an Inject node to trigger the DHT22 node to collect climate data every 2 minutes. The DHT22 node then passes the climate data to a Function node with a JavaScript snippet that adds the data into a JSON document containing a device ID and timestamp. The data is then sent via an HTTP node and received by our Python server, which stores it in our Postgres database.

Challenges

Once Node-Red is working, it is surprisingly smooth and intuitive. Although each node requires configuration, looking at documentation usually makes the process quick and easy.

The issue is that there is not much documentation. Node-Red succeeds in making IoT development easier by allowing the user to bypass much of the tedium of the traditional coding approach, but at the same time introduces a different hurdle in not providing a knowledge base that is both detailed and centralized. Node-Red comes with a few dozen nodes pre-installed, and the library currently contains over 1000 nodes and flows, but there is a lack of the step-by-step instructions for beginners or fine details for more experienced users. User discussion websites are always a useful resource, but because IoT is such a new field, for some projects users may encounter difficulty finding relevant discussion if their project simply has not been attempted yet. There may also simply not be many individuals using the particular platform yet as well. This seems to the case to some degree with Node-Red.

Another point of consideration is that Node-Red is considerably useful for developing a small project, but its convenience may not necessarily scale with project size, especially if remote configuration is desired. The time saved in not needing to do as much coding would need to be weighed against the cost of connecting to each device and manually rearranging nodes as needed.

Next Steps

Node-Red has proven to be a robust IoT platform and one well suited to rapid and effective prototyping. In implementing this test, we grew curious as to the potential of Node-Red’s unique features. We plan on spending a little more time with Node-Red, and seeing how it handles a more complicated system.

--

--

Mission Data
Mission Data Journal

We build smart digital products that transform the way companies do business.