## Calculating Values for PN2222A LED Circuit

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
chulian
User
Posts: 5
Joined: Mon 2017-04-17 8:06

### Calculating Values for PN2222A LED Circuit

I'm gonna be adding an IR LED to my Arduino Uno and I'm trying to wrap my head around the math used to figure out the exact resistor values needed to use a PN2222A(https://www.kynix.com/components/PN2222 ... tures.html) transistor to drive the LED.

I know my LED has a voltage drop of 1.35V and I want to run it at 100mA and that I'll be supplying it with 5V from the Arduino. What I don't understand is the math for how to figure out the exact voltage drop of the transistor between the collector and emitter. And I'm also trying to figure out the math used to calculate the required milliamps that have to flow through the base of the transistor in order to fully turn it on (but not waste extra electricity).

I know that there is quite a lot of leeway in which resistors to use and the circuit will still work, but I'm hoping to figure out the math so that I can get as close as possible to using the exactly perfect resistor values.
Hannu
Senior User
Posts: 361
Joined: Mon 2016-05-30 11:54

### Re: Calculating Values for PN2222A LED Circuit

Hi!

I drew small schematics for you. As all components are in series, voltage must be 5V over all of them. And all current uses nicely one route. led_resistor.png (40.84 KiB) Viewed 181 times
The transistor Q1 and LED1 have fixed voltage drop leaving R1 to tunable. Now we want 100 mA to go from 5V to GND and selecting R1 value so that the voltage over it is 5V - (LED1 + Q1) when 100mA flows through it.

The value of R2 I set to 1k, so the base current is 5 mA if control signal is 5V. Your transistor has current amplification of 35-40. This would be able to drive 150 mA. Decreasing value of R2 could give faster response if that is needed and your and your MCU can provide enough current.