User avatar
Gomez
Posts: 40
Joined: Mon Dec 15, 2014 3:42 am
Location: Porto, Portugal

power question on RPi GPIO

Sat Dec 27, 2014 9:58 pm

Hello sirs, I have another question related specifically to the GPIO...

I want to power up my RPi trough a battery wired into the gpio providing it 5V but I also want to be able to power up the raspberry pi trough usb if the battery is dead per example or if I don't need it to be portable anymore.

I have a switch that disables the battery so it doesn't provide power and I can plug in a micro usb, my question is .. since the gpio wires won't be removable and they usually provide power, if they don't and the power comes from the micro usb as usual, will the GPIO switch to output and feed 5V into my battery ? I don't think that happens but for security reasons I am asking here, and if it does, can I fix this by adding a diode to the 5V wire that comes of the battery ? The 5V/GND wires in the gpio won't be removable..

Thanks :)

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: power question on RPi GPIO

Sat Dec 27, 2014 10:18 pm

Gomez wrote:Hello sirs, I have another question related specifically to the GPIO...
I want to power up my RPi trough a battery wired into the gpio providing it 5V but I also want to be able to power up the raspberry pi trough usb if the battery is dead per example or if I don't need it to be portable anymore.
I have a switch that disables the battery so it doesn't provide power and I can plug in a micro usb, my question is .. since the gpio wires won't be removable and they usually provide power, if they don't and the power comes from the micro usb as usual, will the GPIO switch to output and feed 5V into my battery ? I don't think that happens but for security reasons I am asking here, and if it does, can I fix this by adding a diode to the 5V wire that comes of the battery ? The 5V/GND wires in the gpio won't be removable..
Thanks :)
The GPIO header pins marked 5V are directly connected to the Pi's 5V rail (not a GPIO "pin" on the SoC, which work at 3.3V) so no "switching" will occur, but, yes the 5V provided via the micro-USB connector will "appear" on those pins, so a blocking diode, with very low forward voltage drop, is advisable, unless you can ensure that the battery is switched out of circuit when using the "normal" connector (eg. by using a double-pole, change over switch to control both power sources). Out of curiosity - what sort of "battery" are you considering?
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Gomez
Posts: 40
Joined: Mon Dec 15, 2014 3:42 am
Location: Porto, Portugal

Re: power question on RPi GPIO

Sat Dec 27, 2014 10:38 pm

FTrevorGowen wrote: The GPIO header pins marked 5V are directly connected to the Pi's 5V rail (not a GPIO "pin" on the SoC, which work at 3.3V) so no "switching" will occur, but, yes the 5V provided via the micro-USB connector will "appear" on those pins, so a blocking diode, with very low forward voltage drop, is advisable, unless you can ensure that the battery is switched out of circuit when using the "normal" connector (eg. by using a double-pole, change over switch to control both power sources). Out of curiosity - what sort of "battery" are you considering?
Trev.
I am wondering between this batteries:

12V 3000mAh http://www.ebay.com/itm/161460019982 (this one has a switch in it but seems to be bigger than whats handy for this project)

9.6V NiMH 2800 mAh http://www.ebay.com/itm/301105735843 (this is the one I personally like the most but not sure about overcharge/discharge protection)

7.4V LiPo 2200mAh http://www.ebay.com/itm/301248269365


Its a project, a portable raspberry pi retropie.
I ordered of ebay, 10 days ago, my RPi and other 11 items excluding the battery that I didn't order yet .. but since I am still waiting for the packages, I started designing the 3D models that will probably need some adjustments after I know the exact dimensions of the display, I think its 5 inches but not sure..

As mentioned, I don't know which battery I will use out of these three, it has to be more than 5V since it will also have to power the display, I have a LM2596S to regulate to 5V for the gpio pins on the PI, in the final design there will be no opening for the gpio so that's why the wires wont be removable, but I'l look into the diodes option..

edit:
for the power when its not with the battery, I am considering using a edited wall adapter power supply of 12v, the main cable will go straight to power the display, then I will get another cable with power out of the main one, regulate it to 5V and then have it to go to a micro usb cable that will plug in the RPi ..

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: power question on RPi GPIO

Sat Dec 27, 2014 10:55 pm

The regulator should (according to the datasheet) survive when you have no battery and power the RPi from its micro USB. Its main output would have reversed biased base emitter NPN transistor and its feedback input can tolerate Vs +25V, so it should be OK

One thing to note is that the RPi has power supply protection circuit on its micro USB input, your battery supply would bypass this protection.
>)))'><'(((<

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: power question on RPi GPIO

Sat Dec 27, 2014 10:57 pm

Gomez wrote:
FTrevorGowen wrote: The GPIO header pins marked 5V are directly connected to the Pi's 5V rail (not a GPIO "pin" on the SoC, which work at 3.3V) so no "switching" will occur, but, yes the 5V provided via the micro-USB connector will "appear" on those pins, so a blocking diode, with very low forward voltage drop, is advisable, unless you can ensure that the battery is switched out of circuit when using the "normal" connector (eg. by using a double-pole, change over switch to control both power sources). Out of curiosity - what sort of "battery" are you considering?
Trev.
I am wondering between this batteries:
12V 3000mAh http://www.ebay.com/itm/161460019982 (this one has a switch in it but seems to be bigger than whats handy for this project)
9.6V NiMH 2800 mAh http://www.ebay.com/itm/301105735843 (this is the one I personally like the most)
7.4V LiPo 2200mAh http://www.ebay.com/itm/301248269365
...
As mentioned, I don't know which battery I will use out of these three, it has to be more than 5V since it will also have to power the display, I have a LM2596S to regulate to 5V for the gpio pins on the PI, in the final design there will be no opening for the gpio so that's why the wires wont be removable, but I'l look into the diodes option..
...
Rather than build your own LM2596S-based system it may be simpler (and cheaper?) to use/adapt a pre-built car charger ie. something like this:
http://www.cpmspectrepi.webspace.virgin ... DC_PSU.27s
('though that's not the best example, but others have been suggested in previous threads w.r.t. similar applications)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Gomez
Posts: 40
Joined: Mon Dec 15, 2014 3:42 am
Location: Porto, Portugal

Re: power question on RPi GPIO

Sat Dec 27, 2014 11:07 pm

FTrevorGowen wrote: Rather than build your own LM2596S-based system it may be simpler (and cheaper?) to use/adapt a pre-built car charger ie. something like this:
http://www.cpmspectrepi.webspace.virgin ... DC_PSU.27s
('though that's not the best example, but others have been suggested in previous threads w.r.t. similar applications)
Trev.
That's smart, I actually didn't remember that, it regulates to a maximum of 1A but that's more than enough for my project right?
It only has 10 tactile buttons in the gpio and uses the trrs output and nothing else..

Thanks :)
aTao wrote:The regulator should (according to the datasheet) survive when you have no battery and power the RPi from its micro USB. Its main output would have reversed biased base emitter NPN transistor and its feedback input can tolerate Vs +25V, so it should be OK

One thing to note is that the RPi has power supply protection circuit on its micro USB input, your battery supply would bypass this protection.
I will still look into diodes after the regulation, il set it to 5.7V so it compensates the diodes voltage drop .

since I am feeding it only 5V, bypassing the powersupply protection circuit shouldn't be a problem right?

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: power question on RPi GPIO

Sun Dec 28, 2014 1:42 am

Gomez wrote:
I will still look into diodes after the regulation, il set it to 5.7V so it compensates the diodes voltage drop .

since I am feeding it only 5V, bypassing the powersupply protection circuit shouldn't be a problem right?
Easy way to compensate for the diode is put another between the regulator 0V and the true 0V,(battery and RPi) not exactly right since the extra diode will only conduct the current used by the regulator.

If the regulator breaks then you will not benefit from the protection.

The car adapter looks a bit borderline to me, at 0.5A load it looks to be right on the limit, any more and it cant cope.
>)))'><'(((<

User avatar
Gomez
Posts: 40
Joined: Mon Dec 15, 2014 3:42 am
Location: Porto, Portugal

Re: power question on RPi GPIO

Sun Dec 28, 2014 2:07 am

aTao wrote: Easy way to compensate for the diode is put another between the regulator 0V and the true 0V,(battery and RPi) not exactly right since the extra diode will only conduct the current used by the regulator.

If the regulator breaks then you will not benefit from the protection.

The car adapter looks a bit borderline to me, at 0.5A load it looks to be right on the limit, any more and it cant cope.
Hmm, I will look into it but I might as well use the LM2596S because I already ordered it. I can only hope it doens't fail because it should even be able to operate at more voltage and current than I am actually using it for, at least according to the datasheet..

I got a cheap one out of ebay so I hope it will be good enough, the description says that the input voltage: 3.2V ~ 46V and the output voltage: 1.25V ~ 35V at a maximum of 3A of current .. I want it to input 12v, output 5.7v~~5v at less than a amp so I shouldn't have any problems .. I hope :'(

Return to “Beginners”