An IoT Prototype: Light Monitoring with NodeRED Components in Predix

by Ilya DrabeniaMay 5, 2016
Learn how to build an end-to-end IoT app and set up the edge device in just 12 hours—with Predix’s Chart and NodeRED components.

GE-Predix-Industrial-Lighting-Monitor

NodeRED is an open-source IoT tool that helps to reduce development efforts when working with hardware, APIs, and services. However, how long exactly would it take to build something tangible? What if we used it with a PaaS?

Our team has created some NodeRED components for GE Predix when working on a prototype for a light monitoring system. Here is a detailed account of the project, including its source code, data flow, hardware details, etc.

 

A description of the prototype

The prototype models an industrial light monitoring system based on an ambient light sensor, which is a simple photoresistor.

The device identifies the level of lighting conditions; the data is then processed and sent into Predix by Raspberry Pi. From there, a NodeRED app forwards the information to Dashboard Seed, which draws a graph—showing how lighting conditions change over time.

Each component is relatively independent, so the system can be easily scaled and adapted for larger enterprise use cases. This may include managing lighting conditions within manufacturing facilities, greenhouses, farms, etc.

The prototype is powered by three GE Predix services:

 

The hardware

For this prototype, I used the Universal Starter Kit for Raspberry PI. The device is Raspberry Pi 3:

  • CPU: 4×ARM Cortex-A53, 1.2 GHz
  • RAM:1 GB LPDDR2 (900 MHz)
  • Networking: Ethernet, 802.11n wireless
  • Bluetooth: 4.1 Classic, Bluetooth Low Energy
  • Storage: microSD
  • GPIO: a 40-pin header, populated

Raspberry Pi is connected to a board with a photoresistor and a two-channel analogue-to-digital converter (ADC), which converts analogue signals from the photoresistor into digital signals.

Predix-Lighting-Control-Prototype

 

The back end

The back end is made up of three components:

  1. On Raspberry Pi, we have a C app that reads light values from ADC, using the I²C protocol, and saves them to a file.

    GitHub repo

  2. A NodeRED app deployed to the same Raspberry Pi reads from the file and converts everything into a format supported by Predix Time Series. After that, it ingests the data directly into Time Series.

    iot-prototype-light-monitoring-with-nodered-components-in-predix-v1

    iot-prototype-flow-v1

    GutHub repo

  3. We’ve also configured another NodeRED flow that provides a way to query the Time Series Service and receive data in a format supported by Predix’s UI Chart components.

    NodeRED-and-Predix-for-Fast-Prototyping-Example

    GitHub repo

 

The front end

The UI app draws a chart based on the data. It is powered by Predix Seed and uses Predix’s UI Chart components. Data is updated dynamically through a method available in Predix’s UI. See these links for the source code of the chart app: chart.js and chart.html.

Predix-Seed-UI-Lighting-Prototype

 

Conclusions

This prototype is another proof that NodeRED really does save a considerable amount of effort, whether you are working with software or hardware. Using Predix’s Chart and our NodeRED components, I was able to build an end-to-end application, design the circuit, and set up the hardware in under 12 hours. Most of this time was spent on the hardware, the circuit, and the low-level application in C. Dashboard Seed has a steep learning curve, but with due experience, creating charts based on data from Time Series should not take too much time.

On the downside, Time Series has shown a significant latency in our use cases. Data becomes visible in 3–5 minutes after being ingested. The response latencies average at several seconds and can reach 10 seconds. Hopefully, this is temporary and performance will be improved in the coming months.

 

Further reading