Saturday, March 26, 2016

IOT Cloud Connector for LabVIEW

National Instrument's LabVIEW is leading technology for test and measurement domain. Today, IOT Cloud Connector, a LabVIEW library for IBM Bluemix / Watson IOT Platform was published in LabVIEW Tools Network. The library is contributed by Espotel and is freely available.

Logo of the IOT Cloud Connector library by Espotel.
Connecting LabVIEW to cloud enables countless  applications ranging from real-time condition monitoring to process control and robotics. The value proposition of LabVIEW is "improving productivity of engineers and scientist", and that it definitely does by enabling fast and easy development of measurement applications and signal processing.

IOT Cloud Connector leverages the productivity to yet another level by enabling fast and easy integration of smart measurements to power of Bluemix apps. Use of cloud enables collecting data from multiple and different sources, performing advanced analytics, and integrating with any other system.

Smart measurements means not all the raw measurement data is beamed up to the cloud but edge analytics of some sort is performed already in the measurement device itself. Most commonly this means signal processing type of data aggregation providing relevant key indicators for the cloud application. Vibration monitoring is a good example where data is collected at the rate of tens of thousands of measurements per second, and it definitely does not make sense to store each measurement point in cloud but relevant indicators only in order to understand the nature of the given vibration.

Analyze of the measured vibration data gives understanding of the current condition of assets. In some extend it enables predictive maintenance, but the full power of operational optimization is achieved only when the data is combined with other data sources like ERP, Finance, order book, production costs, etc. Cloud is definitely the place to do such advanced analytics, and that's why the IOT Cloud Connector for LabVIEW is needed.

IOT Cloud Connector uses MQTT protocol - the ISO/IEC 20922 standard - to connect any LabVIEW-enabled equipment to IBM Watson IOT Platform and further to Bluemix. The range of equipment covers any PC running most common operating systems; Windows, Linux, or Mac. Also all NI measurement equipment are supported, including compactRIO, Single-board RIO, SOM RIO and myRIO.

CompactRIO with various interface modules.
CompactRIO is perhaps the most known measurement equipment from NI. It utilizes the Reconfigurable I/O (RIO) architecture. The fundamental idea of RIO architecture is that I/O is not wired directly to CPU but there is programmable FPGA in between. This way each I/O pin is fully reconfigurable for different purposes.


User does not need to understand FPGA programming but LabVIEW does that on behalf of user. Custom FPGA programs can be also created with the graphical LabVIEW tool only, with no need to touch the FPGA code. Custom FPGA really does take all the performance out of the hardware, and very fast and complex signal processing can be performed in real-time.

LabVIEW and Bluemix are really the "killer app" combo for industrial condition monitoring.

Wednesday, March 16, 2016

Watson IoT Platform and data storage

In December 2015, IBM opened new unit Watson Internet of Things, with its global headquarter in Munich, Germany. The core of the the new portfolio is Watson IoT Platform, formerly known as IBM IOT Foundation (IOTF).

Cloud data management model
Watson IoT Platform is handy way to connect IoT devices into the cloud. It provides device connectivity with MQTT - the standardized IoT protocol ISO/IEC 20922. Device management, token authentication, data storage and integration interfaces for further cloud applications.

Here comes the catch: Even if IOTF provides data storage, it should not considered as primary storage of your device data in production use. There are two main reasons:
  • Storing excess amount of data in IOTF is expensive
  • IOTF database does not provide QoS, data may be lost if delivered at high rate
So, what instead? Better way is to use IOTF only as an interface to cloud for your connected devices, and store your data in some No-SQL database like Mongo, Couch, Cloudant or Cassandra. This is much more robust solution as IOTF does provide QoS for data delivered.

Majority of device data generated in the world is deprecated just few seconds after it's created. Data aggregation may significantly reduce the amount of data that really needs to be stored for later use. However, if you wish to store all raw device data for later use like analytics not invented yet, it's better to use some long term data storage solution like Object storage, as data over there costs only a fraction of what it would cost to store it in the active No-SQL database.

This creates a three-tier data management model where Watson IOT Platform (IOTF) is the front-line to receive the data from devices. No-SQL database is the place where active application data is processed, and finally a Object storage or similar place is the attic for historical data perhaps never needed, but nobody dares to throw away.

Bluemix and Watson IoT Platform are tightly integrated and it's very easy to access the data in Bluemix application. Here is an example of simplest possible glue-logic to integrate IOTF and No-SQL database with each other ,Cloudant in this case. The example is implemented with Node-RED running in Bluemix Node.js application.

Integration of IOTF and Cloudant with Node-RED app in Bluemix.
The left-hand side IOTF node receives and data arriving in IOTF that meets the filtering criteria defined inside the IOTF configuration. The right-hand side cloudant node puts any data it receives into the defined cloudant database. If you need to do any filtering or data aggregation prior putting data into the database, just add a function node in between. If both IOTF and cloudant service instances are created inside the same Bluemix app, there is no need to configure any credentials here, those services are readily integrated.

In addition to being more robust than using IOTF database, this may be more economic as well. Free plan of IOTF provides storage space of 1GB for device data, where as Cloudant offers 20GB free quota per instance. Fetching data from Non-SQL database is also more comfortable with efficient query algorithms. Actually the REST API of IOTF only provides max 200 items at a time.

Reading data from Cloudant is as simple as writing it in, in Node-RED application. Here is an example of simplest possible implementation of REST API to fetch data from the database.

Implementation of REST API to fetch data from Cloudant in Node-RED.
With Watson IOT Platform, Bluemix, and Cloudant it's possible to build very quickly a robust, efficient, and cost effective IOT-solutions in cloud. The integration of IOTF and Cloudant overcomes all the pitfalls the current Watson IOT Platform has.