Electronic – Confused by transistor behaviour

transistors

Noob question coming up…

I have connected a digital output pin on my Arduino board to the base of an NPN transistor (BD135). There is a 9v battery connected between the collector and emitter, along with a resistor and LED.
The Arduino simply switches pin 6 on for a few seconds (sending 5v) then off for a few seconds and repeats. I have noticed that when using a lK Ohm resistor that even if the 9v battery is not attached that the LED will still light up (though not quite so bright). I thought that the transistor was a switch and I don't understand why power is getting from the base to the LED; I'd be most grateful if someone could explain what is happening!

If I swap the 1k resistor for a 47k resistor then the LED only lights when the 9v battery is attached.

[EDIT] I've noticed that if I put the LED and resistor on the collector side that it only lights when connected to the 9v battery (even using the 1k resistor on the base side)… is this how transistors should be used?

enter image description here

Best Answer

What you are seeing makes sense. Within nothing connected to the collector, the transistor acts like a diode from B to E. Current flows out the digital ouput, thru the 1 kΩ resistor, thru the transistor from B to E, thru the 470 Ω resistor, thru the LED, and back to the digital board. The LED is dimly lit because it effectively has 1.47 kΩ and the B-E voltage drop in series with it and a 5V supply. That probably results in around 1.5 mA LED current, which is visible but dim.

When 9V is applied to the collector, then the transistor can amplify. The collector current will be the base current times its gain. Let's say the LED drops 2 V and the B-E junction 700 mV. That leaves 2.3 V accross the 470 Ω (use designators already!) resistor for about 5 mA LED current. If the transistor has a gain of 50, then 1 part of this comes from the base and 50 parts of this come from the collector. The base current is then only about 96 µA, which causes only 96 mV drop accross the base resistor.

There is no need for the base resistor in your setup with the LED and its resistor in the emitter leg. Just get rid of it and tie the digital output directly to the base.