I'm planning to build a switch that turns off the power supply to my Raspberry Pi when an integrated circuit (ATtiny 85) output pin is low. The power supply (Adafruit PowerBoost 1000C) goes off when the EN pin is connected directly to the ground. I've been trying to use an NPN transistor inverter circuit to do this, but I haven't had much luck. I can use the transistor (without inverter) to turn the power off when its base goes high (connecting the EN to collector and ground to emitter), and I can use the transistor inverter to turn on/off an LED when base goes low/high, but the inverter circuit actually turns power on when base is low, power off with base high (like the transistor circuit WITHOUT an inverter). It may be that there's an internal pull-up resistor in the PowerBoost that's somehow interfering.

I'd like to be able to connect the ground to EN when my IC output is low so I can save batteries and put the ATtiny in sleep mode. The Pi will be off far more than it will be on.

How can I get this to work? I tried a PNP transistor but seemed to have the same problem. I'd prefer not to use a relay because I don't have a low enough voltage one. I've got lots of semiconductors, though.

  • \$\begingroup\$ Do you have a source of power that isn't going to go away when the power supply is turned off? \$\endgroup\$
    – The Photon
    Jun 20, 2015 at 3:18
  • \$\begingroup\$ Yeah I'm using a CR2032 \$\endgroup\$ Jun 20, 2015 at 3:34
  • \$\begingroup\$ I'm having a hard time visualizing what you are trying to do. Please use the built-in schematic editor to add a block diagram to your question. \$\endgroup\$ Jun 20, 2015 at 4:01
  • 2
    \$\begingroup\$ Is it just me, or does it seem like one could just connect the EN pin directly to the output on the ATiny? The pin going low is just the controller pulling the pin to ground with a transistor, isn't that exactly what you want? \$\endgroup\$
    – Rob M
    Jun 20, 2015 at 5:15

1 Answer 1


If i understand the question, you could do it like this.


simulate this circuit – Schematic created using CircuitLab

Although this seems somewhat redundant to me, as this is essentially how the ATiny works internally. A more elegant solution would seem to be connecting them together directly, like in the following diagram. The use of a discrete transistor is sometimes required, but only if it needs to sink more than the capacity of the controller, and it looks like it's only overpowering a pull-up resistor, piece of cake.


simulate this circuit

Note that this will only work if the 2 circuits are at the same ground potential, which can usually be achieved by connecting the grounds directly together.

You should also take into consideration that the 2 circuits may be running on different logic voltages, so to avoid problems there you should be setting the pin on the ATiny to a hi-z state (in arduino, "input" mode) to avoid mucking with the other circuit.

  • 1
    \$\begingroup\$ Note, the two need to share a ground for this to work. \$\endgroup\$
    – Passerby
    Jun 20, 2015 at 5:32
  • \$\begingroup\$ @Passerby Excelent point. \$\endgroup\$
    – Rob M
    Jun 20, 2015 at 5:44
  • \$\begingroup\$ Thanks! I'm not sure if they share a ground... Does that mean they need to use the same battery, or can they both be connected to the same ground for both batteries? \$\endgroup\$ Jun 20, 2015 at 6:30
  • \$\begingroup\$ @VictorVanHee They don't need to be powered from the same battery, just connect a wire from the negative terminal on one battery to the negative terminal on the other, and you're good to go. \$\endgroup\$
    – Rob M
    Jun 20, 2015 at 6:34
  • \$\begingroup\$ Excellent. I think I was making it too hard. I'll try this out tomorrow! \$\endgroup\$ Jun 20, 2015 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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