IR Sender Circuit Question

Hi all!

I made an IR sender circuit with an Arduino and it works fine, but I have some questions about the components. I followed Adafruit's tutorial.

Some questions:

  • What exactly is R1 doing? I would assume it is limiting current so the IR LED doesn't blow.

  • Can I change out R1 for a lower value? I would assume that would be needed to be done if, say I had the input as 3V instead of 5V.

  • Can the transistor be changed to a different NPN transistor? Is there any specific specs needed?

  • I have a IR LED with a Vf of 1.4V and max current of 100mA. What, if anything, would need to be changed in this circuit?

Thanks in advance!

R1 limits the Arduino pin 3 output current to a safe level.

5V out —— 470R—— base—>|—emitter —— GND

5v - .7Vbe = Vrb = 4.3V

Ib(rb)= 4.3Vrb / 470R ≈ 9mA

If you reduce Rb to 220R then 4.3Vrb / 220R ≈ 19mA

A 5v UNO can safely supply 20mA so a 220R would work.


If the IR LED can have 100mA maximum, a series resistor will be needed to limit the transistor collector current to 100mA.


You can use a different NPN BJT or N channel MOSFET transistor. At these low levels of current most BJTs and Logic level N channel MOSFETs should work.

There is a lot of info out there on transistor switches

Example worth a read

The Base-Emitter junction acts like a diode. The junction will draw enough current to bring the Base voltage down to the forward voltage drop of the diode, about 0.6V. That will draw too much current from the Arduino pin so a current limiting resistor is used to protect the Arduino pin. It's like driving an LED where the resistor protects the Arduino and the LED from excessive current.

Yes, as long as you don't try to pull more than 40 mA (better: 20 mA) from the Arduino pin. Basically the same calculation as for an LED. Divide the voltage by the current. For a 3.3V Arduino the voltage across the resistor is about 2.7 (3.3-0.6). Divide by 0.020A to get 135 Ohms. Pick the next higher resistor you have handy.

The 'Beta' or "current gain" is the multiplier from Base current (about 20 mA) to Collector current. For example, if your load draws 2A you need a Beta of 100 or more.

So you need a transistor with a Beta over 5 (100mA/20mA). Are you using 5V or 3.3V for Vcc? Take that voltage, subtract the 1.4V forward voltage drop, and divide by 0.1A (100 mA) to calculate the series resistor that will get you 100 mA through the LED. Use the next higher resistor.

Thank you @LarryD, @hammy and @johnwasser!

I’m planning on using an Atmega328 powered by two AA batteries, hence the 3V.

Thanks everyone for answering all my questions in detail :grinning:

Note: If you run the ATmega328P on less than 3.78V you shouldn't be running it at 16 MHz. See the "Safe Operating Area" in the datasheet. 2.7V will get you 10 MHz, 4.5V will get you 20 MHz so 3V will max out at 11.33 MHz.

R = V/i

R = 3V - 1.4V / 100mA
R = 1.6V / 100mA
R = 16Ω

Is that correct? Or is that 160Ω?

Would an Attiny84 with its internal 8Mhz clock be ok?

Also would a 2n3904 be fine? It has a max of 60V 200mA, and a min Hfe of 100.

R = (3V - 1.4V) / 0.1A
R = 1.6V / 0.1A
R = 16Ω

The 2n3904 is good for 200 mA so should be fine.

The same formula is used for LEDs also, right? I just want to make sure of everything before I order PCBs.

Screen Shot 2022-01-09 at 8.24.40 PM

Is this correct? (It is for an RGB LED and the second voltage on top of the current is the Vf for each color)

Are your LEDs designed for 20 mA? Many are 10 mA and are plenty bright at 5 mA. You should probably try an assortment of values until the LED is bright enough.

I don't know what to do about the 3V Green LED running on a 3V supply.