This project implements a secure FOTA (Firmware Over-The-Air) update system for STM32 microcontrollers using an ESP32 module. Firmware is stored on Firebase, encrypted using AES, and transferred to an external STM32 ECU over UART.
After deploying an IoT device, it doesn’t mean the development is finished forever. On the contrary, this is the most important stage in the life cycle of an IoT product and still requires active development. We might want to add new features as a response to the users’ needs or it might be a necessity to improve the product security after discovering a potential risk. In either case, we need to have a means to update the firmware remotely without physically touching the deployed IoT products. Over-the-air (OTA) update techniques provide this capability.
Firmware over-the-air updates provide multiple benefits both to users and device vendors:
- User convenience: Users do not have to manually check for updates and do not have to connect their devices to their computers and download special software to update them.
- Improved security: Devices that are up to date are more secure, and updates will not be “put off” until a later time, or forgotten about.
- New features, bug fixes, and better device performance: FOTA ensures that users have the latest bug fixes and features, improving functionality, stability, and performance.
- Better outcomes for manufacturers: Rather than recalling faulty devices, manufacturers can deploy firmware over-the-air updates to fix devices in the field. They can also test updates on a subset of users who have opted in, to make sure that updates are reliable before wider deployment, improving reliability and brand perception.
- PlatformIO or Arduino IDE (for ESP32)
- STM32CubeIDE (for STM32 firmware)
- Firebase Console
- Python KivyMD (for GUI upload)
I used ESP32 as telematic unit for connection between server(Firebase) and ECU(STM32F103 Blue Pill)
KivyMD-based GUI allows uploading firmware to Firebase to make it easier for the user to upload updates to firebase and the relate information of the update.
- User uploads encrypted .bin file to Firebase.
- ESP32 connects to Firebase to check for new firmware updates.
- Secure update: Encrypted .bin firmware is downloaded then Decrypted (Using AES-256-bit Encryption and Decryption) and sent to the STM32 over UART.
- STM32F103 (Blue Pill) decides whether to accept the update or continue running the current application.
- Custom Bootloader receives and flashes the firmware.
- GUI built with KivyMD lets you upload the .bin file to Firebase with a user-friendly interface.
- LCD on STM32 displays status updates during the bootloading process
▶ Watch OTA in Action https://drive.google.com/file/d/1qW13902bDqihUqzlxZMMlfLW43RZjsd8/view?usp=drive_link