Internet Of Things

Dataworks as a company had been involved in a number of discussions in recent times with our customer base regarding IoT (Internet of Things) and collecting and streaming data to the cloud. Normally our input into the development of these IoT solutions would stop at the source device and as a consequence we were only conceptually aware of what is involved at the device level. We decided to change that by doing an internal proof of concept (POC) where we would take an off the shelf embedded system and get it to stream its sensor data to the Azure cloud. The aim was to give us a more rounded understanding of the entire IoT data chain. This article describes how we did this and what we learned from this exercise.

What is IoT

Anyone who has got this far into the article will probably already be very familiar with the term IoT. Even still, we wanted to include a definition in this blog which best described IoT from the perspective of our POC and found the following which we believe does this quite well.

“IoT is a network of physical devices, containing embedded systems with network connectivity which enable these devices to collect and exchange data”

POC Data Sources

We looked for some relevant data sources to use in our POC and settled on environmental data (temperature and humidity) as one of our source types. This is something that is often of interest in a manufacturing context where process engineering look to correlate environmental conditions with production metrics such as yield. We also wanted to use some faster moving data to show the real time capabilities of Azure. Accelerometer and Gyroscopic data were included in our source types for that reason.

Device Selection

Having had some experience of working with ST Microcontrollers in the past it seemed like the natural place to start our search for a suitable device for our POC. ST offered a solution which was exactly what we required. The P-Nucleo-CLD1 (shown below) is an evaluation kit which, as well as providing the necessary hardware (temperature and humidity sensors, accelerometer and gyroscope along with WiFi), came with full source code for the IoT solution. For the remainder of this blog we will refer to this as the ‘device’ for simplicity.

Cloud Solution Provider Selection

The selection of Microsoft Azure Cloud Solution was a straight forward decision for a cloud solution provider, given Dataworks long history of developing solutions using Microsoft technologies. Azure’s IoT Hub is a fully managed service that enables reliable and secure bidirectional communications between millions of IoT devices and a solution back end and was the final piece of our POC puzzle.

Microsoft Azure Applications

As well as the IoT hub, which would manage our IoT device, we wanted to explore other Azure applications which would showcase the kind of things you could do with a device which steamed data to the cloud.

Azures Stream Analytics was the first application that we wanted to look at. Stream Analytics performs actions on real-time data, such as updating an external database with processed information. The significance of this application deserves emphasis. Traditionally a solution for monitoring a data stream might involve taking all incoming data and writing this data to a repository such as a database. Periodic queries would then be run on the data repository to look for a specific type of event. Obviously an application like Stream Analytics, which acts on the incoming data stream has huge advantages over the traditional solution in terms of storage and response time and is a vital tool in any IoT solution.

Azure provides a number of cloud data storage options. For our POC we chose a SQL server database as the destination for our streaming data.

Time Series Insights was the final Azure application that we felt required was worth looking at in an IoT context. It is used to visualise the data being streamed from our IoT device and gave a tangible demonstration of the power of IoT.

Linking our Device to Azure IoT Hub

With all the hardware and software selected the next step was to integrate the various pieces into our IoT solution. To begin, we setup an Azure cloud account and created the IoT Hub which would be the destination for our streaming data and would also be the source to which our Azure storage and analytics applications would connect. The screenshot below shows the IoT Hub setup screen and the highlighted section in the bottom right hand corner contains the connection string which uniquely identifies our IoT hub.

Microsoft conveniently provide a desktop application called Device Explorer which allows you to setup your device to connect to your Azure IoT hub. It also provides some diagnostic and interrogation tools for use with your configured device. The screenshot below shows the configuration tab of Device Explorer where the IoT Hub connection string from above is entered.