# IR LEDs

I was wanting to use some IR leds in a project but wasn’t sure what resistor I needed.
The led’s voltage is 1.3-1.6V, and the current is 20mA. I know you can use the V=IR formula but I don’t know the current of the arduino 5v pin and I don’t know the voltage and current of the arduino digital pins.
Any help would be greatly appreciated.

An Arduino I/O pin can provide 20mA and the absolute max is 40mA. But you cannot draw 20mA from all the pins at the same time. The detailed limits are in the Atmel datasheet.

For the purpose of V=IR it is the current in the LED that you need to work with. And I think the V you need to use is (5v - 1.6v). After I select a resistor I always check the current with a multimeter.

...R

but I don't know the current of the arduino 5v pin

You don't need to.

1) You decide what current you want to run the LED at. 2) Work out what voltage you need to have across the LED's resistor. 3) Work out what value resistor you need to have this voltage with the LED current flowing through it.

For the sake of simplicity assume the Arduino's output is 5V and you won't be far off.

5volt from the Arduino pin - 1.3volt from the LED = 3.7volt across the resistor. 3.7volt across the resistor / 0.02A LED current = 185ohm. 185ohm - Arduino's internal pin resistance of ~25ohm = 160ohm. I would push it a bit more and use 150ohm, since you probably are going to use it for IR remote control. If you have two IR LEDs, put them in series for a slightly bigger range. Re-calculate the resistor accordingly. Leo..

alan15: I was wanting to use some IR leds in a project but wasn't sure what resistor I needed. The led's voltage is 1.3-1.6V, and the current is 20mA. I know you can use the V=IR formula but I don't know the current of the arduino 5v pin and I don't know the voltage and current of the arduino digital pins. Any help would be greatly appreciated.

Depending on the IR led type you have, you can safely drive them at ludicrous currents for short (tens of microseconds) pulses.

For example, the Vishay TSAL6400 940 nm IR LED can be pulsed at 1.5 AMPERE for 100 microseconds max.

To do this, you cannot use an Arduino pin directly. You will need a suitable transistor (NPN BJT) to switch the current of the LED, and drive the base at 10 to 20 milliamps through a suitable resistor.

I built several IR remote controls that run on 3 AAA cells (approx 5.4 volts) using an ATTiny 85, a KSD1616A NPN transistor (chosen for it's very low Vce(sat) rating of 0.15 volts) and a Vishay TSAL6400 IR LED.

The ATTiny drives the BJT base through a 220 ohm resistor, the LED is connected to the collector and powered from Vcc through a 3.3 ohm (yes 3.3!) resistor and of course the emitter is grounded.

Those high current spikes will require GOOD power bypassing. I use a few 0.1 uF ceramics near the CPU and a 1000 uF aluminum monster across the rails. Otherwise, the first pulse will crash and reset the AVR.

The measured LED current closely matches what I designed for... a shade over 1 ampere (I get 1.1 amps with fresh AAA cells).

Of course, the LED survives because it's pulsed on and off at 40 kHz and the bursts are short duration and VERY short duty cycle.

If the LED were just turned on, it would hiss, smoke and the plastic would make a scary "snap" sound as the magic smoke escaped.

If you are building an IR remote, you will get zilch for range at 20 milliamps. Research high power IR emitters, read the datasheets and do a few Ohm's law calcs if you REALLY want it to work.

Krupski: I built several IR remote controls that run on 3 AAA cells (approx 5.4 volts)

Wow! Those are some AAA cells! :astonished: