Rapidly Build IoT Apps with Vortex and Node-RED

Quite often as a Maker you want an easy way to process and/or analyze data from one or more input sources to produce new data or information. This is the reason that Node-RED was created to provide a visual way of wiring together the Internet of Things (IoT). The premise behind Node-RED is simple; it is a library of different types of nodes that can be dragged onto a canvas and wired together. For some nodes it is possible to configure them to control their behavior. Once the nodes are connected (known as a flow) it can be executed. Really it is that easy to build an application.

To make it possible to use Node-RED to rapidly build applications for the Vortex DDS platform we have contributed two new nodes to the community. The nodes make it possible to ingest data from to write data to the Vortex data-sharing platform. A user provides the properties of a Vortex Web server which Node-RED uses as the access point to the Vortex platform. Data flows between the two over an efficient WebSocket based protocol.

Let us quickly build an application using Node-RED. In this application we build application that reads data from Vortex containing the geo-location of an object, it then calculates the distance from the object to Big Ben in London and finally writes the distance back to Vortex. We start by dragging a Vortex In node onto our Node-RED canvas.

Open the properties for the Vortex In node and then the first thing we have to do is define a connection to Vortex; the vortex property. The following config node will open.

We can configure the node to read PhoneSensorData and limit receiving the data to once a second.

Now we can drag a function node onto our canvas and wire the output of the SensorData node to the input of this new node.

In the function node we will calculate the distance to Big Ben from the latitude and longitude data we received from the sensor.