3corey2
Posts: 85
Joined: Sun Feb 15, 2015 2:59 am

do i need an on/off switch between PI and battery

Mon Feb 16, 2015 3:46 pm

Do i need a on off switch or can i just unplug my battery,charge it, and plug it back in? Im hoping i wont damage it if i dont use a on off switch. :| idk. This is for a portable ras pi, where the battery is electrical taped on and i have planed on just unplugging it to charge it.
ras pi 2, gotta love it.

User avatar
B.Goode
Posts: 8051
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: do i need one?

Mon Feb 16, 2015 5:34 pm

Provided you do not exceed the safe working voltage for an RPi (5v +/- 5%) you will not damage the hardware of the RPi board itself.

But not shutting down the Operating System cleanly (via sudo shutdown -h now, or sudo halt , or a related command) prior to removing power from the board - even if that is due to the battery becoming exhausted - may leave your SD (or microSD) card corrupted and under those circumstances it may not reboot again when power is restored.

There are MANY previous posts on this topic discussing the likelihood or otherwise of this mode of failure - I suggest you research them if you are really concerned. The only 'safe' way to proceed is to have some sort of monitor on the power supply that programatically shuts down the Operating System before the power fails. There are commercially available options to implement this.

You may decide you are prepared to 'chance it'.

Your choice.

3corey2
Posts: 85
Joined: Sun Feb 15, 2015 2:59 am

Re: do i need one?

Mon Feb 16, 2015 5:38 pm

i like your advice thank you, -just a noob-
ras pi 2, gotta love it.

gordon77
Posts: 4078
Joined: Sun Aug 05, 2012 3:12 pm

Re: do i need an on/off switch between PI and battery

Tue Feb 17, 2015 4:23 pm

"The only 'safe' way to proceed is to have some sort of monitor on the power supply that programatically shuts down the Operating System before the power fails"

I'm considering battery power and was thinking about simply monitoring the battery volts, with a simple resistor divider, into a GPIO input so when the monitored volatge drops below the threshold on the input (<2.5v ?) it will be detected by the program (python etc) and do a shutdown.

Will this work with LiPo / NImH batteries, does the voltage decay gradually ?

Gordon77

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: do i need an on/off switch between PI and battery

Tue Feb 17, 2015 4:29 pm

gordon77 wrote:I'm considering battery power and was thinking about simply monitoring the battery volts, with a simple resistor divider, into a GPIO input so when the monitored volatge drops below the threshold on the input (<2.5v ?) it will be detected by the program (python etc) and do a shutdown.
at 2.5V the raspberry is far (far..) from working.
Raspi input is not tolerant, as B.Goode said you have to feed something within 5% from 5V (i thought even less)
Said that (that, i think, is the really big part of the problem), you should sense battery voltage with an ADC. A simple PCF8574 board is near 3$. I guess 8bit precision is good enough for this :) You'll have to manage voltage in the 5V range and signals in the 3,3V range, of course.

gordon77
Posts: 4078
Joined: Sun Aug 05, 2012 3:12 pm

Re: do i need an on/off switch between PI and battery

Tue Feb 17, 2015 4:31 pm

I meant 2.5v on the resistor potential divider into the monitoring GPIO not the supply !,

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: do i need an on/off switch between PI and battery

Tue Feb 17, 2015 4:36 pm

gordon77 wrote:I meant 2.5v on the resistor potential divider into the monitoring GPIO not the supply !,
Yes, but you can't trust that in any way.
These are gpio specs:
The input gate detects whether the input voltage level is low or high by comparing it to a threshold voltage. Normally the voltage threshold is about 1.8V, but it isn't guaranteed; it can be anywhere between the maximum input low and minimum input high, that is, between about 0.8 and 2.0V.
More than that, with a voltage divider you are wasting power for nothing (we are in a battery environment) and if you use big resistors to limit current, you take in the game noise :)
So much easier to get an ADC in the circuit..

keilmillerjr
Posts: 3
Joined: Fri Feb 20, 2015 7:43 pm

Re: do i need an on/off switch between PI and battery

Tue Feb 24, 2015 2:56 pm

I ordered the Mausberry Shutdown circuit and the UPS Pico. Hopefully I can make the two work together nicely. The idea is that I use the shutdown circuit to turn my console on and off, and the ups is there in case some one accidentally unplugs the unit without shutting down (or power loss due to storm), it will safely shut down the unit. Too bad I couldn't find a solution that has both solutions in one.

3corey2
Posts: 85
Joined: Sun Feb 15, 2015 2:59 am

Re: do i need an on/off switch between PI and battery

Tue Feb 24, 2015 3:07 pm

then... is there a way that when i tell my pi to shutdown with "sudo shutdown -h now" make it cut off power totally by it self?
ras pi 2, gotta love it.

Cybergei
Posts: 5
Joined: Fri Mar 20, 2015 5:23 pm

Re: do i need an on/off switch between PI and battery

Fri Mar 20, 2015 5:48 pm

I am creating a project which will require users to be able to power on and off their Pi not using a terminal as my project is locked. I have implemented the ATX Raspi to do this. I love it. It connects to two signal pins and accepts power for the board while also protecting it. I am not associated with them in any way, but the have provided me with the perfect on/off solution.

User avatar
electronicsguy
Posts: 156
Joined: Wed Jan 21, 2015 11:20 pm
Contact: Website

Re: do i need an on/off switch between PI and battery

Fri Mar 20, 2015 6:41 pm

3corey2 wrote:Do i need a on off switch or can i just unplug my battery,charge it, and plug it back in? Im hoping i wont damage it if i dont use a on off switch. :| idk. This is for a portable ras pi, where the battery is electrical taped on and i have planed on just unplugging it to charge it.
Documented my experience here: https://electronicsguy.wordpress.com/20 ... it-backup/ :shock:

Unless you use a USB drive for the root partition and all your data, simply plugging out and in the power is a bad idea. The sd-cards seem to be very susceptible to power, at the logical and physical level. Not that simply plugging off when using a USB drive is a good idea - its just that the drives are more resilient and won't physically get damaged like the sd cards.
blog: https://electronicsguy.wordpress.com
github: https://github.com/electronicsguy

paulv
Posts: 558
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: do i need an on/off switch between PI and battery

Sun Mar 22, 2015 2:56 am

The following post addresses two of the items that are mentioned here, on-off "switch" and battery power as an UPS. Have a look to see if this helps: http://www.raspberrypi.org/forums/viewt ... 08#p714308

Return to “Other projects”