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 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!Prerequisites:
- Edge Impulse Account: Sign up here.
- Trained Impulse: If you’re new, follow our data acquisition and impulse design guides.
Key Features of Arduino OTA Updates:
- Remote Update: Update your Arduino board firmware remotely.
- Integration with Edge Impulse: Seamlessly incorporate machine learning models.
OTA Code
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 theloop()
, connectToWiFi()
, and onOTAEvent()
functions, integrating Edge Impulse API interactions:
loop()
Function
- The
loop()
function regularly checks for updates from the Edge Impulse API.
connectToWiFi()
Function
- The
connectToWiFi()
function includes a maximum number of attempts to connect to WiFi.
onOTAEvent()
Function
- The
onOTAEvent()
function is triggered when a new update is available, downloading and applying the update.
onOTAEvent
function is called, where you can implement the logic to download and update the firmware.
Preparing for OTA Updates
- 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.
Steps to Deploy Impulse to Arduino
- 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.
Components
- ArduinoIoTCloud: Manages cloud connectivity and OTA updates.
- WiFiNINA: Handles WiFi connections for compatible boards.