A basic ESP32 template project to help me get started with any brand new ESP32 board. So, I thought it would be cool to share it with others.
It's a straightforward project that doesn't include anything overly complex, but it does offer the following features to help you get started right away.
I used the existing Arduino IDE code for OTA and made some minor improvements to the login and firmware upload page's user interface.
This can help us recover from certain behaviors that cause the ESP32 to become stuck. I've observed this issue on some ESP32-CAM boards, where the device would freeze after a few days or hours, requiring a manual power cycle. I believe that implementing a watchdog timer (WDT) will resolve these issues, as it will reset the board if it fails to report in within the specified time frame. The WDT is handled by the hardware, so if the timer expires, the board will automatically reset.
I tested this by forcing the WDT to bypass its reset, and I was able to confirm that the board was indeed reset, as shown below:
I have a private Telegram group where I receive notifications, and I've created a bot that sends a message to the group when the board is up and running. I've found this to be a simple way to monitor the board's status, but you can modify the behavior to suit your needs.
Immediately following the comment that says:
// Insert your custom code below, leaving the code above unchanged.
There are many areas for improvement, but this template provides a solid foundation that I can start using and build upon as needed. For now, I've identified the following areas for implementation:
- Wifi-Manager.
- Improve the security of OTA updates, as the current login page is a basic example that stores the password in plain text within the HTML (🤣) and does not prevent unauthorized access to the firmware upload page.