nospamprl
Posts: 22
Joined: Fri Mar 04, 2016 3:33 am

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:14 pm

davidcoton wrote:
Tue Aug 18, 2020 11:09 pm
nospamprl wrote:
Tue Aug 18, 2020 11:00 pm
My understanding of electronics ends with Ohm's law, but wouldn't it be easier to feed GPIO 5 directly from GPIO 1 (3.3V) ?

I understand GPIO 1 will go down as soon as the power goes off triggering the shutdown process while power starts to be drawn from the battery pack, right?

In this design you could avoid the 2 resistors (which I asume are there to feed 3v to GPIO 5 and should be changed if a smaller power supply is used instead of a 12v).
No. 3V3 is derived on-board from the 5V input. It won't go low until the battery is exhausted. Once the 3V3 goes low, the Pi has ceased to function. It is far too late to think about shutting it down. emma1997's circuit derives a signal from the primary power input side, which goes low when the battery takes over, not when the battery is exhausted.
Thank you sounds very logical now.

BTW, I think the only reason to use a 12v power supply instead of the standard 5v is to exceed the battery suplied voltage and keep the Pi running from this source. Am I right?

drgeoff
Posts: 10831
Joined: Wed Jan 25, 2012 6:39 pm

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:17 pm

davidcoton wrote:
Tue Aug 18, 2020 11:09 pm
emma1997's circuit derives a signal from the primary power input side, which goes low when the battery takes over...
More accurately:

... which goes low when the 12 volt input disappears completely or drops substantially and the battery is expected to take over ..
Quis custodiet ipsos custodes?

pidd
Posts: 721
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:26 pm

It makes the switching cheap as only diodes are needed, the batteries will automatically take over if the 12V drops.

Plus it enables a simple trickle charge circuit (for non-lithium batteries).

Also generally losses are greater with higher current whether it is a battery or a piece of wire, using higher voltage for a given power draws less current and hence has less losses. You could drive everything from a 1.2V Nimh battery and a 2,5V supply with a boost converter but the losses would be horrendous.

nospamprl
Posts: 22
Joined: Fri Mar 04, 2016 3:33 am

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:31 pm

Why is the Pi rebooting again when power is restored (as stated in the initial post)?

When GPIO 5 triggers the shutdown, the Pi will turn off, but power (from the batteries) will still be there. What triggers the reboot if 5v are always there? The Pi is not detecting where the power is comming from.

pidd
Posts: 721
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:37 pm

nospamprl wrote:
Tue Aug 18, 2020 11:31 pm
Why is the Pi rebooting again when power is restored (as stated in the initial post)?

When GPIO 5 triggers the shutdown, the Pi will turn off, but power (from the batteries) will still be there. What triggers the reboot if 5v are always there? The Pi is not detecting where the power is comming from.
GPIO3 is connected to the divider off the 12V supply, the immediate diode will prevent the 5V going to the 12V supply.

nospamprl
Posts: 22
Joined: Fri Mar 04, 2016 3:33 am

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:41 pm

So you mean GPIO3 actualy turns on again the pi although its shutdown?

pidd
Posts: 721
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Poor Man's Pi Safe Backup Supply (UPS)

Tue Aug 18, 2020 11:45 pm

nospamprl wrote:
Tue Aug 18, 2020 11:41 pm
So you mean GPIO3 actualy turns on again the pi although its shutdown?
I just took it as read, the OP had no reason to mislead, however you can read up on it here https://www.raspberrypi.org/documentati ... es/gpio.md

emma1997
Posts: 868
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Poor Man's Pi Safe Backup Supply (UPS)

Thu Aug 20, 2020 7:14 pm

nospamprl wrote:
Tue Aug 18, 2020 11:31 pm
When GPIO 5 triggers the shutdown, the Pi will turn off, but power (from the batteries) will still be there. What triggers the reboot if 5v are always there?
Low on GPIO3 (not GPIO 5) shuts down if running and boots up if halted. It is the only pin capable of this.

There are a couple mechanisms responsible for supplying this low pulse to reboot: mechanical DC power switch/plug or applying 110vac to the main supply. In the first case it is contact bounce noise that does that. I suspect a 'perfect' DC switch might not reboot properly but never actually witnessed this.

The second case when applying AC to most 12v supplies there is an accidental but fortunate artifact of SMPS designs which result in multiple 'false starts' (see attached pic). Usually a result of crowbar circuits to suppress the major voltage overshoot on startup which simpler step-downs suffer from. These dips are what activate GPIO3 to reboot when AC is what is being switched.

The attached pocket scope snapshot shows this on the output of a typical 12v security camera wall-wart. It's probably that big slow dip couple hundred us after turn-on but before fully ramping up to 12v that does it for the Pi.

BTW I wish everybody would use proper terms and not conflate GPIO numbers with pin numbers. They are not the same thing and creates massive confusion for millions of users. In some ways even worse than that ridiculous Arduino 'pin' fiasco. I recall a local maker space group chasing their tails for almost a week because of this. Just a suggestion...
Attachments
safe_turn-on_scope.JPG
safe_turn-on_scope.JPG (81.35 KiB) Viewed 73 times

Return to “General discussion”