2N2222 Transistor with LEDs

Hi,

I’m a newbie to electronics design. Can someone please help me with the following.

I am trying to control 5 LEDS in parallel using a single Arduino pin (please see attached pic). I calculated the LED resistance as follows: (assuming 3.3V forward voltage and 20mA forward current, for ultra bright LED)

R1 = ((3.7 – 3.3V) / 20mA) = 20ohm

I know the resistor R2 on the emitter leg of the 2N2222 is required, but I am not totally sure if I calculated it correctly:

R2 = ((5 – 3.3 – 0.7V) / 20mA) = 50ohm

Please steer me in the right direction if I am totally wrong. I am after a setup that is reliable and will last a very long time.

Any help is greatly appreciated.

arduino2.png

The R2 is not required. The total current via the transistor will be 5x20mA=100mA.
You need to connect a resistor into the base - between the arduino output and the base of the transistor.
The value of 1000ohm would be ok..

You need to connect a resistor into the base - between the arduino output and the base of the transistor.The value of 1000ohm would be ok..

How did you determine 1kohm?

The proper way is following:
You must know the "hfe" parameter (the gain for that type of wiring) of the 2N2222 at Ice=100mA, my estimation is hfe=100.

Then Ibe = Ice/hfe = 1mA (this is the required base current which opens the transistor fully - it "saturates" him)

Rbase = (5V-0.7V)/1mA= 4.3kohm (here we assume there is no resistor in the emmiter R2=0, emmiter is connected to GND).
where 5V is max output voltage of the arduino pin, and 0.7V is "base-emmiter" voltage, typically 0.7V for any bipolar Si stuff..

I've suggested 1kohm to saturate the transistor fully even when the hfe will be lower than assumed :slight_smile:

How did you determine 1kohm?

Because it is not very critical so long as you have enough to saturate the transistor and not too much to damage the arduino.

To calculate it take the total LED current (collector current) that has to be less than the base current times the minimum gain of the transistor. Then you double the base current just for luck. Or you use a 1K.

Thanks guys for your help... :slight_smile:

http://forum.arduino.cc/index.php?PHPSESSID=ojkosvqsv5f3s78vlubp4l5ls4&topic=160532.0