The goals of the project
Display and regularly update the daily weather forecast.
Show the indoor and outer ( balcony ) temperature and humidity.
Operate on battery power.
How long does it operate on one charge?
According to the first tests the device is capable to run for 60 days on one charge! Not to bad when updating the display in every 5 minutes and accessing the Internet in every 15 minutes.
Detailed explanation of the display elements
The device is connected to the Internet, and gets the accurate date and time, the weather forecast, and the moon phase data from a free HTTP API: https://api.weatherapi.com/
The outer temperature and humidity is measured on the balcony by an other smart device. The measurements are fetched from the local smart home server accessed on the local WiFi network.
Principle of the operation and the power management
The power conserving strategy is based on the following methods:
- Each component should deep sleep as much it is possible
- The CPU should run at the lowest possible frequency
The MCU spends most of it's time in deep sleep state. The scheduled wake-up's happen in every 5 minutes. The MCU runs at it's lowest frequency ( 10 MHz ) to conserve power.
It reads the indoor temperature sensor, reads the battery voltage using the onboard ADC, then updates the e-ink display with the acquired data and the updated timing info.
If the current cycle doesn't needs any other task to do, all the components are sent to deep sleep, including the display, the temperature sensor and the MCU.
In every 15 minutes the device connects to the WiFi network, to fetch the sensor data from the local smart-home server. To use the WiFi module the ESP32 needs to run at least at 80 MHz. After fetching the data, the WiFi module is immediately shut down, and the clock frequency is scaled down to 10 MHz again.
The weather forecast is fetched only in every 2 hours.
The device looks like this from the back with the cover removed:
The "brain" is a ESP32-C3 XIAO from Seeed Studio.
The display is a 4.2" E-ink display from Waveshare.
The indoor environmental sensor is a famous SHT-21.
The battery is a 600 mAh (?) - somewhat used - lithium-polymer one.
The case was designed in Autocad Fusion 360, printed on a Creality Ender 3 V2 using PM filament PLA material.
The firmware is written in C++, using the MCU vendor provided ESP IDF. The official Espressif SDK is excellent, the selection of the drivers, the documentation and the examples are super easy to use!
Remark: Forget the #arduino ecosystem, the free-RTOS based ESP IDF SDK is more clear, stable and easy to use.
Hi, is there any news when the code will be available? Would be very interested in it!