Transistor with different voltage in colector and base

ledmotortransistors

I have a small LED of 5mm and an arduino powered by 9V. When I connect the LED to Vin (9V) using a 330 ohm resistor the LED brights very high. When I connect the LED to 5V (from arduino) using a 330 ohm resistor the LED brights very low.

Ok, that's supposed to happen.

Now I use a transistor 2n222 to power the LED. The problem is that if I use 5V or 9V (Vin) to power the LED it gets the same brightness. In the base I am using a digital pin sending HIGH.

Why does the transistor does not allow my LED to get brighter when the collector is connected to 9V source power?

Best Answer

Why does the transistor does not allow my LED to get brighter when the collector is connected to 9V source power?

That's your problem - the collector is connected to the power source - you are using it as an emitter follower - the brightness will be totally governed by the base voltage from the arduino. Try operating it as common emitter with a 4k7 base resistor: -

enter image description here

R1 = 330R or possibly a bit less to produce desired current thru LED

R2 - try 4k7