Avoid bricked devices
Posted: Thu Sep 22, 2022 6:41 am
Hello ESP32 experts.
I’m working on a battery-powered device for monitoring some simple peripherals, display status on a tiny e-ink display and send/retrieve data using Wi-Fi. However, I would like the device to be updateable, in case there are bugs and updates for new devices and functionality. I read about OTA updating, but the thing is that the devices can be placed far from my residence.
I have experimented with Arduino and MicroPython, but would like to hear your opinions, regarding how to create the best solution.
Here are the criterias:
Arduino:
I’m working on a battery-powered device for monitoring some simple peripherals, display status on a tiny e-ink display and send/retrieve data using Wi-Fi. However, I would like the device to be updateable, in case there are bugs and updates for new devices and functionality. I read about OTA updating, but the thing is that the devices can be placed far from my residence.
I have experimented with Arduino and MicroPython, but would like to hear your opinions, regarding how to create the best solution.
Here are the criterias:
- A device must be able to either pull an update from the Internet or be able to have one pushed to it, using an app.
- A failed update must not lead to a bricked unit, since it does not contain any USB-port for restoring the software. It does contain a serial port connector for the software, which is only intended for preconfiguring the device.
- The device should use minimum power. It wakes up at certain, preprogrammed points in time, makes measurements and then hibernates. Normally, it’s interval is 1 hour.
- Since it’s battery operated, it must preserve power – so: wake up from hibernation, connect to Wi-Fi, send/receive data, update display and enter hibernation mode again as fast as possible. I would say that recharging the battery once every three months is acceptable.
Arduino:
- Divide the storage space into two, so that when an update is made, a backup is kept – and when successfully updated, the reference is switched when the device boots successfully for the first time.
- Push the software, using Arduino OTA and an app… but what happens, if the update causes a bug in the Wi-Fi connectivity?
- Pull an update from the Internet in Micropython, so that the Wi-Fi code and a timer interval will be thoroughly tested, but never changed. With intervals, it connects to the internet and if an update is available, the script is downloaded and stored.
If a script has a bug, I can produce a new version and have every device out there will still be able to download it.
- Drawback: I read that MicroPython is a bit more powerhungry and has a longer boot time – but I really don’t have a clue at the moment, how long a 5 – or 800mAh battery will last.