I am trying to understand why connecting, say, an Arduino digital pin 4 to a 2N4401 pin 2 as well as 5V PSU to 2N4401 pin 1 and Arduino VCC to 2N4401 pin 3, won't keep power.

When shorting pin 1 and pin 3 on the 2N4401 the MCU is powered on and in-software pin 4 is set to pinMode OUTPUT and HIGHwhich should allow the 2N4401 to let power flow to the MCU for as long as power is available even when the short circuit between 2N4401 pin 1 and 3 is cut.

Instead what happens when the short between pin 1 and 3 is cut, the MCU is turned off instantly.

It's as if the transistor isn't reacting to the pin 4 MCU signal at all.

Could anyone explain why this is happening?

I'm sure I lack a lot of knowledge here and I want to know how I could utilize a 2N4401 to make a SW shutdown system.

Why 2N4401? Why not a MOSFET? MOSFET's circuits that do SW shutdown are available, but no transistor base SW shutdown circuits are to be found anywhere, and the 2N4401 is all that I have right now.


enter image description here

void setup(){
  pinMode(4, OUTPUT);

void loop(){
  digitalWrite(4, HIGH);


  digitalWrite(4, LOW);
  • 1
    Can you draw your schematic and show your code? Dec 26, 2016 at 11:30
  • Yes, I updated the question.
    – vaid
    Dec 26, 2016 at 12:38
  • Ok, but that Fritzing thing is not a real schematic! However, in you code, there is a problem in the loop function - you probably need another delay after the digitalWrite(4, LOW) otherwise it will immediately write HIGH again on the next loop - so you won't really see the effect of the LOW as it will be too short. A proper schematic is necessary to see which way you have the transistor connected. Dec 26, 2016 at 12:41
  • Yeah sorry, I thought I'd show you the visual physical representation of what I'm working with. But wait, the HIGH tells the transistor to allow electricity to flow to the board, right? So my question is why would a delay after LOWbe needed when LOWwould turn it off, which is what I want?
    – vaid
    Dec 26, 2016 at 12:44
  • 2
    The questions gets net three down votes. Only @Olin and Andy answers the question. I admire the patience of you both in teaching the future EE.
    – Umar
    Dec 26, 2016 at 15:04

2 Answers 2


This is what you appear to be wanting... A manually operated contact (S1 in your "diagram") momentarily shorts out the NPN transistor and applies power to the Arduino. In that short time the contact is active, you want a transistor to by pass this switch and keep applying power to the Arduino so that should the contact go open circuit, power remains on the Arduino.

The main problem, assuming my guess about what you want is correct, is the use of an NPN transistor as an emitter follower; whatever voltage you apply to the base will be about 0.7 volts lower on the emitter so, when the contact opens, the emitter voltage drops to about 4.3 volts to keep the NPN turned on but, that in turn leads to a drop in base voltage and quite rapidly you end up with nothing on the emitter.

You need a PNP transistor that can be turned on much more effectively with an NPN pulling the PNP base towards ground. In other words you need two transistors to do what you want: -

enter image description here

This one is shown at 5.5 volts on the power rail but 5 volts will be fine. It is also shown using a p-channel MOSFET instead of a PNP because the MOSFET will act as a much better "short" when activated.

Here's one that shows a PNP transistor - ignore the 12 volts - it will work on 5 volts: -

enter image description here

The "lamp" is where you connect the Arduino (aka PIC in the circuit). You will be better off with a p-channel FET though but, just in case you decide to use the PNP version you might need to lower R3 to maybe 470 ohms to provide enough base current to pass sufficient collector current to power the Arduino.

You also need to have S1 wired across the "pass" transistor - at the moment you have it connected back on itself and therefore does absolutely nothing. Note that this has been fixed in the question now!

  • when the contact opens, the emitter voltage drops to about 4.3 volts to keep the NPN turned on but, that in turn leads to a drop in base voltage and quite rapidly you end up with nothing on the emitter. that's what me and a friend discussed earlier today but we weren't too sure, thanks for confirming our suspicions.
    – vaid
    Dec 26, 2016 at 14:01
  • Answer accepted! Edit: You don't understand what this will do to the maker community, you will be considered the holy master of self-shutdown Arduinos.
    – vaid
    Dec 26, 2016 at 14:06

Your question is rather confusing, but some problems are evident just from looking at the schematic:

  1. The schematic is crap. I have no idea what you're trying to say with the dotted line between the - terminal of the the battery and the processor GND pin.

    The line going thru the middle of the transistor is apparently meant to be the connection to the base, but this is sloppy at best.

    It took me a while to realize you have the positive power connection at bottom and the ground at top. Don't do that.

    All these things make your schematic hard to read. Now that I've had to waste time deciphering the schematic, I'll be more brief once we get to talking about the circuit itself.

  2. You say the transistor is a 2N4401, which is NPN, but you show a PNP. Huh? Which is it?

  3. There is no base resistor. The E-B junction looks like a diode to the driving circuit. When the digital output tries to go low, it will be held one diode drop below power. That could damager the digital output or collapse the power supply.


You have edited the schematic to show a NPN, but now you have a chip trying to drive itself thru a emitter follower. The switch also does nothing at all since both its ends are already shorted together.

  • This isn't an answer, this is criticism, which is 100% fine by me, but leave in the comments. I'm not trying to say anything by the dotted line, I could not connect it in software. By the way, no one is forcing you to help me, whoever does take the time to help me and teach me something new will be appreciated, if respectful. It is an NPN transistor. The base resistor is something new to me that I'll have to read more about. This answer is not an answer, I will not accept as it does not answer my question "why does MCU not stay ON while pin 4 keeps NPN base high".
    – vaid
    Dec 26, 2016 at 13:42
  • @vaid: This is too long for a comment, and points 2 and 3 do actually address issues with your circuit. There are many ways to draw good schematics, including the schematic editor built into this site. "I could not connect it in the software" is no excuse at all. So use better software! And, respect is earned, which you haven't. In fact, complaining about people pointing out your disrespect only makes it worse.
    – Olin Lathrop
    Dec 26, 2016 at 13:47
  • Hey, I'm new to these things, alright? Not everyone is Nikola Tesla. I'm not complaining at all, you have a requirement? State it and I'll handle the rest. Want me to use the built in editor? Say it. I didn't even know there was one. Be a little bit more considerate. I'm fine with criticism, but keep it on a respectful level, that's all I'm asking for regarding communication. This is getting too off topic and I'm now going to ignore you because I'm here to have a dialog and learn, not a monolog insult.
    – vaid
    Dec 26, 2016 at 13:52
  • "you have a requirement? State it". No. We expect you to learn to communicate properly elsewhere. Drawing a schematic is something you are expected to already know how to do before coming here, unless you're explicitly asking about schematic drawing. "keep it on a respectful level". Again, respect is earned. You're not there yet.
    – Olin Lathrop
    Dec 26, 2016 at 13:56
  • Neither are you. But Andy aka is. Get rekt.
    – vaid
    Dec 26, 2016 at 14:03

Your Answer

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