news

Releasing LTS of AWS IoT Device SDK for Embedded C on ESP32

Shanghai, China
Aug 27, 2021

We have just released our long-term support of the AWS IoT Device SDK for Embedded C on ESP32.

Since 2017, Espressif SoCs have been capable of connecting to the AWS IoT Core and related services. There are two ways to connect Espressif Wi-Fi SoCs to the AWS IoT Core.

The first one is by using the Amazon-provided FreeRTOS distribution. The FreeRTOS distribution is an all-inclusive solution, providing the kernel, the connectivity libraries, and its own build system. This offers a seamless way of  connecting qualified SoCs to AWS IoT and related services. Yet, there are certain limitations on using this FreeRTOS distribution, with Espressif SoCs. The SMP support for utilizing multiple cores of SoCs such as ESP32, as well as the support for newer SoCs such as ESP32-C3, are not yet available through the FreeRTOS distribution.

The second way of connecting an Espressif Wi-Fi SoC to the AWS IoT Core is by using the IoT Device SDK for Embedded C, which is a stand-alone library that includes support for MQTT and Device Shadow. However, support for other AWS services, such as OTA and Device Defender, was not available in this agent until recently.

However, newer releases of the IoT Device SDK for Embedded C, from 202009.00 onwards, include a larger set of libraries for connecting to various AWS services (AWS IoT MQTT Broker, Device Shadow, AWS IoT Jobs, AWS IoT Device Defender, AWS IoT Over-the-air Update Library etc.). Additionally, the above-mentioned newer releases provide maximum flexibility by allowing the LTS releases of the AWS libraries to be used separately. This option gives developers the freedom to choose from different Espressif SoCs and versions of ESP-IDF, which  allows for effective integration.

On that account, we have just launched support for the 202103.00 release of the SDK in beta, for Espressif boards: https://github.com/espressif/esp-aws-iot/tree/release/beta

Diagram comparing the two ways of connecting to the AWS IoT Core

At the time of writing this article, the beta release supports the following AWS Standard LTS libraries:

    • coreHTTP
    • coreJSON
    • coreMQTT
    • corePKCS11

and the following AWS LTS libraries:

    • AWS IoT Device Shadow
    • AWS IoT Jobs
    • AWS IoT OTA

To simplify the use of these libraries, we have made the following examples available:

Now, let us take a look at the Device Shadow library and the corresponding example to see how easily we can use it:

Note: The following section assumes that the reader is familiar with using AWS IoT from the Web console, and has ESP-IDF set up on their computer. If you have not set up the AWS IoT Core, follow steps given here. 
If you have not installed ESP-IDF, follow steps given here.

Begin by cloning the repository, checking out the `release/beta` branch and updating the submodule.

Then, go to the Device Shadow example and set the AWS IoT endpoint, identifier and port.

Note: The example has been tested with ports 8883 and 443. In general, port 8883 is for secured MQTT connections. Port 443 requires the use of the ALPN TLS extension with the ALPN protocol name, which is not required when using port 8883. More on this, here: https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/

Open menuconfig and set the required values.

Add the device certificates, as is shown here.

Finally, build and flash the example onto your Espressif SoC.

You should now start seeing logs on your console every few seconds, describing the current status. The README within the example contains more detailed steps and troubleshooting instructions, should you run into any issues.

While the port of these libraries to the ESP32 platform is in beta, they are ready to be used for development. We will continue to work on adding more examples and porting other available LTS libraries. They will be out of beta once the qualification is complete.

If you have any questions or face any problems, you can file an issue on our relevant GitHub repository.

Share this article
Reuse this content