0
\$\begingroup\$

enter image description hereI am trying to switch power to a Pi Zero using an NPN transistor (2N2222) as a switch, as in the following diagram.

schematic

simulate this circuit – Schematic created using CircuitLab

The Ib is around 5mA and the pi zero draws about 120 mA during bootup and settles down to about 80mA steady state. So, when I send a Hi through the arduino digital pin, the Pi starts booting - and all goes fine. However, the moment the boot up process is complete and the current draw from collector falls, the transistor switches off. Have confirmed the same by increasing the steady state power draw of the Pi by attaching it to a HDMI display - and some USB peripherals - and the pi remains up - no problem.

I am a beginner to using BJTs - and gather I am doing something stupid to land up in this problem. Any help in helping me understand what I am doing wrong will be of huge help.

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. Any conclusions reached should be edited back into the question and/or any answer(s). \$\endgroup\$ – Dave Tweed Oct 11 at 18:04
  • \$\begingroup\$ "However, the moment the boot up process is complete and the current draw from collector falls, the transistor switches off" - Please go into more detail. Do you mean that the Pi stops working? Do you mean that you have measured the voltage at P1 and it jumps up to 5 volts? What, exactly, do you mean? Give us as much detail as possible. \$\endgroup\$ – WhatRoughBeast Nov 13 at 19:08
  • \$\begingroup\$ The pi was actually going into a brownout. I was able to get a friend of mine come over and help and he was able to point out the issue: The wires were actually causing a potential drop - so, when the Pi drew more current, the potential difference across the Pi was going down leading to brownout. I was made to remove all unnecessary long wires and then create a darlington pair (to ensure that the current supplied was not limited) and the Pi stopped going into brownouts. \$\endgroup\$ – Arijit Nov 14 at 11:51
0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

Above is just one of many ways to "skin this cat". It has the features of; -- ground referred control input -- switched power rail output so that you are not putting a switch in the ground connection.

\$\endgroup\$
  • \$\begingroup\$ do you believe switching the ground connection is the cause of the instability in the circuit? \$\endgroup\$ – Arijit Oct 11 at 4:34
  • \$\begingroup\$ Switching the "ground" or "return" connection is OK for "dumb" loads like relay coils, incandescent lamps, LEDs, heaters. I never switch the ground connection of a complex device since you are raising the the ground reference potential of that device. Since it is likely that the device (RPi in this case, is communicating with other peripherals using ground s a reference, you are potentially interfering with that. I will spare you the many "war" stories of fixing other people problems in spacecraft integration activities. \$\endgroup\$ – xstack Oct 12 at 1:02
  • 1
    \$\begingroup\$ While what you say makes sense, I don't see how this explains what the OP is experiencing. \$\endgroup\$ – HandyHowie Oct 14 at 8:13
  • 1
    \$\begingroup\$ Thanks Handy Howie. I am trying to be a bit subtle, and suggesting that the design is "begging for trouble", and to basically scrap it. \$\endgroup\$ – xstack Oct 14 at 15:45
  • \$\begingroup\$ @xstack I tried using a PNP transistor to move the switching to the power side of the circuit. Since, I was using an Arduino (or nodemcu) to control the level at the base, I could pull it down to ground to switch on the PNP transistor. However, the problem that I reported remains. While what you say of moving the switching to the power side of the circuit is logical, that does not seem to be the root cause of this problem. \$\endgroup\$ – Arijit Oct 20 at 3:05
0
\$\begingroup\$

For an NPN transistor to be in saturation, there needs to be a positive base-emitter voltage as well as a positive collector-emitter voltage. Looks like once your PI finishes booting up, it fails to properly forward bias the collector-emitter junction on your transistor. Try adding a high-value resistor between your collector and 5V supply, like so:

schematic

simulate this circuit – Schematic created using CircuitLab

I do strongly recommend delivering power to your PI with a high side switch, however. If you use the circuit as shown, you may blow things up if, for instance, you attach the PI to a monitor via. HDMI and connect your Arduino to a grounded laptop.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. With the help of a friend, I was able to figure out that in order to keep the circuit more understandable and clean I was using far too long wires and the Potential Drop because of those wires was causing the Pi to brownout. With a darlington pair ensuring no dearth of current and reducing the wire lengths (by eliminating use of wires - and making the BJTs stand on crooked legs at the right breadboard rows), the Pi now has started booting up and staying boot up. \$\endgroup\$ – Arijit Nov 14 at 11:56
  • \$\begingroup\$ You'd get even less drop if you used a mosfet. I still highly recommend using a PMOS as a high side switch, both so you don't have a difference in ground potential between your PI and Arduino, and so that you dissipate less power in your switch. You can use one of your 2N222's to drive the gate. Glad to hear you figured it out though! Always good to learn from these real-world kinds of issues. \$\endgroup\$ – Ocanath Nov 15 at 15:13
  • \$\begingroup\$ Thank you for your valuable suggestions and input. I intend to use your and Xstack's suggestion to switch on the high side. \$\endgroup\$ – Arijit 2 days ago

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.