Automatic shutdown options for loss of power?

1,514 views
Skip to first unread message

Jim S

unread,
May 16, 2016, 10:03:13 AM5/16/16
to BeagleBoard
Recently lost power and corrupted my sd card badly and had to start over.  I have seen the battery "UPS" for BBB type but don't need another battery.  I have a small APC UPS for the BBB, DSL modem, a VOIP box, and a router but the UPS does not have a comm port to report status to the BBB.  Would like to set up so that when the AC power drops the BBB will shutdown in 5 minutes (most outages are shorter but this is still much before the UPS runs out of power).  If the power is restored before that continue to run.  When power is restored start up.  With an additional wall wart power supply I could generate a logic level signal for when the AC line is ok (input to UPS).  Does anything like this exist?  If not, anything similar enough that I could hack up the scripts a bit and get there?  Would rather not have to start from scratch.

evilwulfie

unread,
May 16, 2016, 10:24:53 AM5/16/16
to beagl...@googlegroups.com
only way to be sure it use the battery input on the BBB and the acpi shutdown
http://protofusion.org/wordpress/2014/08/beaglebone-black-soft-power-off/
problem is that once shut off via a shutdown now -h something must reset the processor
to get it to boot. 
also if the power outage is extended or you unplug to set on shelf for extended periods
the LI battery will run down fast because the pmic will continue to suck power off the battery
the external circuit must be able to disconnect the battery if power is removed for long periods.

other way is a read only file system with a ram overlay as has been mentioned on the list.


On 5/16/2016 7:03 AM, Jim S wrote:
Recently lost power and corrupted my sd card badly and had to start over.  I have seen the battery "UPS" for BBB type but don't need another battery.  I have a small APC UPS for the BBB, DSL modem, a VOIP box, and a router but the UPS does not have a comm port to report status to the BBB.  Would like to set up so that when the AC power drops the BBB will shutdown in 5 minutes (most outages are shorter but this is still much before the UPS runs out of power).  If the power is restored before that continue to run.  When power is restored start up.  With an additional wall wart power supply I could generate a logic level signal for when the AC line is ok (input to UPS).  Does anything like this exist?  If not, anything similar enough that I could hack up the scripts a bit and get there?  Would rather not have to start from scratch.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/ed9d6695-08ab-48b6-a3dc-8e645b8f4e4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jim S

unread,
May 16, 2016, 12:14:13 PM5/16/16
to BeagleBoard
That is pretty limited.  Sounds like just punting the software and going with a mostly hardware solution would be just as easy but then I am a hardware guy.  I think a UPS with auto shutdown AND restart capability would be something a lot of people would want but I could be wrong.

Harvey White

unread,
May 16, 2016, 12:44:59 PM5/16/16
to beagl...@googlegroups.com
How about an inexpensive microprocessor (of whatever variety), an
on-board backup battery, and enough smarts to shut down a BBB
intelligently? Perhaps a pin on the BBB might be dedicated to a
shutdown option. It's a combination of both hardware and software.
How much you pay for it, how much you decide to build into it depends
on your own desires.

Harvey

Wally Bkg

unread,
May 16, 2016, 2:35:55 PM5/16/16
to BeagleBoard, ma...@dragonworks.info
Looks like nut been ported to Debian for the BBB.

It and a smart UPS might be the easiest solution.

I'm thinking along these lines, but haven't done anything with it yet.  The nut client getting a signal over the network from my desktop is kind of what I'm thinking.  I've my BBW IOT app, router, and ISP interface on a separate UPS that I want running as long as the battery lasts, but a controlled shutdown of the BBW is something I'd like to add eventually.

The "shutdown if the power outage lasts longer than X" is pretty easy, robust automatic start-up when the power returns might require a smarter than the average UPS.

I'd be interested in success stories, but my experience with brand name (APC) and off-brand UPS with desktop system is while they are better than nothing, they  aren't good at reporting battery issues and ultimately I end up with a power failure and "pull the plug" type shutdown because the UPS batteries can't support the switch over.  We get a lot of 0.5 - 15 minute power failures from thunderstorms here,  so I'm sure the USP has saved me, but they are not foolproof.


Ultimately I'm trying to sell the wife on a "whole house" natural gas powered backup system so that a dumb UPS or battery with only a few minutes run time to let the generator come on and switch over would be needed.   She was excited about it after Hurricane Ike, but now that its been ~eight years, selective memory has her thinking we don't need it.



Jim S

unread,
May 16, 2016, 5:06:48 PM5/16/16
to BeagleBoard, ma...@dragonworks.info
I already have a big battery in the UPS so I don't need another one.  What I need is control.  I have an Arduino connected to the BBB for I/O that could help with this.  If the Arduino could interrupt the power to the BBB (or trigger the boot process some other way) that would handle power up.  It could also handle delay for power down.  Something like this:

BBB and Arduino powered from UPS.
Another wall wart power supply from AC line to Arduino to sense state of AC line

Upon loss of AC line the arduino would delay an amount of time and send a signal to the BBB to trigger shutdown.  Time delay would prevent shutdown for short line drops.  After time to shut down it would drop power to the BBB.
Upon regaining AC line it would close switch to apply power to BBB.  A small delay would probably be a good idea to eliminate possibility of very short off times.

The switch could be a relay or solid state switch.  And the Arduino could be any microprocessor. 

Wally Bkg

unread,
May 16, 2016, 5:30:08 PM5/16/16
to BeagleBoard, ma...@dragonworks.info
This is a solid idea and along the lines I've been thinking, I already have implemented the wall-wort AC-failure detector :)

Maybe its not a problem for you, but what happens if the power remains out long enough for the battery to run dead?  (we generally seem to have at least one 12-18 hour outage a year, often more if you are in flood prone or heavily wooded areas).   The "smarter than average" UPS purports to handle this situation by delaying its restart until the battery has re-charged enough to complete a reboot and shutdown cycle of the protected load.  Often the AC has many short outages for several hours after the restoration.

You might be able to implement something like this in an Arduino -- those Adafruit "Trinkets" are cheap and could be up to the task.

At this point I just hope for the best and accept the need for a "manual" restart after a major outage, but I'd like better if cost effective.

Harvey White

unread,
May 16, 2016, 6:09:21 PM5/16/16
to beagl...@googlegroups.com
On Mon, 16 May 2016 11:35:54 -0700 (PDT), you wrote:

>Looks like nut been ported to Debian for the BBB.
>
>It and a smart UPS might be the easiest solution.
>
>I'm thinking along these lines, but haven't done anything with it yet. The
>nut client getting a signal over the network from my desktop is kind of
>what I'm thinking. I've my BBW IOT app, router, and ISP interface on
>a separate UPS that I want running as long as the battery lasts, but a
>controlled shutdown of the BBW is something I'd like to add eventually.
>
>The "shutdown if the power outage lasts longer than X" is pretty easy,
>robust automatic start-up when the power returns might require a smarter
>than the average UPS.

I'd say that you want one that does automatic battery tests as well.
The one that I knew of at one time was a sine wave inverter.

To summarize the types of inverters, there are two schemes.

1) keep a battery charged at all times. When power fails, detect the
loss of AC at the output. Start the inverter and switch that power to
the output of the inverter. What happens is that power drops out for
the output with a power failure, and your equipment is supposed to
stay "up" for a certain amount of time (that the UPS takes to switch
on). Then the UPS takes up the load and life is good.

2) keep a battery charged at all times. Power the inverter from the
battery at all times. When the power fails, the battery charger
simply shuts down.

The second one is the one I'd think you'd want to get.

An opto isolator, driven by an AC bridge (or an AC style optoisolator)
would give you a power failure indication within a half cycle.

Harvey

William Hermans

unread,
May 16, 2016, 6:45:21 PM5/16/16
to beagl...@googlegroups.com
You do not need anything connected to the beaglebone for any reason. The beaglebone has an on die ADC that can detect if the AC mains is powered or not. In which case, after a preset time period the Beaglebone could shut its self down.

Meanwhile, an external "device" can just switch off the input 5V to the beaglebone after a preset amount of time. Then once you have AC power back, the "Device" simply turns the 5V back on.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Wally Bkg

unread,
May 16, 2016, 7:09:01 PM5/16/16
to BeagleBoard
On Monday, May 16, 2016 at 5:45:21 PM UTC-5, William Hermans wrote:
You do not need anything connected to the beaglebone for any reason. The beaglebone has an on die ADC that can detect if the AC mains is powered or not. In which case, after a preset time period the Beaglebone could shut its self down.

Meanwhile, an external "device" can just switch off the input 5V to the beaglebone after a preset amount of time. Then once you have AC power back, the "Device" simply turns the 5V back on.

This probably explains why I've not killed my BBB by just pulling the plug (both USB powered and via barrel connector on multiple different occasions).  But Derek Molloy's "Exploring Beaglebone" book says you shouldn't do this on Page 21 "how to destroy your Beaglebone".   Is he totally wrong here?

William Hermans

unread,
May 16, 2016, 7:16:21 PM5/16/16
to beagl...@googlegroups.com
This probably explains why I've not killed my BBB by just pulling the plug (both USB powered and via barrel connector on multiple different occasions).  But Derek Molloy's "Exploring Beaglebone" book says you shouldn't do this on Page 21 "how to destroy your Beaglebone".   Is he totally wrong here?

There is a big difference between pulling the power when the beaglebone is running, versus after it's shutdown.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

William Hermans

unread,
May 16, 2016, 7:18:27 PM5/16/16
to beagl...@googlegroups.com
Additionally, there is a big difference between yanking the power while the beaglebone is running, and nothing connected to it's external pins, versus yanking the power while the beaglebone is running and having one or more external pins connected to something.

Harvey White

unread,
May 16, 2016, 7:28:34 PM5/16/16
to beagl...@googlegroups.com
On Mon, 16 May 2016 15:45:14 -0700, you wrote:

>You do not need anything connected to the beaglebone for any reason. The
>beaglebone has an on die ADC that can detect if the AC mains is powered or
>not. In which case, after a preset time period the Beaglebone could shut
>its self down.

True enough. The prevailing wisdom was going with an external device
having all the smarts about power failure, while the BBB was being
held up by batteries.

The requirement that you propose is that the BBB have, somewhere,
access to power long enough to do a graceful shutdown.

How this is done is left as an exercise for the student.


>
>Meanwhile, an external "device" can just switch off the input 5V to the
>beaglebone after a preset amount of time. Then once you have AC power back,
>the "Device" simply turns the 5V back on.

Yep, and with the same requirements of powering from either a battery,
a supercapacitor, or something more exotic.

The bottom line seems to be that the BBB was not designed for this
kind of situation or application, and making it fit this requires
additional resources of some sort. Now the question comes down to
cost, utility, percentage of applications needing this, elegance of
design, and whether or not the hardware platform can cooperate in this
or whether or not it simply lives in its own world.


Harvey

William Hermans

unread,
May 16, 2016, 7:34:35 PM5/16/16
to beagl...@googlegroups.com
The bottom line seems to be that the BBB was not designed for this
kind of situation or application, and making it fit this requires
additional resources of some sort.  Now the question comes down to
cost, utility, percentage of applications needing this, elegance of
design, and whether or not the hardware platform can cooperate in this
or whether or not it simply lives in its own world.


Harvey

I think the real bottom line is that the BBB *could* have been designed to do all this and more. At additional costs. As Gerald has stated many times on this group. Which I can completely understand.




Gerald Coley

unread,
May 16, 2016, 7:37:29 PM5/16/16
to beagl...@googlegroups.com
I design systems like this all the time for our customers. They are nice enough to give me a bigger budget and not worried about keeping it low cost just to sell more boards.

Gerald



For more options, visit https://groups.google.com/d/optout.

William Hermans

unread,
May 16, 2016, 7:45:01 PM5/16/16
to beagl...@googlegroups.com
Also, while on the subject. It's kind of hard to understand how the rpi foundation can create their rpi line at so little cost. My buddy and I ( mostly my buddy ) priced out what it would cost to make a beaglebone, and for us, it would cost 4-5 as much as what they're sold for retail.

Quite honestly, the first iteration of the rpi I found rather repugnant. But now owning an rpi3 I see it is really a good little board that has limited uses in the embedded arena( true embedded, not just small cheap systems connected to 3 GPIO's )

But see, the Raspberry PI3 has quad cores, a really good GPU( which is where is shines ) 1G memory, ethernet, 40 or so pins for GPIO . peripherals, wifi, and BLE all for $35 . . . Honestly I do not see them making any money except from their government, from loses.

So even though I think the rpi3 is a really good deal, and a steal at $35USD, I still think the BBB is the better deal, even at a higher cost. For many situations. But how in the hell does the rpi foundation do it ? heh.

William Hermans

unread,
May 16, 2016, 7:45:54 PM5/16/16
to beagl...@googlegroups.com
that is . ..  it would cost us 4-5x as much to make our own BBB's . .

John Syne

unread,
May 16, 2016, 8:04:26 PM5/16/16
to beagl...@googlegroups.com
I believe they are sponsored by the British government and they produce far bigger volumes. 

Regards,
John




Harvey White

unread,
May 16, 2016, 9:13:53 PM5/16/16
to beagl...@googlegroups.com, beagl...@googlegroups.com
On Mon, 16 May 2016 16:34:28 -0700, you wrote:

>>
>> *The bottom line seems to be that the BBB was not designed for this*
>> * kind of situation or application, and making it fit this requires*
>> * additional resources of some sort. Now the question comes down to*
>> * cost, utility, percentage of applications needing this, elegance of*
>> * design, and whether or not the hardware platform can cooperate in this*
>> * or whether or not it simply lives in its own world.*
>>
>>
>> * Harvey*
>>
>
>I think the real bottom line is that the BBB *could* have been designed to
>do all this and more. At additional costs. As Gerald has stated many times
>on this group. Which I can completely understand.
>

Exactly. Now this demonstrates the difference between a hobby project
(where cost is secondary) and a commercial product, where cost is a
goal, if not a limit.

Had I designed it, it would have had a graceful shutdown
procedure.....

1) had I thought of it
2) had I had the need for it
3) had I figured out how to do it (after X tries, depending)
4) had I decided it was important enough to do (bearing in mind 1
through 3 above)
5) fill in other limits as needed....

Second guessing a design is easy. However, it does show that any
design (like plans of war) rarely survives contact with the enemy.....

Harvey White

unread,
May 16, 2016, 9:21:57 PM5/16/16
to beagl...@googlegroups.com
On Mon, 16 May 2016 16:45:46 -0700, you wrote:

>that is . .. it would cost us 4-5x as much to make our own BBB's . .

Economies of scale. Throwing in design time and debug time for free.

Similar board (physically), cost of two layer board in prototype
quantities is about 14 dollars, Xmega processor about 8, (22), cost of
connectors 5 (27), graphics chip 9 dollars (optional, say 36),
miscellaneous parts perhaps 15 dollars, total cost 51 dollars.....

That, however, is in single quantity units, effectively....

Boards can be had for far less, roughly 2 dollars or so, processors in
100's quantity are less, etc.... I guess we could talk less than 30
dollars for parts, depending.

The difference in such a design, is that while less capable, it's mine
and I know where all the bodies are buried, and why....

So the BBB is (all things considered) reasonably enough priced....

Harvey


>
>>>> *The bottom line seems to be that the BBB was not designed for this*
>>>>> * kind of situation or application, and making it fit this requires*
>>>>> * additional resources of some sort. Now the question comes down to*
>>>>> * cost, utility, percentage of applications needing this, elegance of*
>>>>> * design, and whether or not the hardware platform can cooperate in
>>>>> this*
>>>>> * or whether or not it simply lives in its own world.*
>>>>>
>>>>>
>>>>> * Harvey*
>>>> https://groups.google.com/d/msgid/beagleboard/CALHSORr8pWh47wzyi-jd_4U13X%2BfEDBj_r9Cf6Ao205AjYrX%2Bg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/beagleboard/CALHSORr8pWh47wzyi-jd_4U13X%2BfEDBj_r9Cf6Ao205AjYrX%2Bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Gerald
>>>
>>> ger...@beagleboard.org
>>> http://beagleboard.org/
>>> gco...@emprodesign.com
>>>
>>> --
>>> For more options, visit http://beagleboard.org/discuss
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "BeagleBoard" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to beagleboard...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beagleboard/CAHK_S%2BdzeQ3T_QDcThddEnaoVqzU9PiDCS1ncVFbd0qfsDyzXA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/beagleboard/CAHK_S%2BdzeQ3T_QDcThddEnaoVqzU9PiDCS1ncVFbd0qfsDyzXA%40mail.gmail.com?utm_medium=email&utm_source=footer>

William Hermans

unread,
May 16, 2016, 9:26:14 PM5/16/16
to beagl...@googlegroups.com
Had I designed it, it would have had a graceful shutdown
procedure.....

Technically this is already in place. You just need a $2USD battery.

But anyway, I've given this a lot of though, as my buddy forcing me to talk about this in great detail several times. Until he understood what I could do with an external MCU in software.

For a long time, he though he would be able to get away with using an external watch dog. And then he though that we could do all this solely using the PMIC + BBB interrupts. Which is partially true. But the "cant reset because I'm stuck in an odd power state" issue never occurred to him. Something that I've personally experienced first hand, several times. Now, after we've talked A LOT, and about the various potential situations, we think we've got it 100% bullet proof covered.

My own personal preference would be to have an external battery powering the 5V power in, and an external power supply charging that. With again, and MCU ( MSP430G2553 ) communicating back to the BBB. When it's time to shut down. Really similar to  UPS. but my buddy does not like that, he says the cost is too hight. And he is right, it would be.

William Hermans

unread,
May 16, 2016, 11:12:56 PM5/16/16
to beagl...@googlegroups.com
Something I honestly just now accidentally ran into that I thought was pretty cool.

https://www.youtube.com/watch?v=FcqQvH41OR4
Reply all
Reply to author
Forward
0 new messages