[Solved]Why is my transistor switch powering the LED even though Arduino is ....

Hi All,

I wanted to control a DC motor with a transistor. So i followed the circuit from this popular website (adafruit).

Since my DC motor will consume more Amps than the Arduino can provide I have added an external power supply (6 V, 4 x 1.5 batteries) as mentioned in many websites. One example is this

I have also taken care to connect the Gnd of external power supply to that of my Arduino.

Now when my Arduino is powered on (through USB) the circuit is working correctly. To test the circuit instead of a motor I have attached an LED. So the LED is turned on for 5 sec and then turned off for 10 sec (as expected).

But I noticed something strange when I removed the power supply to my Arduino (from USB). The LED is now continously powered on!! I have only removed the USB from my PC and rest of the wiring is still in place. But I was not expecting the LED to be continously on. This is a picture of my setup (2 attachments).

Can someone please help me whats going on here? Is there some problem in my Arduino?

Thanks and Regards,

Additional Note:

I dont know if this information would help. I had to remove the flyback Diode because unless I removed it my circuit would not work (with Arduino powered on).

I suspect either a wiring error or a defective transistor. If you had to remove the diode, it was probably backwards or defective.

As an aside, it is always a bad idea to power a motor from the Arduino, despite the fact that Adafruit publishes such nonsense.

If you are powering down your Arduino, the transistor’s base might become undefined.
Consider using a pull down resistor at the common point of base and 220 Ohm resisior.
10 K will do fine, other side to GND.
That way the base will be at a fixed level of if not controlled by the controller.

The photo’s aren’t great.
i can’t see details of what’s connected where at your transistor.
Are you sure you wired the transistor correctly (i didn’t bother checking that).

If you are powering down your Arduino, the transistor's base might become undefined.
Consider using a pull down resistor at the common point of base and 220 Ohm resisior.
10 K will do fine, other side to GND.
That way the base will be at a fixed level of not controlled by the controller.

Interesting points here about the worth of such a pull-down.

Thanks Jremington, MAS3 and JimboZA for your answers!

I will check with a second pair of diode and transistor to check if the existing ones are faulty. And thanks for advising to add a pull down resistor. I am new to electronics so had no clue about this aspect. And the discussion on pull down resistor by JimboZA is really helpful.

Will update after trying out the changes.


Thanks everyone, my problem has been solved!

Before posting my question here I had done a lot of trial and error and was not able to identify the issue. After reading through the answers of Jremington, MAS3 and JimboZA my first reaction was to simply buy a 5V relay board or a DC motor controller board. But this forced me to learn about relays and motor controllers in detail. Further I learnt that even a 5 V relay may need more than 40mA to switch on, which an Arduino GPIO cant provide which means I will again have to use a transistor to switch it on.

This forced me to learn a lot of new things! So I learnt how to identify a faulty diode and identify the Base, Collector, and Emitter of a transistor with a multimeter.

I checked and rechecked each component, its polarity, and finally nailed the issue down to this:

My Arduino Gnd which has a clear label GND was used up as I was connected to an external USB board for power and I had to use a GND from the ICSP headers. I had made a mistake in identifying the correct GND (which did not have a label) from the product documentation. Today I was trying this out from 6:30 am and finally found the fault, when I changed the pins and my LED finally lit up!! :smiley:

Instead of Gnd, I had hooked up the +5 V power supply. And then I had messed up with rest of the wiring by changing polarity of wires, and diode and god knows what! :smiling_imp:

Two odd observations should have helped me to identify that something was wrong:

  • I had to remove the diode to make the LED to work, this was abnormal

  • My program was to light up the LED for 5 sec and turn off LED for 10 sec, but in reality the LED was lighting for 10 sec and turned off for 5 sec

All in all this has been a learning experience for me and I am really thankful to the experts here who have given kind advice. Really happy to close this year with a solution!

Wishing you all a very happy new year!!


  1. diode wrong way round or blown
  2. Because a transistor in common emitter circuit is inverting - input high, output low...

What probably happened in the first instance was you damaged the transistor by not
having the diode connected, then it leaked through its damaged collector-base junction.

When driving an inductive load like motor/servo/relay/solenoid you must always
have protection circuitry to prevent inductive voltage spike (such as free-wheel
diode or snubber network) or you will simply fry the circuit.