Using esp-azure with PlatformIO IDE

Alwin Arrasyid
2 min readSep 5, 2021

--

ESP32 Azure IoT Kit. Image from https://www.aliexpress.com/i/4000016598284.html

I, most of the time, play around with many things including using esp-azure which should be used with Espressif IoT Development Framework (ESP-IDF) directly instead of using ESP-IDF with PlatformIO IDE. The reason I’m writing this on Medium is it might help anyone walking the same path as I did.

I conducted training for a participant from another part of the world who wanted to use Azure IoT Hub with ESP32 and ESP-IDF as the framework. The support for ESP-IDF on editors like Visual Studio Code isn’t as good as today at that time. So, we decided to use PlatformIO IDE (PlatformIO Core + VSCode). Debugging using a graphical user interface is also one of the big factors in deciding to use PlatformIO IDE.

The library that we used is called esp-azure, a port of Azure IoT SDK for C programming language so that it can be used with Espressif SoCs especially ESP32. This library takes a bit of work before it can be used with PlatformIO IDE.

Creating a CMakeLists.txt File

Until now, esp-azure only has a component.mk file that is used by ESP-IDF version 3 and below. We used ESP-IDF version 4 which uses CMake instead of GNU Make, so we need to create the CMakeLists.txt file for esp-azure.

Compiling the Code

Create a components directory in the root directory of the project. Copy esp-azure to components directory, then run pio run -t menuconfig to configure the ESP-IDF. Running menuconfig also forces the PlatformIO IDE to detect the CMakeLists.txt that we created.

Run pio run to compile the code and see if everything compiles without error.

--

--

Alwin Arrasyid
Alwin Arrasyid

Written by Alwin Arrasyid

Principal Engineer, working on better IoT solutions and enabling AI on the edge.

No responses yet