What is the best way to use the Zero LiPo with an off/off switch or button?


#1

What is the best way to use the Zero LiPo with an off/off switch or button?

I have repurposed a Kodak Brownie to host a Raspberry Pi Camera connected to a Zero W and my plan is to have a power on/off button or switch that:

  1. powers on the RPi when pressed on
  2. safely shuts down the RPi when pressed “off”
  3. turns the RPi back on again without re-connecting the LiPo when pressed “on” again after 1 and 2

I’m not sure if 1,2 & 3 can all be done easily with the Zero LiPo but I saw a thread mentioning that that G, V and EN pins can be used to do a “hard shutdown”, but a safe shutdown as per 2.

Similar threads but not quite the requirements I was wanting: On Off Shim with Zero Lipo Zero LiPo + Switch

Thanks in advance

Edit:

I have the Zero LiPo already and have soldered it onto my Zero W so wanted to try to find a solution with this board, but if there’s an easier alternative I could switch.


#2

On a 3B+ grounding GPIO 3, PIN 5 will make it boot up if it has a power supply plugged in. Or +5V on GPIO PIN 2 or 4. A config.txt edit can be made to have it do a proper safe shutdown when PIN 5 is grounded. Or any PIN you chose. dtoverlay=gpio-shutdown,gpio_pin=3 Just change the = to the PIN you want to use.
Now, as to the Zero LIPO, did you mean LIPO shim? Even after you do the safe shutdown, your likely going to have to shut it down or the battery will slowly discharge. A second switch wired to the enable pin, grounding it, should work.

I do a similar thing with a portable Pi setup and a Powerboost 1000c. Its an A+. I have a push button wired to a GPIO that initiates a safe shutdown when pressed via python code. Once I see the 10 blinks of the act LED I switch a second switch that grounds the enable pin on the powerboost 1000c, that turns it off. Only the battery charger is running to recharge my battery, if I have my power supply plugged in.


#3

Forgot to mention, cool reuse of the camera by the way. Makes me think about doing the same thing. I have a couple of similar cameras kicking around in the basement somewhere. Big thumbs up. =)


#4

Thanks for the feedback @alphanumeric - I’m starting to write-up the project here - https://github.com/alexellis/rodak/blob/master/README.md

What connections did you make for your Powerboost 1000c?


#5

The USB and ground for power in, Enable to turn off the upconverter, and the 5V out and ground. I have a couple of small rovers where I turn the upconverter (the boost part) off and just leave the battery charger running when not in use.
And a portable weather station where I do a similar thing. That also has a switch to run it off of the power supply instead of the powerboost. When its in the house and plugged into the power supply the powerboost is off and only charging the battery. The Pi and other electronics runs directly off of the power supply. Its a 5v 4A supply. Chassis mounted barrel jack for power in. Thats why I use the USB pin on the powerboost and not the micro USB port. When outside it runs off of the powerboost. The one switch changes the power in and enables the powerboost.


#6

My build pictures of my Pi projects are here, https://1drv.ms/f/s!AjOYwiwlwDtpgUMsp2qnevKpGEHb If you want to have a look see.


#7

I’ve done something similar with the adafruit powerboost, But you have to hold the power button on until the pi starts to boot. Shutdown is via software (just shut the pi down) AND you’ll need another circuit board in there as well, any cpu will do. R13 on the power boost needs to go - shouldn’t be there anyway.

I couldn’t figure out a strait PI option. Here’s an organic-cad mud map of what I did.

https://discourse-cdn-sjc1.com/business6/uploads/pimoroni/original/2X/4/4e1ce7446ab6a4becdeb684608c1ba5bae2a3f17.JPG


#8

I do believe R13 is there to pull the Enable Pin high so the powerboost turns on. And may also be used to turn it off when the battery runs down so you don’t damage the battery. Not 100% sure, its there for a reason though.


#9

On the Pi Zero there are two RUN solder pads. Over to one end of the GPIO. If you short those two pins together momentarily, the Pi will boot up if it has power. You don’t want to short those pins while its running though or it will do a hard reboot. I have a Pi 3B that I run Kodi on. I do the shutdown but don’t unplug the power supply. When I want to use it again I just press my run button to boot it back up.

Doing it all with the one button may be tricky, Especially if you want to completely shut down and turn off the powerboost to prevent draining your battery.


#10

Hi alphanumeric,

The way I look at it is r13 is ok if using a physical hard on/off switch for power options (contacts) - but for a software option it’s no good. It needs to be selectable whether it’s a pull up or down depending on application, physical switches are too limiting.

The P-boost Enable pin needs a high signal to enable the Power Boost output, If it’s already high via R13 - this sucks and takes away many easy options. Can be done but - meh, easier to remove the little bugger.

Also r13 - won’t affect the shut down of the power boost, Its only on the enable pin. shutdown is still via the low batt pin.

Cheers
Simon


#11

Ok, valid points for how your doing it. I’m just using a switch. Ground to turn it off, open circuit to let it turn on. And one push button momentary to tell Raspbian to shut down. I haven’t felt the need to automate it to just the one button.
I do believe the on off shim will do it, and kill power to the Pi. And I think that new Picade hat does something similar. Still doesn’t help if your using a Powerboost etc though. Leave that on and the battery is slowly going to drain.