Draining and charging
One of the critical points I want to test before deploying the station outside is how it behaves if it runs out of power. Think of dark December days with snow on the solar panel.
So, I implemented a “drain the battery” routine, which turns on the LED to full brightness and keeps it on while the CPU goes into deep sleep. And (after some failure using a forced reboot) an “hibernation mode” which is activated once the battery voltage drops below 2.6V.
In hibernation mode, the external power Vext stays off, the controller only reports its voltage every 5 minutes. If the voltage goes down, this is increased by 5 minutes. If voltage goes up, it is reset to 5 minutes. If voltage rises above 3V, normal operation resumes and sensors are turned back on. Writing it like this it reads as I am writing the software for the next mars rover…
Ok, going into hibernation mode worked (see photo), but when it should have come out, something froze. My guess (!) was that I forgot to turn off the LED; so the LED was switched on again when resuming normal operation. Ok, now added some routines to take care of this, currently in hibernation mode again, lets see if it comes out of it by its own or if it again needs a press on the reset button.