PN2222A LED Circuit

M

Masonchen

Newly Enlightened
Joined
Apr 8, 2021
Messages
11
I'm going to add an IR LED to my Arduino Uno and I'm attempting to understand the math involved in determining the exact resistor values required to drive the LED using a PN2222A transistor.

I'm aware that my LED has a voltage drop of 1.35V, that I intend to run it at 100mA, and that I'll be powering it with 5V from the Arduino. What I don't understand is how to calculate the exact voltage drop of a transistor between its collector and emitter. I'm also trying to figure out the arithmetic used to compute the milliamps that must travel through the transistor's base in order to fully turn it on (but not waste extra electricity).

I'm aware that there is a lot of leeways in which resistors may be used and the circuit will still work, but I'm hoping to figure out the math so that I can go as near to utilizing the exact correct resistor values as feasible.
 
A

Alexander47

Newly Enlightened
Joined
Mar 21, 2022
Messages
6
Location
Germany
The collector emitter voltage drop depends on the collector current and the base current.
For 100mA you are looking at around 0,1V and a base current of 10mA.
Look in the datasheet for the "Collector-Emitter Saturation Voltage vs Collector Current" figure.

Depending on your configuration you will need two resistors, one to limit the base current, one to limit the LED current.

I would suggest using a mosfet like a BS170 since mosfets are voltage controlled and not current controlled.
 
D

Dave_H

Enlightened
Joined
Nov 3, 2009
Messages
703
Location
Ottawa Ont. Canada
In the 2222 datasheet, look at Vce(sat) collector-emitter saturation voltage. Closest condition to your case:

Vce(sat) = 0.3v max. at Ic=150mA, Ib=15mA (your load is lower, 100mA).

Using 5v supply, LED limiting resistor is:

Rc = (5 - 1.35 - 0.3)/0.100 = 33.5 ohms (use 33 or 33.2 ohms).

As LED is being pulsed, duty cycle will not be 100%, so load resistor can power can be derated.

At 50%:
Pd = 0.5 * 0.1^2 * 33 = 0.165W (use 1/4W or higher).

Or to be safe, assume 100%, use 1/2W resistor.

For base resistor, need to know how much current Arduino can drive at what voltage. You probably don't need to drive at 15mA as above; say 10mA. Let's say 5v output can output 10mA at 4v (it will be lower than supply), and use 0.7v for 2222's base-emitter voltage:

Rb = (4 - 0.7)/0.010 = 330 ohms

Pd = 0.010^2 * 330 = 0.033W (assumes 100% on, can use 1/16W or greater).

If Arduino output can drive less, may need to adjust this value, or it may be close enough.

Dave
 
Last edited:
caelyx

caelyx

Newly Enlightened
CPF Supporter
Joined
May 29, 2013
Messages
114
I would suggest using a mosfet like a BS170 since mosfets are voltage controlled and not current controlled.

I’d echo the suggestion to use a MOSFET for this - I find really simplifies the design, as you can pretty much treat it as a switch in an otherwise-standard power->resistor->LED circuit.

For calculating LED resistor values without having to remember any formulas, Adafruit has a useful “Playground” app with lots of simple circuit calculators in it (op amps, 555 timers, resistor dividers,etc), available from the smartphone app stores.
 
D

Dave_H

Enlightened
Joined
Nov 3, 2009
Messages
703
Location
Ottawa Ont. Canada
Yes, a small MOSFET can do the job if driven properly, and essentially eliminates dc drive current.
You just need to watch the threshold voltage on some of these devices. BS170 can be as high as 3v,
so in a 3.3v system could be borderline i.e. MOSFET may not get driven fully on.

For 5v driver, since there will be no dc drive current (except tiny leakage), should work OK.
LED series resistor might be a bit higher due to lower drop due to MOSFET drain-source "on"
resistance; difference probably not enough to be concerned. 1.5 ohms on-resistance is a guess
based on datasheet/conditions.

Vds(on) = 0.100 * 1.5 = 0.15v approx.

Small MOSFETs with lower on-resistance are available.

Dave
 
Last edited:
DIWdiver

DIWdiver

Flashlight Enthusiast
Joined
Jan 27, 2010
Messages
2,717
Location
Connecticut, USA
The '2222 is perfectly satisfactory for this application. A '3904, well, maybe if you're not picky.

With 5V supply and Vf of only 1.35V, the Vcesat of an appropriate BJT (including the '2222) is almost insignificant. Whether it's 0.1V or 0.2V hardly affects the LED current. Make an educated guess and the uncertainty in Vf is probably bigger than the uncertainty in Vcesat.

Yes, an FET with low on resistance can remove a bit of uncertainty in the LED current, but so what? If you are aiming for 100 mA and you get 95 or 105 instead, it should be no big deal. If it is, you need to seriously re-think your design, because the LED probably isn't that predictable.
 

Similar threads

H
Replies
5
Views
3K
harmfulcow
H
D
Replies
7
Views
4K
Watashi
W
R
Replies
10
Views
3K
DIWdiver
DIWdiver
D
Replies
5
Views
2K
Conte
Conte
D
Replies
5
Views
6K
snakebite
snakebite
Top