This project started out with me trying to use a sharp memory display. I wanted to see if and how I could program something that shows a 3D world or object through this black and white display. I came across Tim Clarke's amazing Mars demo and tried my best to program it on an ESP-32. After reading some papers on how it was originally programmed I came across Mark Feldman who programmed it in Java. Using that code as a reference I programmed it for the ESP-32 S3. Running the program on a high frame rate turned out to be quite a challenge and a trade off between terrain detail and speed. The world is basically drawn in rows starting from front to back. The more rows you draw, the greater the detail but also the longer it takes to compute. Eventually I decided to embrace the fact that I couldn't run it in high detail and with a high frame rate and I decided to make it run as long as possible instead. This led to a fun rabbit hole of trying to figure out how long a 18650 li-ion battery can last with different frame rates and with different sleep-modes of the ESP32. When doing a light-sleep the volatile memory is kept alive so when waking up from light sleep the world is not lost. When doing deep-sleep the volatile memory is lost so in order for it to work correctly the ESP32 needs to save the current world parameters to some non volatile memory. Now here is the kicker, saving the world also costs some precious clock cycles so it also costs energy, thus it will only pay off when sleeping for a longer period of time. 

On the hardware side of things there are only four major parts to the device: It is using the ESP-32 S3 MINI chip for as the main processor. The MCP73871 Li-ion charge uses solar energy to charge the li-ion battery. The battery voltage is converted to 3.3v using a ADP2108/AP2112 . Lastly there is the bq27441 fuel-gauge that keeps track of the battery's SOC and feeds that data into the ESP-32. The fuel-gauge chip also provides me with some hand-dandy power measurements and is showing when the battery is being charged by sunlight. When doing one frame per second the chip tells me that the whole system is using 14 milliamps at 4.1V which translates to a power consumption of 57 milliwatts. The Li-ion battery that I'm using stores a total of 12.95Wh so it should last for about 9 days. I currently have not been successful at measuring the power consumption at one frame per hour since the bq27441 chip can only average its readings for one second so for this we have to do some calculations. When the ESP32 is active I measured its current draw at close to 70mA (at 3.3v). This means its using about 0.23 Watts, or 230 milliwatts. It takes the ESP32 approximately 60 milliseconds, or 1.67e-5 hours,  to execute the code that renders the frame on the display. If we multiply the power consumption (0.23 Watts) by the amount of time using it (1.67e-5 hours) we know that it costs the ESP32 about 3.85e-6 Watt hours to calculate one frame. In light-sleep mode the ESP32 consumes 2.64e-3 Watts so during its almost one hour long sleep it will consume 2.64e-3 Watt hours. This means the power used to render the frame is also negligible compared to the power used to sleep. In a perfect world the device would work for 4900 hours or 204 days before running out of juice. 

However we also need to factor in the power consumption of the fuel-guage, display, charger-ic and the LDO. The fluke 175 that I used to measure the current has a accuracy of 1% +-3 milliamps so its uterly useless at measuring small currents so we just have to trust the datasheets here. According to the datasheet the Sharp Memory Display uses 50uW when not updating the image. The fuel-gauge uses 93uA when in normal operating mode, the battery charger ic uses 28uA when in standby mode. At 3.3v working voltage the fuel-gauge and charger ic add up to 0.42 mW. The LDO also consumes some power. The power lost with the LDO can be calculated by multipliying...

Read more »