surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Safe shutdown - Simple way

Tue Mar 25, 2014 11:49 am

Hi all,

I am a total beginner in electronic so I need your advice if this simple circuit for provide a safe shutdown, with two super cap of 10F, can works.

Thank you in advance.

Image

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 12:40 pm

The circuit is similar to battery operated power supply except that the details of the 5 V boost regulator are not shown. Should work in principle if the supercapacitors are large enough.

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 12:54 pm

Thank you for your answer. Could you check if the resistors value are correct?

Thanks again

Tarcas
Posts: 740
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 1:50 pm

I'm WAY confused as to what you're doing. All you need is a script that runs, checks a GPIO pin with a pullup resistor, and if it's low, execute the shutdown command. No need for any capacitors or more than one resistor. If you want simple way, a 4- or 5- line daemon script and 2 components seems WAY simpler to me than this.

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 1:55 pm

The mention of supercapacitors make me think that the OP is wanting something that will shut down cleanly when power is removed, more of a UPS that a shutdown button...
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 2:23 pm

Exactly. The function of super cap is to providing at least 20 sec. of time to do a clean shutdown. The GPIO7 will detect when main power gone... and the shutdown procces will start.

Could you check of the value of the resistors are corrects? I'm a beginner in electronics and I'm worry to blow the super cap.....

R1 is in the correct place, to limiting the ampere source of 0.5A? I don't want to connect it in the USB of my new TV and burn it....

The 2 super cap are well balanced?

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 3:57 pm

Sorry, but I think, it will NOT work the way as you described. And there are many reasons, I'll only describe one:
Lets assume your super-caps are full loaded, say 4,8V if youre using a good schottky-diode. The raspi is pulling 300mA (if we're assume a value very near to lower limit). So you will only have 1,8V after your 10-ohm-resistor, if the input-power is gone. Not enough for powering a PI ...

MfG, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 4:17 pm

....You have reason.... and if I add another path with another diode? Too easy to works?

Thanks

Image

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 4:40 pm

OK, lets say this diode solves this first problem.
Next question (quote from your picture):
DISCHARGE TIME = FROM 5V TO 2V (700mA) 20sec.
Where did the "700mA" came from? Did you measure this in the 5V-line to the PI? Do you know, that you have to the 2V-Step-Up a much higher current?

MfG, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 4:50 pm

I consider the max current that the rasp can use. It isn't?
The USB step-up converter can manage 1200mA at 5V.... about 1000mA at 3V. So will be enough to keep on the raspberry for 20 sec. more or less.... no?

Thanks a lot for your help

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 5:17 pm

700mA are "a kind of standard-value" for very many calculations, thats right.
But in real it depends on many things: CPU-load, connected devices etc. ...

If the raspi is pulling 700mA (at 5V) and you have an ideal step-up-converter and feeding this with 4V only you have provide (at input side) 875mA, if you're feeding 3V in then 1167mA and so on. Means: lower voltage = higher current fom supercap ...
And voltage from supercap decreases always, so some time you'll reach the point, where you'll come "out of regulation-range". What I'll say, such calulations are not so easy, as it seems ...

In practice an ideal step-up-converter did not exist, so that the current will be (at least a little bit) higher than said here ...

MfG, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 5:24 pm

I would simulate the circuit first with Spice, for example with LTSpice, and search the right component values by trying different resistor values. If you can simulate the boost regulator too you will get an idea of initial voltage transients.

The next step is then to build the real circuit and test it. For initial testing suitable load resistor could be used instead of RPi. Something like 5V/0.3A = 10 - 30 ohms. The load current is not constant of course with the RPi, but that should give you the first idea how the circuit behaves.

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 5:46 pm

I think to have understood. And if I add more Farad? For example 2x super cap of 2.7v / 25F give me 12F. With these value I can reach the 20 sec. with a 1A of load.... No?

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 6:00 pm

C = Q/U or Q = CU = 12 F * 5V = 60 C.

60 C/20 s = 3 C/s = 3 A.

Or 60 C/1 A= 60 C/1 C/s = 60 s. In principle. I have never used these supercapacitors myself.

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 6:09 pm

@hampi: I'd fully confirm your words.
But we have to think on another thing: the step-up regulator needs a minimal input-voltage. (In our example 2V?) Input should never, really NEVER, go beneath this value! (EDIT: At least not, as long RasPi is running!)
That's why simulating as first is a good idea; built this with a static resistor of ~10 ohms for some tests too ...
It's difficult or impossible to give absolute values without any tests!?

MfG, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Tue Mar 25, 2014 8:50 pm

@hampi

Ok, now I'm lost... I know that I must test it before... But with your formulas... Could it works with 12 F cap?

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Safe shutdown - Simple way

Wed Mar 26, 2014 12:33 pm

surfparadise wrote:Ok, now I'm lost... I know that I must test it before... But with your formulas... Could it works with 12 F cap?
More correct order of magnitude is to estimate the stored energy

E = 0.5 * C * U^2 = 0.5 * 12 F * (5 V)^2 = 150 J

With 5 W power consumption this gives a time of

t = 150 J/5 W = 150 J/5 J/s = 30 s

assuming 100 % conversion efficiency and no technical electrical engineering details.

Edit: next iteration is to consider the power transfer from source to load
http://en.wikipedia.org/wiki/Maximum_po ... er_theorem

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Wed Mar 26, 2014 2:41 pm

Thank you!

MrEngman
Posts: 3836
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Safe shutdown - Simple way

Wed Mar 26, 2014 4:24 pm

Simple? Why so complicated?

If you want a safe way to shutdown use

Code: Select all

sudo halt
then when all the LEDS are off wait a few seconds and then turn off the power.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

rtek1000
Posts: 24
Joined: Wed Mar 12, 2014 9:21 pm

Re: Safe shutdown - Simple way

Thu Mar 27, 2014 6:28 am

I would like to do a layout with super capacitors only to safely shut down the Raspberry.
For the case of missing local electricity network.

But I noticed in video that you need to use large size and high value capacitors:
https://www.youtube.com/watch?v=sNnNGzdZzjw

Maybe if use a regulator, the charge of the super capacitors can be better utilized.
like this: http://www.dx.com/p/usb-dc-3v-to-5v-vol ... red-146765

I tested the minimum operating voltage of the Raspberry Pi model B: is about 4.05V. I login with Putty to test.

Thanks.

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Thu Mar 27, 2014 8:56 am

MrEngman wrote:Simple? Why so complicated?

If you want a safe way to shutdown use

Code: Select all

sudo halt
then when all the LEDS are off wait a few seconds and then turn off the power.


MrEngman
I think, our thread-opener means:
"A safe shutdown of a PI without connected keyboard + mouse and without using SSH, Putty, Telnet? Simply pull the plug and no filesystem or what ever should be destroyed."

@rtek1000: The regulator you've linked seems to be a very nice part!
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

MrEngman
Posts: 3836
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Safe shutdown - Simple way

Thu Mar 27, 2014 10:03 am

FM81 wrote:
MrEngman wrote:Simple? Why so complicated?

If you want a safe way to shutdown use

Code: Select all

sudo halt
then when all the LEDS are off wait a few seconds and then turn off the power.


MrEngman
I think, our thread-opener means:
"A safe shutdown of a PI without connected keyboard + mouse and without using SSH, Putty, Telnet? Simply pull the plug and no filesystem or what ever should be destroyed."

@rtek1000: The regulator you've linked seems to be a very nice part!
In that case, like if I loose connectivity to my Pi, I look for the ACT light to stop flashing and then pull the power plug from the PSU, not from the Pi end of the power cable. I do this very occasionally if SSH stops working and have not yet had a problem.

Yesterday I was experimenting with some wifi code and had to do this several times. Currently using the same SD card without problems. In fact I've never ever had a problem caused by powering off like this unlike some.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Thu Mar 27, 2014 10:10 am

[quote="rtek1000"]I would like to do a layout with super capacitors only to safely shut down the Raspberry.
For the case of missing local electricity network.

But I noticed in video that you need to use large size and high value capacitors:
https://www.youtube.com/watch?v=sNnNGzdZzjw

Maybe if use a regulator, the charge of the super capacitors can be better utilized.
like this: http://www.dx.com/p/usb-dc-3v-to-5v-vol ... red-146765

I tested the minimum operating voltage of the Raspberry Pi model B: is about 4.05V. I login with Putty to test.

Thanks.[/quote]


I buy this one: http://www.ebay.es/itm/181354720854?ssP ... 1439.l2649

It's not necessary a really big capacitor only for safe shutdown.... for 15/20 sec. a super cap of 10/25F 5.4v. (test in progress..) I think will be enough.

The only problem with this circuit (if it's works... :-) is ... if come back the electricity after the shutdown process but before the super cap has complete de discharge, the raspberry will remain power off.
Could be interesting find a way, in this case, to short p6 pins to reset and 'wake up' the device.

...and for this reason, you can't use a really large capacitor.... because when power off raspberry consume more or less 100mA... and abig capacitor can provide energy for up to 8/20 min.

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Safe shutdown - Simple way

Thu Mar 27, 2014 11:48 am

MrEngman wrote:In that case, like if I loose connectivity to my Pi, I look for the ACT light to stop flashing and then pull the power plug from the PSU, not from the Pi end of the power cable. I do this very occasionally if SSH stops working and have not yet had a problem.

Yesterday I was experimenting with some wifi code and had to do this several times. Currently using the same SD card without problems. In fact I've never ever had a problem caused by powering off like this unlike some.


MrEngman
Then you are in luck! As far as I know, "hard power off" for unix-like-systems isn't safe ...
(May be, for one it is safe enough, but for a second not?)

MfG, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

surfparadise
Posts: 95
Joined: Fri May 10, 2013 9:01 am

Re: Safe shutdown - Simple way

Thu Apr 24, 2014 12:46 pm

surfparadise wrote:
I buy this one: http://www.ebay.es/itm/181354720854?ssP ... 1439.l2649

It's not necessary a really big capacitor only for safe shutdown.... for 15/20 sec. a super cap of 10/25F 5.4v. (test in progress..) I think will be enough.

The only problem with this circuit (if it's works... :-) is ... if come back the electricity after the shutdown process but before the super cap has complete de discharge, the raspberry will remain power off.
Could be interesting find a way, in this case, to short p6 pins to reset and 'wake up' the device.

...and for this reason, you can't use a really large capacitor.... because when power off raspberry consume more or less 100mA... and abig capacitor can provide energy for up to 8/20 min.

I have modified the circuit to avoid the problem of reset P6 pin in case the raspberry shutdown (but it is not electrically OFF) and the current come back, so the PI can restart the o.s.

Could you check it please?… I'm not sure that it can works.

https://www.dropbox.com/s/xszhg5dvf04it ... ircuit.jpg

The GPIO 14 should be completely OFF when after raspberry shutdown. The attiny85 send a signal to P6 pin (to short it to GND) when MAIN power is ON and GPIO14 is OFF.

Please ignore imput 2… is not necessary.

Could it works?

Return to “Automation, sensing and robotics”