Martin's corner on the web

ESP32 OTA firmware update using compressed firmware image over HTTP (s) / MQTT (s)

Performing Over-The-Air firmware update over a slow/unreliable internet connection may be challenging. I have had many cases, where the edge nodes to be updated are in a remote rural area with a 2G modem internet connection, and pushing a let’s say 1.1MB firmware file can be challenging. The OTA times out multiple times before succeeding, and in some cases, it simply does not complete.

To solve this, I decided to test OTA firmware updates using a compressed firmware image, pretty much the same approach esptool uses to reduce the serial transfer size when you flash your ESP32 device from the console. Using ZLIB, the firmware image binary size is significantly reduced, for example, a 1.1MB file is scaled down to 600KB. The reduced firmware size increases the chances of a successful OTA over a slow/unreliable connection but also eases up on the server traffic in bulk OTA updates cases, as the OTA image provider has to deliver half the image size.

So it is a win-win process, the only draw-back is that there will be a need for extra memory to handle the firmware image decompression, a fixed size 32K buffer is needed for the purpose.

This works both over HTTP(s) and MQTT(s) (see my OTA over MQTT blog post), so can be quite useful.

Below is a short video demonstration of the process:

Compressed image ESP32 OTA
Tagged on: ,

2 thoughts on “ESP32 OTA firmware update using compressed firmware image over HTTP (s) / MQTT (s)

  1. Thorsten von Eicken

    Hi, I’m going down that same path, is your code available somewhere? Thanks much!