So, I'm a software guy, and this is a bit out of my element. I'm working with a Raspberry Pi, and I want to power one of an LED button, a push button with a pair of integrated green LEDs wired in parallel with 1K resistors each.

For max brightness, the LEDs should be supplied with 5V. However, since I'm using a Pi, the GPIO pins output at 3.3V levels. So, I wanted to use a 2N2222 to switch the 5V rail on the Pi. Because I don't want to risk damaging the Pi (since nothing is more dangerous than a software engineer with a soldering iron), I've instead connected a test PSU with a 5V rail and a 3.3V rail to opposite sides of a breadboard.

So, my circuit arrangement for testing is as follows:

5V connected to leftmost pin on 2N2222 (collector).

3.3V connected to the center pin (base), in series with a 1K resistor. I have a loose jumper connected here as well that I am using as a switch by plugging/unplugging one end.

LEDs connected to the emitter (rightmost) pin, running to ground.

When I connect the base line to the 3.3V rail, the LEDs light, but very dimly. Connecting this wire to the 5V rail lights the LEDs fully. Interestingly, touching the LED to my jumper to my finger lights it somewhere in between the two. Now I'm really confused.

I suspected it was because I did my calculations for the base resistor wrong, so I tried a few other values, including 220, 330, and 2K. None of them made any (noticable) difference in brightness, as far as I can tell.

What is going on here? How do I get this to work as intended?

Note each GPIO pin has a max current draw of 16 mA, but I'd like to keep that below 8mA really. Not sure if that information is relevant here.

I don't have a multimeter available to me for the next few days, so I can't easily test to see what's going on.


From your description, you have the transistor connected as an emitter follower, like so:


simulate this circuit – Schematic created using CircuitLab

With an emitter follower the emitter vol;tage is always about 0.7 V below the base voltage, so you can't get more than 2.6 volts across the LED.

You should instead put the LED between the collector and positive supply, and ground the emitter. This way, when the transistor is saturated it will only have about 0.2 V across it, so you get almost the full supply voltage for the LED.

Preferred circuit:


simulate this circuit

(resistor values are default values from the schematic editor - ignore them)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.