0
\$\begingroup\$

So I'm making a battery-powered Raspberry Pi project, and it would be ideal if it could cut off power to the Raspberry Pi after the Raspberry Pi shuts down. It would also be ideal if the power for the whole system was controlled via a single on/off button. The events I'm looking to respond to are like so:

  • Short press of power button:
    • Closes circuit if circuit is open (powers on the Pi)
    • If the Pi is already on, it boops one of the GPIO pins on the Pi (I'll configure the Pi to listen for this and prompt the user to shut down the system safely)
  • Long press of power button:
    • Opens circuit if circuit is closed (forced shut down of the Pi)
  • A GPIO pin on the Pi goes high or low (I'll configure the Pi to do this on halt):
    • Opens circuit if circuit is closed

The power supplied will be 5V, and I doubt current drawn by the Pi and its peripherals will be much more than 2-3A. My knowledge of active circuit components is very limited, but is there any one component that can do what I'm shooting for?

\$\endgroup\$
  • \$\begingroup\$ Can you handle small gull-wing SMT IC packages? Is cost or parts availability an objection here? \$\endgroup\$ – ThreePhaseEel Aug 16 at 3:18
  • \$\begingroup\$ I'd probably use a cheap PIC10F20x or PIC10F32x device. Two for a US dollar or less, easy to program, and you can make them do exactly what you want here. It's not difficult programming. (You can get a hardware programmer for them for just a few more dollars -- not at all expensive -- and MPLAB X is free to use as the IDE and includes a built-in assembler and debugger at no cost or fuss, automatically with the download.) Since you are a likely also a programmer (you program the Raspberry, I gather, it isn't a lot of work. And it uses a standard, non-boutique device that will never go away. \$\endgroup\$ – jonk Aug 16 at 18:18
3
\$\begingroup\$

If you don't mind small packages and having to order through a major distributor...

If you can work with a small (TSOT-23-8 with a 0.65mm pitch) SMT package (or use a suitable breakout board such as a Capital 33608 or Proto-Advantage PA0089), and don't mind spending a few bucks on this, then I would use a LTC2954-2, a logic-level PFET, and a handful of passives (resistors and capacitors) to get this job done; it's going to be the lowest-component-count and easiest-to-get-right solution to this problem while providing a reliable GPIO interface to the Pi. A minimal application circuit is shown below, where M1 can be any logic level (i.e. with its Rds(on) specified at -5V Vgs) P-channel MOSFET capable of handling >3A. (The FDC640P is in a SMD package about the same size as the LTC2954-2; if you want a through-hole part instead, an Alpha & Omega AOI21357 is a suitable substitute.)

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ So to see if I understand correctly, V1 is the 5V power supply, 5V0 is the resulting controlled power source, and SW1 is the button that controls the whole thing? Where do 3V3, !INT and !KILL lead? (Sorry - I'm still a novice electronics enthusiast. :P) \$\endgroup\$ – nonoitall Aug 18 at 5:23
  • \$\begingroup\$ @nonoitall you are correct on V1, 5V0, and SW1. 3V3, !INT, and !KILL run off to the Pi :) \$\endgroup\$ – ThreePhaseEel Aug 18 at 5:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.