# Need help calculating resistor values for IR LED Driver

I'm wiring an IR LED driver for an Arduino project I'm prototyping.

The Arduino will be run at 5V, and I'm planning on using it's 5V output to drive the transistor that runs the LED

The circuit I've found uses an NPN transistor with the gate controlled by a digital output from the Arduino. The digram has me wire the 5 volt supply through a current-limiting resistor, the IR LED, and into the collector of the transistor. I'll call that resistor R1

The emitter is wired directly to ground.

The base of the transistor is wired to the output from the Arduino through another resistor. I'll call this resistor R2.

The LED I'm using is one I bought from Radio Shack. The package says it's maximum current is 200mA, and the supply voltage is 1.2 volts.

A quick calculation with Ohms law tells me I should use a 50 ohm resistor to limit the current to 100 mA. (r = v/I, 5/.1 = 25).

I have no idea how to figure out the value for r2, the resistor from the Arduino output pin to the base of the transistor. If you look at the circuit below, it calls for R1 = 10 ohms, and r2 = 47 ohms. I don't know how those values were derived, or the rating of the components those values are intended for.

That circuit calls for a 4.5 volt supply to both the Arduino and to the transistor. I'm using an Arduino Mega, and it calls for 7-12 volts input if you're feeding Vin, or 5 volts regulated from a USB port. It has a regulated 5 volt output with enough current to drive my transistor and LED.

Can somebody help me figure out the values for R1 and R2? I'm using a scrounged-from-my-parts-drawer NPN switching transistor in a TO-92 package, either a 2222A or a C1740.

The LED resistor is calculated as $$R_{LED}=\frac{V_{IN}-V_{F}}{I_F}$$

Which is, for a 200mA load: $$\frac{5-1.2}{0.2} = 19\Omega$$

Pick the next highest common (E24) resistor, which would be 20Ω.

For a 100mA load the calculation would be:

$$\frac{5-1.2}{0.1} = 38\Omega$$

39Ω is the next highest E24 resistor, so that would do nicely.

You should also check the power handling requirements of the resistor. Power can be calculated as $$P=I^2R$$

Which for your 100mA load would be: $$0.1^2×39 = 0.01×39 = 0.39W$$ So you should be using a half watt resistor, not the more common quarter watt resistors. Alternatively, you can use multiple higher value quarter watt resistors in parallel to both achieve the small 39Ω resistance and the increased power handling.

The base resistor is there to limit the amount of current drawn through the IO pin. The exact value in this situation is fairly unimportant. Common values to use vary between 470Ω and 1KΩ - whatever you have in that region to hand really. As the LED is using such low current you're not going to be needing to calculate the transistor's current gain or anything fancy like that.

• Cool, thanks. That's exactly what I was looking for. So that 47 in the diagram should probably be 470 then, eh? I have both 470 and 1k resistors. BTW, in your calculation, if the desired max current is 100 mA, wouldn't that be (5-1.2)/.1 (100 mA is a tenth of an amp, not .02 amps? (I was looking at the wrong package. The IrLED is rated at 100mA max.) – Duncan C Jun 27 '14 at 18:28
• That is correct, except I changed the 5 to 4.5 to reflect your battery power source. Since the question has been edited, I will modify the calculation again. The base resistor could be either 470 or 1K, it should make no difference. 470Ω would allow more current leeway though, so I'd pick that. – Majenko Jun 27 '14 at 18:31
• Again thanks. I'm going to be feeding the Arduino from 9 volts, and using it's regulated 5 volts as the supply for the transistor, so use 5V, not 4.5 for the calculations. I get (5-1.2)/.1, or 38 ohms. Sadly I don't have much in the way of very low resistance resistors. Gonna have to scrounge some to find a low value resistor above 38 ohms. – Duncan C Jun 27 '14 at 18:34
• Ok, I'll modify again for 5V then ;) – Majenko Jun 27 '14 at 18:35
• Don't forget you can place two (or more) resistors in parallel to make one smaller value resistor. – Majenko Jun 27 '14 at 18:37