Self updating website

This is typically shown on a web page provided by a built-in web server on the ESP8266 device, or by debug output on the serial port.But how about when you are dealing with battery powered devices which spend the vast majority of their time in deep sleep?In my enviroment, I use a 32-bit integer to identify the build number.

self updating website-56

We compare the new firmware version number to the current version as defined in our global constant variable.

If the version available on the server is newer than what we’re running on, build the URL to download the firmware image from and pass this to the OTA updater.

The hardest thing actually becomes getting the web server side set up, rather than the changes required on the device itself.

The firmware server can be any web server accessible over HTTP.

However, for simplicity and the sake of this example, I’ll just put a plain version number in there.

The specifics of how you organise and name the firmware images is completely up to you, of course.

When connecting to a local firmware server, this check takes about 20 ms extra time and it uses a tiny bit of battery power.

By itself, this is less than the background noise in the energy readings, so I would not be too concerned with additional power consumption caused by the firmware updates.

(Or HTTPS, will get back to that later) For my projects, I decided to create a folder containing the firmware images, and to give each image a name derived from the MAC address of the ESP8266 device it applies to.

Along with each firmware image is a simple text file with a single line containing a build number/version number.

We’ll build the URL to download the version number of the currently available firmware image.

Tags: , ,