I was honored to have the opportunity to speak at the internationally known NDC conference this past May that was held in downtown Saint Paul, MN. With such a wide array of speakers and technologies being covered, it was an amazing experience to be networking with fellow presenters, attendees, and sponsors from all over the world. While I speak with everyone from executives to engineers in organizations that are looking to implement emerging technology, I decided to take a more technical approach this time by doing a mostly hands-on session titled: The Fundamentals of Azure IoT. Here at Lab651, we are experts in implementing robust, enterprise-grade solutions, but also have what I would call a unique superpower to help companies build, test, and measure their ideas. Often times this involves just using off-the-shelf components, development kits, and quick-turn services like Azure. One of the best kits that I’ve found is the MXChip IoT DevKit.
The kit offers hardware that contains a number of different I/O:
- OLED screen
- headphone output
- stereo microphone
and sensors such as:
- humidity & temperature
- motion (accelerometer & gyroscope)
Plus, there are 25 external GPIO pins on the edge connector of the board, allowing you to connect to external sensors and actuators.
With the ability to program using a modern IDE like Visual Studio Code, the kit being Arduino compatible and easy integrations into Azure IoT Hub, Logic Apps, and Cognitive Services, it’s a no brainer if you are looking to build an MVP today and eventually plan to scale to full production.
In my workshop, I walked the audience through 3 different use cases. If you want to dive into the details or watch the presentation, you can check out my full slide deck and architecture diagrams or the video of my presentation.
I started by demonstrating how you set up your IDE environment, configuring the DevKit hardware, and secure communication with Azure IoT. The steps involved include:
- Creating a local Wifi hotspot to configure the SSID and password to get the hardware on the Wifi network
- Configure a resource group in Azure IoT and assigning that device to the resources group
- You are now prepared to go through the steps of pushing code updates to the DevKit
This first example worked through many of the same concepts to send temperature and humidity in JSON format to the Azure Cloud
Device State Updates
An extremely powerful feature that any IoT platform worth its salt is the concept of a “Device Twin”. Device Twins store device-related information. One feature is that they allow the administrator to update their “desired” device properties in the cloud and have these configurations automatically push to a set of managed devices. It also allows for a quick way to get “reported” properties for devices to know if things have changed locally. In this example, I walked through a series of state changes made in the cloud and then applied to the device.
- Displayed a local HTML page on in the browser
- This page made authenticated calls into an Azure Function that connected to the Azure IoT Hub to update fields in the device (JSON file)
- When the twin was updated, Azure handles pushing those changes down to the MXChip IoT Devkit
It’s cool to see how quickly these updates occur via asynchronous connections and how powerful this feature is from a device management standpoint. Detailed documentation and steps of this exercise I covered can be found here.
Building on top of the prior examples, I code the magnetometer in the device kit to demonstrate sending an email and SMS message when the magnetic state changes in the physical world. In my example, I showed a door opening and closing, but it could just as easily be an industrial piece of equipment that is out of alignment or any product generating a magnetic field moving through a facility.
- As the example will be sending SMS notifications, we configured the Sendgrid service to accept messages through Azure
- When changes in the magnetic field occur we call an Azure Logic app. The Azure logic apps are really cool in that they allow you to set up actions with zero programmings needed to call custom integrations (Sendgrid being one of many options) to send out the SMS and emails
Once the code is loaded and running on the device, all it takes is moving a magnet over the kit to cause the events to be fired. Details on docs and steps taken to implement can be found here.
The Microsoft Azure IoT platform is a powerful system that can be integrated into a fun range of IoT products. However, what’s most impressive with the MXChip IoT DevKit is the ease at which you can get up and running using industry development tools, solid I/O, and sensors that allow you to generate data and send it securely to your Azure resources. Then, once the data lands, the fun really begins with all the various analytics, visualization, and machine learning toolset that Azure provides.
Here’s just a shortlist of some of the Azure Technologies that were covered in my session and our experience implementing here at Lab651.