OTA Update - dalathegreat/Battery-Emulator GitHub Wiki

What is OTA?

Over-the-Air (OTA) update is a mechanism that allows firmware updates to be deployed to ESP32 devices wirelessly, eliminating the need for physical connections. Elegant OTA is the library that facilitates this process on ESP32 microcontrollers.

Prerequisites

Before being able to use OTA, ensure you have the following prerequisites:

  • #define WEBSERVER enabled in the USER_SETTINGS.h file on the already flashed software
  • A Wifi connection established to the board
    • Either a direct connection to the board
    • OR a connection via a router (see USER_SETTINGS.cpp for Wifi settings)

[!TIP] Starting from version 7.0.0 , many settings are stored to persistent memory. This means that all the things you configure in Webserver (Wifi settings, max charge/discharge rate, SOC scaling settings, Battery capacity) dont have to be configured again. The system will use the previously set settings automatically!

Generating the .bin File via Arduino IDE

To use the OTA feature, you need to generate a firmware binary (.bin) file from your Arduino IDE project. Follow these steps:

  • Open your Arduino IDE and load the new Battery-Emulator release you want to update to the board.
  • Configure your settings, the following are mandatory:
    • Correct battery & inverter choice (USER_SETTINGS.h)
    • Which hardware you use (USER_SETTINGS.h)
    • CAN configuration (USER_SETTINGS.cpp)
  • Generate the .bin file, via "Sketch", "Export Compiled Binary"

bild

  • This will create a folder called Build where you opened the Software.ino file

bild

  • Inside the Build folder, locate the "software.ino.bin" file. This is the file to be uploaded to the board.

Performing the OTA update

  • Start by navigating to the web address (Note that IP will be different compared to direct / router connection)
  • At the bottom of the page, click the "Perform OTA update"

image

  • On the ElegantOTA page, select the "Select file" option

image

  • Select the Software.ino.bin file found in the '...\Battery-Emulator\Software\build\esp32.esp32.esp32' folder, that you generated previously

  • Flashing will commence, once completed you will see this message:

bild

  • Congratulations, you have now updated the firmware remotely over the air! 🥳