Pimp My Battery Powered Lamp (SunRise/Set Edition)
This was a small project I put together in between other projects. We have quite a few battery-powered LED lamps around the house, but for us there are two issues with them:
Either you forget to turn the lamp off, and the battery drains quickly, or you forget to turn it on in the first place.
So I removed the original PCB from the lamp and replaced it with an ESP32-C3 and a charging module. I used a resistor to power the existing LED directly from the IO (so no need for a MSFT and power consumption is also low). With a different controller (e.g., ESP32-S3), you could continue to use the touch button.
I configured the lamp to turn on at 6:30 AM and stay on until sunrise, and then turn on again at sunset and stay on until 9:00 PM.
Here’s how it works:
On first startup, the ESP32 gets the current time from the internet. It then calculates the number of seconds until the next event and goes into deep sleep for that duration. An RTC variable stores whether the lamp should be on or off when it wakes up. Whenever the ESP wakes up, it calculates the next event. I let it run for 2 weeks to determine the inaccuracy of the internal clock, and then I implemented a correction.
Battery life depends on the time of year. In autumn, with the original battery and the resistor in place, this single-LED lamp runs for weeks without needing a recharge, even when used for 4–6 hours a day.
Because of the simplicity of this project and the cozy light it produces, I wanted to buy a few more of the same lamps. Unfortunately, it seems that they are no longer available on AliExpress. In the past, there used to be plenty of listings for them at under €10.
