# How to drive led with transistor?

I'm trying to make a very simple circuit to switch an led using a transistor. My supply voltage is 16v, my control signal is 3.3v from an esp8266 GPIO, and my transistor is a 2222a NPN.

My led has a Vf of 3-3.2v and If of 20 mA. So I've worked out the led resistor value to be
(16 - 3) / 0.02 = 650 ohms
I then worked out the base resistor for the transistor to be
Ib = 5(0.02 / 100) = 0.001
Rb = (3.3 - 0.7) / 0.001 = 2600 ohms
I've tried base resistors from 500 ohms all the way to 13k and none get my led to full brightness. I am now very confused. This seems so simple.

Now when I go to hook it all up and measure the voltage across the led with my multimeter, it is 1.9 V, visibly dimmer that it should be. I know my led is OK because I measured the voltage of that same bulb with a direct connection, no transistor, and the voltage was 3.1 V and bright.

Here is my circuit diagram:

• Measure the current through the LED. Or measure voltage over the resistor, to know the current. Basically you have all the correct connections. Aug 6 '20 at 17:05
• Measure V_CE also. That may be what is leading to low current. You didn't seem to have accounted for it in the resistance calculation. See the led driving part from this answer
– AJN
Aug 6 '20 at 17:07
• Make sure the ground of your 16V supply is common with the ground on your esp8266 supply. Aug 6 '20 at 17:15
• There's nothing wrong with your circuit. Something is wrong with the implementation. Can you show us a photo? Maybe your 1K is actually a lot higher, or your GPIO is only outputting the pullup resistor. Aug 6 '20 at 17:37
• Well... I have found the issue. My microcontroller is for some reason only outputting 0.8v on the GPIO pin. When I use the 3.3V rail directly everything falls into place. Led is bright, measuring 18 mA and Vce of 0.01. Thanks everyone for the help, I was really driving myself mad.🤦 Aug 6 '20 at 18:36