Giter Site home page Giter Site logo

negasonicx / advanced-ota-on-esp32 Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 69 KB

This is an advanced code to perform OTA ( Over The Air ) Firmware update on ESP32 either via Wifi or Ethernet Connection which would also show progress percentage.

C 100.00%
esp32 esp32-idf espressif ota ota-firmware-updates ota-update ota-updater firmware-update embedded-c

advanced-ota-on-esp32's Introduction

Advanced OTA with Detailed Progress on ESP32

This is an advanced code to perform OTA ( Over The Air ) Firmware update on ESP32 either via Wifi or Ethernet Connection which would also show progress percentage.

GPIO Functions:

I am using ENC28J60 Ethernet Module and Devkit v1's integrated Wifi.

  • GPIO 2 : Builtin LED ( Devkit V1 )
  • GPIO 18 : SCLK
  • GPIO 23 : MOSI
  • GPIO 19 : MISO
  • GPIO 5 : CS
  • SPI CLOCK MHz : 8MHz
  • 1) SDK Configurations for SPI has to be done on individual level
  • 2) Change "Single Factory App, no OTA" to "Factory App, two OTA definitions" from the menuconfig settings.

Understanding the Flow:

  • This code is developed for ESP32 on Embedded C Language using FreeRTOS.
  • Having the ability to update or fix bugs in an exisiting firmwarm without the need to physically change it using hard wire is a gift in Embedded Systems.
  • OTA or "Over The Air" update is a very well established methods for OEM Tech giants to update firmware of the existing devices on the field.
  • The program has the provision to send URL and OTA Intialization commands via the MQTT "cmd topic".
  • There are 2 MQTT Topics : "data topic" - for continuously publishing data if needed & "cmd topic" to perform OTA by sending commands to the client ( ESP32 ) from the MQTT Broker.
  • Step 1 : Get the cmd topic which would look like : <mac_address/cmd>
  • Step 2 : Send the OTA URL payload on the cmd topic as : {"OTA_URL":""} ( it should be the "bin" file of the firmware )
  • Step 3 : Send the OTA Initialization command on cmd topic as : {"START_OTA"}
  • That's it, if the specificed OTA URL is correct and ESP32 has Internet Services, then via HTTP protocols, it will download the "bin" file and you can see the progress of the same on the serial monitor.
  • Keep in mind, all the other RTOS task will be deleted while performing OTA and once successfully downloaded, ESP will create a partition and update the running firmware to the one provided in the bin file.
  • Also, if the OTA fails in the middle or some other issues, ESP32 will just reboot and run on the existing firmware.

Conclusion:

  • There is nothing to conclude this time, it's super cool and works flawlessly ( unless you have not set the menuconfig properly and other including files like server certs files ).
  • I hope you all like it :-D

advanced-ota-on-esp32's People

Contributors

negasonicx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

felipedsi97

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.