1

Ok Team I need to know if this circuit will work or if there is a better way.

Use Case: I have a piece of machinery that is controlled via a Raspberry pi zero W. It just controls a relay board to control the machine, pretty simple. The machine is moved around a lot and likely unplugged and plugged into power regularly. I need to be able to keep the pi running for short periods while the machine is moved and then shut it down and disconnect from power when not in use. I want this to happen automatically as user education will be a futile effort.

Proposed Solution: To prevent powering the pi down and up all the time I have including a LiPo battery as backup. I use a charge/boost controller that passes power through to the pi and charges the LiPo when it is connected to power then switches to battery power when there is no power (this unit).

I have a voltage divider that is connected to a GPIO pin and a script that monitors the pin. When the pin goes low the script will set a timer to shutdown the pi if the pin does not go high again within a set time (say 5 minutes).

So far this all works. But. The while the Pi is shutdown it still draws like 20mA and it will discharge my LiPo if not used for an extended time. From what I have read this will damage the battery.

So... I have I have set a GPIO pin to default LOW using the /boot/config.txt which is set very early in the boot process and unset as the pi does it's warning flashes to shut down. What I need to do is switch something using that pin to isolate the pi from the battery power. Following this question I am proposing to isolate the pi using two transistors.

enter image description here

Will this work? Will I invoke the powers of the magic blue smoke? Any other ideas. I am a rookie so assume no knowledge. Thank you, truly appreciate the generosity the this community.

  • Can you confirm a point?: You indicate that the PiZ draws 20 mA in shutdown mode, and that level of current drain is unacceptable for battery life. The balance of your question then seems to focus on a design to remove (battery) power from the PiZ. Have I got that right? – Seamus May 17 at 4:03
  • Hi @Seamus. Yes my question is focused on isolating the PiZ from the battery power once shutdown, thus not discharging the battery (beyond it's own discharge) The machine could go an extended period not being used and I only have a small LiPo so eventually it would completely discharge the battery which I understand is not good long term? – Phil Klitscher May 17 at 6:05
  • I think you should not connect the Pi's 5V input to the PSU, only to Q2. Otherwise,Q2 links the 5V input to the 5V output of the charge controller, which will probably cause a malfunction there (because it always thinks the PSU is active). However, that would probably stop your Pi from booting once the PSU is plugged in... – PMF May 17 at 6:07
  • Hi @PMF, Damn I missed that in the drawing. How you mention is how it is currently hooked up to detect the PSU power. Perhaps a second set of transistors triggered by the PSU? The charge controller will always have power present given it has power or battery supply. – Phil Klitscher May 17 at 6:12
  • OK - remove power from the PiZ as soon as shutdown has finished. Another point that's not quite clear is your statement that "Also it won't power up again when the power is connected (which I could fix with a simple push button)" ... If you remove power from PiZ, and then restore it, the PiZ should reboot without a pushbutton. Are you seeing something different? – Seamus May 17 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.