Not quite so sure. I suspect it would depend on what type of battery, the regulator, and the time taken to shutdown. With fairly aggressive polling you might have enough time. Plus you could optimize your "shutdown" process, by going with a readonly OS and do a data system write/sync first thing in the shutdown process, to ensure you don't corrupt your data file system. First step would be characterizing the system and determine the time from under voltage detected to battery collapse, which will hard power off the Pi.Unfortunately, that probably won't work. The Pi is monitoring the regulated 5V output from the regulator. By the time that drops below 5V, the battery is well and truly discharged, and it is far too late to shut down safely.You could write a simple bash script that periodically checks the output of "vcgencmd get_throttled" to see if the Under Voltage Detected bit is set, then trigger a shutdown.
We ran Pi's as part of a FRC robotics vision system and the matches ended with a match system generated end signal that hard powered off the robot's power system. In the early days we ran with 3B+s running off uSD (with no fancy read only file system) powered directly off robot power. Had very very few corrupt file systems. Could not use any additional power sources to cleanly shutdown the Pi. Later versions allowed separate small batteries and we could cleanly shutdown at match end.
Statistics: Posted by bjtheone — Fri Nov 22, 2024 6:51 pm