# ESP8266 2N2222 npn Transistors problems

Hello I'm working on a ESP8266 project using common anode RGB LED's with 100ohms resistors. The problem I'm having is that being that the Esp8266 is on 3.3v the leds are not bright enough. I do have 5v incoming voltage to the ESP8266 with a ams1117 3.3v LDO. So i was wondering if i use a 2N2222 npn transistor's on the RGB led would it be enough?

What i mean is i been searching for the base of the transistor to see if 3.3v max on the esp8266 would fully open the transistor to the max brightness. So i searched online and getting mix confusion on the voltage of the base at it's max what is needed. Can someone please help me out on that.

Joseph

Bipolar transistors are more sensitive to current flowing into the base that the voltage. The BE junction will max out at ~0.7V. You put a series resistor between the base and the pin of the microcontroller to determine the base current.

The hfe of a 2N2222 is ~100 at 150mA collector current. This means you'd want something like 150/100 or 1.5mA into the base to turn it on "hard enough" to flow that collector current.

For switching apps a few mA of current is enough to saturate the transistor. To get, say, 3mA into the base, take your pin output voltage of 3.3 and subtract the base-emitter voltage of 0.7 to get ~2.6V. Take this and divide it by the desired base current of 3mA to get 866-ohm. Choose a standard value close to that (820 or 910 ohms, for example) for the series resistor between the processor pin and the base.

Blackfin:
The hfe of a 2N2222 is ~100 at 150mA collector current…

The Hfe of a transistor is irrelevant for switching.
For switching (low dropout voltage), you need 5-10% of the collector current into the base.

A 2k2 (~1mA) base resistor is enough for driving ~20mA LEDs.
Could use a smaller <=100mA signal transistor for that current (2N3904, BC547 etc.)
Leo…

"...common anode RGB LED's with 100ohms resistors..."

My assumption here is that the OP is flowing more than 20mA.

The hfe current-gain figure gives a baseline base current required for the desired collector current. I usually design in a margin for hfe variance between devices even if they're operating in saturation.

To each his own.

josephchrzempiec:
So i was wondering if i use a 2N2222 npn transistor's on the RGB led would it be enough?

Yeah it would be enough. Connect the base of 2N2222 with your Microcontroller and Collector Emitter will be used for power up LED at 5V. You can even try 12V LED for more brightness. Circuit will remain the same. It's a simple circuit, make a search for 2N2222 as a switch and you will get the results.

Common anode 5mm RGB LEDs have a Vf of ~2.4volt (red) to ~3.3volt (blue).
That works out to (5volt (supply) - 2.4volt (LED) - ~0.2volt (transistor)) / 100ohm = ~24mA for red.
There is about (3.3 - 0.7) = 2.6volt left for the CL resistor (assuming no I/O loss).
1k-2k2 would fully saturate the transistor.

If you work with Hfe (100), then you would use 1% base current (~10k resistor).
That would drop ~1volt across CE, and drop LED current somewhat.

Both will work in this case (1k-2k2 or 10k).

The danger is not enough base current for loads >100mA.
Then CE dropout could overheat/fail the transistor.
Leo..

I wasn't totally sure about all this being from 5v to the 3.3v in the base. Or the resistors. I do have both 1k and 10k resistors. So i tried everything out and i couldn't get it work. it look like i Actually i had something wrong and it wasn't working the emitter and collector was back words. Corrected that now as well. The brightness looks just the same as before without the 3.3v input pin part.

Thank you all for the help

josephchrzempiec:
I wasn’t totally sure about all this being from 5v to the 3.3v in the base. Or the resistors. I do have both 1k and 10k resistors. So i tried everything out and i couldn’t get it work. it look like i Actually i had something wrong and it wasn’t working the emitter and collector was back words. Corrected that now as well. The brightness looks just the same as before without the 3.3v input pin part.

Thank you all for the help

Can you show a circuit drawing? Photo, hand-drawn etc?

Mind that an ESP8266 pin can not supply more than about 10 mA. So that’d be at least a 250Ω resistor on the base, and you’re limited to about 100-200 mA for the current through your LEDs). For better current, use a MOSFET (beware to choose a type that can actually switch properly at 3.3V).