Battery backup and automatic shutdown and startup - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4) +--- Forum: General Discussion on PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=3) +--- Thread: Battery backup and automatic shutdown and startup (/showthread.php?tid=945) |
Battery backup and automatic shutdown and startup - caseih - 05-04-2016 Hi, I did a quick search of the forum but didn't find anything that touched directly on this topic, but if I missed it, point me to the existing posts. I know the Pine64 has a built-in battery charging circuit and if I read the specs correctly, should be able to run off the battery, at least for a short amount of time. I'm looking at developing a system where occasionally the power will flicker, and I want to have battery backup to keep it running through the bumps but if the power shuts down for longer than a certain amount of time I'd like to shut the unit down cleanly, and then when power is restored boot back up again. For the Raspberry Pi, modmypi sells a little integrated UPS unit that about does what I want. Could something similar be set up for the Pine64? At the moment I'm just looking at the options and the Pine64 is a very attractive. thanks. Michael RE: Battery backup and automatic shutdown and startup - tllim - 05-05-2016 (05-04-2016, 09:08 PM)caseih Wrote: Hi,No need UPS, just attach a 3.7V Lithium Battery to Pine A64 board. RE: Battery backup and automatic shutdown and startup - rahlquist - 05-05-2016 (05-05-2016, 12:54 AM)tllim Wrote: No need UPS, just attach a 3.7V Lithium Battery to Pine A64 board. tllim, is there anything one can access in software from linux gpio, i2c etc that one can tell from software if the pine is powered by battery or DC in? RE: Battery backup and automatic shutdown and startup - caseih - 05-05-2016 Right. I know it can run off battery. That's not was I was asking about. I need to know if the Pine is powered from battery, and if so, I need to initiate a complete shutdown after a certain amount of time, and then when power is restored, boot back up again. To summarize. Is it possible to: 1. detect in software if running on battery so I can halt the system 2. completely power down the pine from software 3. turn on when power returns I realize I could theoretically install a big battery, but I actually want the ability to shut it down by pulling the power for a long period of time (say 20 to 30 seconds). RE: Battery backup and automatic shutdown and startup - tkaiser - 05-05-2016 (05-05-2016, 06:59 AM)caseih Wrote: 1. detect in software if running on battery so I can halt the system Sure. There's the PMU, you can use the arisc mailbox interface to talk to it (might require that you write the appropriate driver before). Then you can read out all the values/states you're interested in. Rule of thumb: the older the SoC the better software support. See here for 4 year old combination of A20/AXP209. So maybe come back next year or in 2018. Powering down by software is simply shutting down the OS when reaching critical battery voltage (you're most probably not able to readout now unless you write the driver). And powering up is done when re-insert 5V through Euler pins 4 and 6. HTH! RE: Battery backup and automatic shutdown and startup - rahlquist - 05-05-2016 (05-05-2016, 06:59 AM)caseih Wrote: Right. I know it can run off battery. That's not was I was asking about. Even though tllim hasnt had time to get back to us, perusing the boot log from my pine shows me a few noteworthy things. Code: no battery, limit to dc First is from u-boot-pine64/board/sunxi/common/power_probe.c Second is from u-boot-pine64/board/sunxi/common/power_check.c RE: Battery backup and automatic shutdown and startup - caseih - 05-08-2016 So it seems like while the capabilities are theoretically there, there's probably not yet a good way to do this in the software, which is a common problem with all these proprietary ARM SoCs. I'm thinking the best way to proceed is probably to do power management separate from the Pine (or Pi or whatever) Maybe another microcontroller can monitor power, and signal the pine when power goes away so Pine will do a proper software shutdown, and then the microcontroller can cut the power entirely to the board until mains returns, after which it would power the Pine back on. Question for anyone that knows. Can the Pine64 be powered from the 5v pin exposed in the Pi-compatible expansion port? If so then the Pico UPS that has already been developed for use with the Pi should work with the Pine64. That would give me the software link I need. Anyway I think I'll pick up a Pine64 to play with in the meantime. thanks. Michael RE: Battery backup and automatic shutdown and startup - rahlquist - 05-08-2016 tllim, no idea about my questions? When booted into linux or android is there any way via software to tell which type of power the pine is running on? RE: Battery backup and automatic shutdown and startup - tllim - 05-09-2016 (05-08-2016, 09:54 PM)rahlquist Wrote: tllim, no idea about my questions? When booted into linux or android is there any way via software to tell which type of power the pine is running on? There is way but I have not resource to explore. RE: Battery backup and automatic shutdown and startup - rahlquist - 05-09-2016 (05-09-2016, 08:55 AM)tllim Wrote:(05-08-2016, 09:54 PM)rahlquist Wrote: tllim, no idea about my questions? When booted into linux or android is there any way via software to tell which type of power the pine is running on? Thats fine tllim just so long as I know there is a way I will look into it and see if I can figure it out. You keep doing other things that are more urgent like shipping boards and smoothing ruffled feathers. |