with Arduino IDE (for ESP32)
Introduction
This page is part of the Lifecycle Management with Edge Impulse tutorial series. If you haven't read the introduction yet, we recommend you to do so here.
In this tutorial, we'll guide you through deploying updated impulses over-the-air (OTA) to Arduino using Edge Impulse. We'll build on Arduino firmware update workflow, incorporating Edge Impulse's API to check for updates and download the latest build.
Let's get started!
Prerequisites:
Edge Impulse Account: If you haven't got one, sign up here.
Trained Impulse: If you're new, follow our data acquisition and impulse design guides.
Key Features of Arduino OTA Updates:
Arduino OTA Update
OTA Code
Here’s the complete C code for implementing OTA updates with Edge Impulse on ESP-EYE (ESP32).
Prerequisites
A trained impulse in Edge Impulse Studio
Installation of required software as detailed in the tutorial
Preparation
Begin by setting up your device for OTA updates following Espressif's OTA firmware update workflow. Use the built binary from the C++ example and modify it to incorporate OTA functionality.
Steps to Deploy Impulse to ESP32
1. Copy the ESP OTA example and configure your wifi settings
Clone the example repository and adjust it according to your project and connectivity settings.
2. Server Side OTA
Modify the ESP OTA example server to check for updates to your project
2. Modify the ESP OTA example to check for updates to your project
Modify the Edge Impulse C++ example for ESP32 to check for updates to your project and download the latest build.
We will need to add a few libraries to the project to facilitate the OTA update process. These are taken from the ESP32 OTA example and are already included in the example project.
Components
1. Non-Volatile Storage (NVS)
NVS is utilized to persistently store data like configuration settings, WiFi credentials, or firmware update times, ensuring retention across reboots.
2. HTTP Client
This library facilitates HTTP requests to the server for checking and retrieving new firmware updates.
3. OTA Operations
These headers aid in executing OTA operations, including writing new firmware to the flash and switching boot partitions.
4. FreeRTOS Task
FreeRTOS ensures OTA updates are conducted in a separate task, preventing blockage of other tasks and maintaining system operations during the update.
3. Updating the Device
Compare the model's timestamp or hash with the stored version. If it's different or newer, call the download_model() function.
4. Monitoring and Repeating the Process
Monitor the device to ensure the new impulse performs as expected and repeat the update process as needed.
Conclusion
This tutorial provides a comprehensive guide for implementing OTA updates on Espressif ESP-EYE (ESP32) with Edge Impulse. Follow each step meticulously, ensuring all prerequisites and preparation steps are completed before proceeding to the deployment phase. Happy coding!
Note: Adjust the code snippets and steps to suit your specific requirements and always ensure to test thoroughly before deploying updates to live environments.
Last updated