Lowering the barrier to entry when teaching IoT with the Azure IoT DevKit

Published Aug 27 2019 11:46 AM 1,767 Views


IoT is one of the fastest growing areas in the technology space, and academic institutions are eager to add IoT modules to their curriculum.


At it's core IoT involves having some kind of hardware, maybe with sensors or connectors to the outside world, a connection to the internet, and internet based services that the hardware interacts with. There are a huge range of options for both the hardware and internet services to be used, but the biggest problem is complexity - the complexity of configuring the hardware, connecting it to the internet and configuring the internet based services. The more complex the setup, the more time spent working with students to overcome this complexity, and the less time available to teach the important concepts.


Ideally you want a setup that reduces this complexity, a setup where the hardware is self contained with as much functionality as possible, where the internet connection and the internet services can be setup and configured with minimal effort. This is where the Azure IoT Dev Kit comes in, along with Azure IoT Hub and Visual Studio Code.


Azure IoT Dev kit


The Azure IoT Dev Kit, also known as the MXChip is a hardware prototyping board designed to connect to Azure, the Microsoft cloud service. It's relatively cheap based on the number of capabilities built in.


The MXChip board showing the position of sensors and connectionsThe MXChip board showing the position of sensors and connections


This is a great prototyping board - it's fully Arduino-compatible so can be coded in C, has a DAP link emulator so the code can be debugged whilst running on the board, and has a host of sensors and features such as:


  • Temperature, pressure and humidity sensor
  • Motion sensor
  • Magnetometer
  • An OLED screen
  • LEDs
  • Buttons
  • Microphone
  • Headphone socket
  • Finger connector compatible with the BBC micro:bit


Azure IoT Hub


As the name suggests, the Azure IoT Dev Kit is designed to work with Azure. Azure has an IoT service called IoT Hub, and this allows you to connect, monitor and configure millions of devices.


The Azure IoT Dev Kit can be quickly configured to connect to Wifi and to an IoT Hub instance, and upload or download data over MQTT - an industry standard protocol for sending messages to and from IoT devices. There's even a blue LED that lights up when the device is connected to an IoT hub.


Once you have data in the IoT hub, there are a number of other services that can respond to that data, such as Stream Analytics that allows you to analyze the data in real time, Time Series Insights that allows you to run analytics over time series data. You can also trigger serverless Azure Function code with every message received from the Dev Kit.


Best of all there is a free tier for IoT Hub allowing you to send thousands of messages a day to the hub without paying a penny. This is available as part of the Azure for Students offer.


Visual Studio Code


What brings this all together and manages a lot of the complexity is the Azure IoT Device Workbench extension for Visual Studio Code. Using this extension you can quickly create an IoT Hub instance and push this configuration to the board with only a few clicks. You can then code for the board in C with full intellisense, upload this code to the device and debug with only a few clicks. Once you have data flowing you can monitor this data flow both ways without leaving VS Code.


Using VS Code to configure your IoT Hub and board means your students can forget about the complexity of configuration and focus on what is important - learning the concepts such as MQTT, IoT architecture, sensors and real time data analytics.


VS Code is an industry standard developer tool, so the same tool students will be using for other programming languages, and may use when the enter the world of work. By using VS Code for their IoT projects the can stay in a familiar environment instead of using custom IDEs that may not be as fully featured.


Getting started


A great way to get started with the Azure IoT Dev Kit and IoT Hub is to build your first app. I've created a hands-on lab that you can work though to do just that, taking advantage of a number of different capabilities of the hardware and services.




To get started you will need an Azure IoT Dev Kit, and these are available from a number of suppliers globally.





You will need to install a few applications and tools to be able to program this board:


  • Visual Studio Code
  • Arduino IDE - NOTE On Windows DO NOT install using the Windows store, instead use the Windows Installer, for Windows XP and up.
  • .NET Core SDK
  • Azure Functions Core Tools
  • You may need to install a USB driver or configure USB support to communicate with the MXChip.
    • Windows: Download and install USB driver from STMicro.
    • macOS: No driver is required for macOS.
    • Linux: Run the following in terminal and logout and login for the group change to take effect:
      # Copy the default rules. This grants permission to the group 'plugdev'
      sudo cp ~/.arduino15/packages/AZ3166/tools/openocd/0.10.0/linux/contrib/60-openocd.rules /etc/udev/rules.d/
      sudo udevadm control --reload-rules
      # Add yourself to the group 'plugdev'
      # Logout and log back in for the group to take effect
      sudo usermod -a -G plugdev $(whoami)​


Azure account


To use Azure IoT Hub you will need an Azure subscription. If you don't have a subscription you can sign up for free.


If you are a student aged 18 and up and have an email address from an academic institution, you can sign up for the free Azure for Students offer at azure.microsoft.com/free/students. This will give you US$100 in Azure credits, as well as a load of free services for a year, and you don't need a credit card to sign up.


You can also sign up for a standard Azure free account at azure.microsoft.com/free. You will need a credit card for verification purposes only, you will not be billed unless you decide to upgrade your account to a paid offering. This will give you $200 in credits to use in the first 30 days as well as free services for 12 months.


The lab


This lab is implemented in both C and C#. The code running on the MXChip is in C, the code for the Azure Functions is in C#. The code does not have any error handling, it is intended to be as short as possible to help illustrate how to program the board as opposed to being production ready code.


  1. Configure the MXChip board
  2. Configure Visual Studio Code
  3. Show the temperature
  4. Send the temperature to Azure IoT Hub
  5. Store the temperature using Azure Functions and Cosmos DB
  6. Expose the temperature using Azure Functions
  7. Configure the LED colour threshold using Device Twins
  8. Clean up


You can find this whole lab, including the final code in GitHub at github.com/jimbobbennett/MXChip-Workshop. This lab is MIT licensed, so feel free to use it in any way you want to, including running it at student events such as Hackathons or using it in the classroom, either in its entirety or whatever pieces you need.
Version history
Last update:
‎Aug 27 2019 11:46 AM
Updated by: