I've been doing a lot of work on the LiFePO4wered/Pi firmware this week. Much of that was related to new functionality made possible by the ability to measure the input (USB) voltage with the new #LiFePO4wered/18650 base, but the quality time I spent with the code also resulted in some good improvements across the board, including for the standard LiFePO4wered/Pi. Here's a summary:
- Auto boot when plugged in. Aside of the old "always boot when there's enough battery voltage" auto boot, being able to measure the USB input voltage enables the addition of an "always boot when there's enough input voltage and the USB power is present" function that so many people want.
- Smart auto boot. It's fine and dandy to automatically boot when power returns, but it's kind of annoying if this prevents you from shutting the Pi down on purpose. Based on a suggestion from a user, I added smarts so that the auto boot only occurs if the system was shut down due to a low voltage condition, not when the user did a shutdown either with the touch button or from a program on the Pi. This is now an option for both the battery voltage based auto boot and the USB voltage based auto boot if it's available.
- Auto shut down with timer. Many people want the Pi to cleanly shut down when external power goes away and boot up again when power comes back. This is now possible by combining the auto boot and auto shut down features (only with the new #LiFePO4wered/18650 base). The auto shut down will shut down the Pi if external power has been gone for a settable number of minutes. It is actually always active, but by default it's set to 65535 minutes and the battery won't last that long, so the feature is effectively disabled. :) If you want the Pi to immediately shut down when power goes away, set the auto shutdown time to 0. If you want the Pi to keep running across power outages up to 20 minutes, set it to 20. If the outage is longer than 20 minutes the Pi will be shut down with plenty of battery power left.
- Improved wake timer accuracy. While implementing the auto shutdown timer, I implemented a new minute timer subsystem that's much better than the one I had for the wake timer. So now the wake timer also uses this new minute timer and benefits from much more accurate timing. It still uses the micro's internal RC oscillator, but it's much less dependent on variation due to other stuff going on in the code. As an example, I just ran a test of the auto shut down feature with the time set to 30 minutes, and it triggered a shutdown at 29:59. Nice! :)
The improvements that are dependent on measuring the USB input voltage will be available when the version with #LiFePO4wered/18650 base goes on sale, the other improvements will be in every LiFePO4wered/Pi unit going forward!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.