Overview
We have written a library around esp-idf that helps you focus on developing applications quickly. The library provides API which is simpler to use, you can write applications without digging into protocol level details. We have included some of the key requirements that are needed to go from prototype to production stage. Like device provisioning, every device that speaks to AWS IoT requires a unique device certificate to authenticate and connect itself. The current version of the library includes device provisioning by claim method, the device would acquire its certificate when it connects the AWS IoT for the first time.
Documentation
The documentation of the library can be found here. You may also refer to the provisioning user guide to know how to use this library for provisioning.
Getting started with the library
Requirements
- This library uses esp-idf v4.2
- Download and install the ESP-IDF tools installer for windows, or you may follow the official instructions here for other OS.
- Python 2.7.10 or later should have been installed by the ESP-IDF Tools installer, if not install it
- Clone the repository.
git clone https://github.com/BuildStormTechnologies/esp32_platform.git
Change the working directory to the provision example on cloned repository.
cd
esp32_platform/provisionByClaim
Example Setup
- Follow this article to setup AWS and generate provisioning certificates.
- Same certificates will be used for all the examples
- Copy the generated certificates to
..\<example>\main\claimCerts
folder and rename them as follows
aws-root-ca.pem
certificate.pem.crt
private.pem.key
- Update the following Wi-Fi and AWS parameters in
app_config.h
of the example
Building the project
- Open the
ESP-IDF 4.2 CMD
command prompt - Navigate to
..\<example>
folder - Build Command
idf.py build
- Erase the chip (first time only)
idf.py -p <SERIAL_PORT> erase_flash
Flash Command
idf.py -p <SERIAL_PORT> flash monitor
Testing MQTT Publish & Subscribe
- On first boot, device will register itself and reboot
- Open the AWS IoT console, and in the left menu, choose Test to open the MQTT client.
- Following images shows subscribe/publish functionality
The device logs the topic names on the serial terminal for your reference.
- Subscribe topic:
testSub/ESP32
- Publish topic:
testPub/ESP32
The free usage of library is limited to 30 min. It is meant for testing and demonstration only. If you need access to the source code of the library or if you’re looking for a customized solution, reach out at hello@buildstorm.com