This page is part of the Lifecycle Management with Edge Impulse tutorial series. If you haven't read the introduction yet, we recommend you do so here.
In this tutorial, we'll guide you through deploying updated impulses over-the-air (OTA) to Arduino using the Arduino IoT Cloud and Edge Impulse.
Let's get started!
Edge Impulse Account: Sign up here.
Trained Impulse: If you're new, follow our data acquisition and impulse design guides.
Remote Update: Update your Arduino board firmware remotely.
Integration with Edge Impulse: Seamlessly incorporate machine learning models.
Here’s an example Arduino sketch for implementing OTA updates with Edge Impulse:
To expand the Arduino sketch to work with the Edge Impulse API, you'll need to add functionality to fetch the latest model updates from Edge Impulse and apply them to your device. Below is an extended version of the loop()
, connectToWiFi()
, and onOTAEvent()
functions, integrating Edge Impulse API interactions:
loop()
FunctionThe loop()
function regularly checks for updates from the Edge Impulse API.
connectToWiFi()
FunctionThe connectToWiFi()
function includes a maximum number of attempts to connect to WiFi.
onOTAEvent()
FunctionThe onOTAEvent()
function is triggered when a new update is available, downloading and applying the update.
This sketch sets up the Arduino to connect to the Arduino IoT Cloud and listens for OTA update notifications. When an OTA update is available, the onOTAEvent
function is called, where you can implement the logic to download and update the firmware.
Setup Arduino IoT Cloud: Configure your device and variables in the Arduino IoT Cloud.
Connect your device: Ensure your Arduino board is connected to the internet.
Integrate with Edge Impulse: Export your trained impulse from Edge Impulse as an Arduino library.
Update Sketch: Incorporate the Edge Impulse library into your Arduino sketch.
Listen for OTA Updates: Use the Arduino IoT Cloud to push OTA updates to your device.
Test and Monitor: After deploying the update, monitor your device's performance and ensure the new impulse is functioning correctly.
ArduinoIoTCloud: Manages cloud connectivity and OTA updates.
WiFiNINA: Handles WiFi connections for compatible boards.
This tutorial provides a basic guide for implementing OTA updates on Arduino boards using the Arduino IoT Cloud and integrating with Edge Impulse. Expand and develop this example to suit your project's needs. Remember, testing is crucial before deploying updates in a live environment. Happy coding!