As a professional who has worked for the past years on ERP projects, dive into IoT, machine learning and big data is a mix of challenge and excitement. There are many possibilities to create seamless solutions for common business problems but sometimes is quite overwhelming understand the available tools, what they can offer and how much time or skills we’d need to learn and use them.
In this post I’ll describe briefly my own experiments using Microsoft Azure tools and a physical IoT device to generate data and get an idea of how far and how easy we can go without deep knowledge on data science/analytics.
The project
Our goals in this lab are:
- Read the temperature & humidity sensor from an IoT device;
- Create a trigger to send alert emails if the temperature reaches a pre-defined threshold;
- Calculate the chance of precipitation using machine learning;
Store the output data on a storage container for reference; - Make the data available to external apps (e.g. web apps, PowerBI);
There are many ways to design your IoT solutions, including services not covered in this project – like Event Hubs and Azure Functions. The diagram below shows the services and external apps used in this experiment and how they connect to each other.
In other words, I’ll guide you through the steps to transform this:
Into this:
The step-by-step instructions are already provided by Microsoft and will be referenced where applicable. For the sake of simplicity, I’ll just describe the overall steps and include some personal notes.
Requirements
The device used for this experiment was an MxChip IoT DevKit. It contains many sensors (temperature, humidity, pressure, magnetometer, accelerometer), plus microphone, headphone, IR, led lights and even a small OLED 128×64 display. You can buy one here.
Several other devices can also be used for this purpose. RaspberryPi is one of the most common and simplest to setup. If you have one (v2 or v3), just follow these steps to have it up and running in a couple of minutes. The hardware sensors are not required as the code sample supports simulated sensor data. You can also use an online RaspberryPi simulator if you don’t have the hardware. Or you can just write your own emulated device using C#, Java, Python or Node.js.
If you rather use a physical IoT device, there are a couple of certified starter kits available.
A computer running Windows 10 or MacOS 10.10+ and an active Azure subscription (free 30-day trial account available) are required to run these samples. A PowerBI account is required if you want to create real-time dashboards (a free trial is also available).
The 4 steps are covered by the following topics:
Part 1: Connecting your device to IoT Hub and viewing real-time data
Part 2: Creating an alert using Service Bus and Logic Apps
Part 3: Using Machine Learning to calculate chance of precipitation and saving the output
Part 4: Using PowerBI for real-time data analysis