Get started with Microsoft’s Azure IoT DevKit

Add machine learning and stream analytics to your internet of things prototypes, even if they don’t run Windows

Get started with Microsoft’s Azure IoT DevKit
Simon Bisson/IDG

A key use case for Azure is as a place for working with the internet of things. A selection of IoT-focused services handle working with streams of data from any number of devices, adding machine learning and stream analytics. Most of the features you’ll need come as part of Azure’s IoT Suite, or through Cortana Analytics. In fact, the only thing that’s missing is the IoT hardware.

Where it comes to connecting devices to Azure, Microsoft takes an open approach. You’re not limited to x86 and ARM devices running Windows 10 IoT Core (though I’m sure the folks in Redmond would be quite happy if you chose that approach). Instead, the only real requirement is the ability to access Azure’s APIs. That lets you use anything from micro-PCs like the Latte Panda single-board computers with full Windows 10 installs to Raspberry Pis running Linux, as well as simple firmware-driven devices like those using the open source Arduino.

That gives you a big choice of devices, but it’s also hard to choose a platform suitable for a pilot program, especially if you’re looking to build a sensor-based IoT solution. Although most IoT projects start with off-the-shelf “maker” boards like the Arduino or the Raspberry Pi, production devices tend to be built around common Wi-Fi modules and ARM-based microcontrollers.

Introducing the Azure IoT DevKit features

Instead of developing its own IoT starter kit, Microsoft is working with MXChip to deliver a low-cost Arduino-compatible board that can work directly with Azure’s IoT tools. The result is an open source board built around a STM32F412 ARM microcontroller and an EMW3166 Wi-Fi module with 256KB of RAM and 2MB of flash storage. It’s got both USB connectivity and 2.4GHz Wi-Fi, as well as a collection of environmental sensors and a small OLED display. There’s even a microphone and an IR emitter, which should let you work with some of Azure’s machine learning-based APIs to build your own version of Amazon’s Echo.

Because the board’s microcontroller and Wi-Fi module are common components, code you develop on the Azure IoT DevKit should port to any production board, and because it’s Arduino compatible, it’s easy enough to connect to specialized hardware modules and to breadboards for your own sensor hardware development. For $40 or so, Microsoft’s MXChip partnership is delivering a good place to start with IoT/cloud integration.

So, what is Azure IoT DevKit like to use? There’s not much in the little brown box: the board, a set of stick-on rubber feet, and a USB cable. Everything else is software, with tools for both Windows and MacOS, based around the Visual Studio Code development environment.

Setting up Azure IoT DevKit

Getting started with the board up is easy enough. It uses a mix of USB and Wi-Fi connectivity; USB to load new firmware and Arduino sketches, with Wi-Fi to connect with the cloud and with your local network. I first had to hook the board up to my local network, by switching it to a built-in Wi-Fi access point mode that’s a simple Wi-Fi configuration tool. Using a phone’s web browser to configure the board, I picked the Wi-Fi network I wanted to use and set its password.

Once configured, I reset the board, and it connected to my network to check its firmware state. As a new release had shipped, I needed to update it, so I downloaded a new firmware image that I installed over the board’s USB connection. The board automatically installed the new image, rebooted, and reconnected to my Wi-Fi. The default firmware gives you a basic test of board functionality, running through the built-in sensors, displaying the results on the device’s OLED display.

With the Azure IoT DevKit hardware up and running, I downloaded a 305MB Zip file that contains all the tools you’ll need, including the Visual Studio Code editor, the Azure command-line interface, and Node.js. Other tools in the archive provide device-specific libraries, as well as the drivers needed to install software and test your code.

Installing it all is easy enough; I unzipped the file and ran the install.cmd script that handled all the work for me, adding the appropriate extensions to my existing copy of Visual Studio Code. One thing to note: The installer will install the Arduino IDE. You won’t actually need to use it, but it’s a prerequisite for the Visual Studio Code Arduino extension, installing drivers and libraries for the Azure IoT DevKit board.

Building your first Azure IoT application

Once you’ve got everything on your PC, you’re ready to start building IoT apps on both your Azure IoT DevKit and on Azure, with the Azure IoT DevKit board connected directly to Visual Studio Code. With a direct connection, code edited in Visual Studio Code will deploy, run, and debug on the board, giving you a roundtrip from editor to device.

Start by disconnecting your device from your PC, and launch Visual Studio Code. Once it’s up and running, you can plug the Azure IoT DevKit’s USB cable into your PC, where it’ll be detected by the Visual Studio Code Arduino extension. This will automatically configure Visual Studio Code to work with the board, opening a welcome page with links to Azure documentation and to sample code. I had a little trouble getting my development machine to detect the Azure IoT DevKit board the first time I plugged it in, but a quick reboot had me ready to go.

Microsoft has provided a set of tutorials to get you started, hosted on GitHub. I began with a basic Azure IoT Hub integration that would read environmental data from the Azure IoT DevKit, uploading it to Azure for analysis and display. The sample code included scripts that used the Azure command-line interface to configure a IoT Hub instance via an Azure Resource Manager template, taking advantage of Visual Studio Code’s built-in terminal, so I didn’t have to leave my IDE to use the Azure Portal. It’ll also collate the information needed to add authentication and connection data to your code.

Azure IoT DevKit get started Visual Studio Code IDG

The Arduino extension for Visual Studio Code includes tools to manage and deploy Arduino libraries to your board, which you’ll need to run any code you write. Choose the library you want and click Install. Once the library installs, you can configure your board to run the sample code. Again, you’ll use a Visual Studio Code script to get the connection details for the device, linking it to the IoT Hub you configured. The sample code then loads onto the board, which will reset and start sending data to Azure, ready for consumption in an app. The sample code published debug data over the device’s serial USB connection, data that’ll show up in Visual Studio Code’s serial console. You can also monitor operation in the Azure Portal.

Azure IoT DevKit monitoring IDG

Getting a board like this working and connected is only part of the story. Once you’re pushing environmental data at regular intervals, you can start to add it to a larger-scale Azure application, taking advantage of tools like Stream Analytics or Azure Machine Learning, adding data consumers to your Azure IoT Hub. What Microsoft and MXChip have done here is give you a place to start, what you do next is up to you and your business’s IoT needs.