I recently was asked to create an Azure IoT Client using the Mbed OS. I know that the ARM Mbed OS is a rapidly evolving operating system, so I thought that the first thing to do was to see if there was any reference/sample code available. After a lot of searching, I ended up on the Microsoft Azure IoT SDK github page. There is an Mbed OS reference design there but it is based on the earlier Mbed OS v2.0 and the current version is Mbed OS v5.9—and there is a lot that is different between the two. Nonetheless, I was hopeful it would work.
I am an optimist. So for Plan 1, I thought I would just update to the latest Mbed OS version and everything would compile and work—well it was a nice thought, but as you might expect, it failed spectacularly. So I had to switch to Plan 2: update everything necessary to get it working. In the end, all of the Azure SDK code worked as advertised and the only real issues I encountered were when implementing the platform API’s for my hardware. Based on this experience, I wrote a series of three blogs that detail the steps, tools, and software needed to successfully implement an Azure IoT Client using the Mbed OS.
The hardware I used for this porting effort was the Telus LTE-M IoT Starter Kit (available from Avnet).
An Azure ioT Client using Mbed part 1
This initial blog reviews the basics of how to get started with the project. It steps you through creating your Azure IoTHub account and what information you will need from it to embed in the Client source code. I end by summarizing how the IoT Client software will operate after it has been deployed to the target.
An Azure ioT Client using Mbed part 2
The meat of creating the Client software is in this blog. It reviews where you can download the source code from, what tools are needed to compile, and how to load it onto the target hardware. I also go over how to use the Microsoft tools to watch IoT Hub operations as well as how to push message to the Client device from Azure IoT Hub.
An Azure ioT Client using Mbed part 3
In this final blog, I discuss how you can switch the build process to use other network interfaces without changing the source code. While the overall blog series targets the Quectel BG96, there may be other network interfaces you want to use. I go over the changes necessary for using wired Ethernet as well as a WNC14A2A cellular modem. Other network interfaces that are supported by the Mbed OS can also be utilized provided the hardware is available.
Love it or Hate it, the one thing you have to admit about the ARM Mbed OS is that it makes it easy to implement code once, then reuse it unchanged on other targets!