# IR LED with transistor

I’m trying to design a IR remote controller. I tried to design IR LED driver. I designed this circuit for IR driver.

I used ESP8266 for first test for IR LED. I used though-hole version of MMBT2222A (2N2222A). I tried to design Ic current for one LED approximately 100 mA. And also I chose hfe=40 for Ib calculation and I calculated approximately 1 kΩ for base resistor. When I tried to measure with multimeter, I observed one of IR LEDs current flows about 50 mA and base current is approximately 3 mA. And LEDs voltage approximately 0.7 V. I thought BJT is not properly works on for my circuit. I tested of this circuit with 2 LED. It works about 13 meter distance (sends NEC code properly) but the voltage and current values did not come out as I calculated and also I couldn't use 5 LEDs at the same time (with 5 LEDs I used base resistors and without base resistor result is very closer).

Therefore I changed BJT to MOSFET for driving LED with voltage. And I tested this circuit IRLZ44N logic MOSFET. I tried to drive this circuit with directly 3.3 V high output. That time current flows over LED about 100 mA but when I tried with continuously NEC output signal. MOSFET not fully opened. I looked voltage with multimeter I saw 0.3 V at ESP8266 output signal. Thats the reason my guess I couldn't open MOSFET with this NEC Code. I'm open to your suggestions, thanks.

• Welcome! “0.3 V at ESP8266 output signal” Unless you are PWMing your ESP output, it’s broken. Jun 22 at 12:14
• For Ic=500mA and Hfe= 40 you need to put to base 12.5mA. So for 3v3 control signal you need to use a (3v3-0.7v)/12.5mA = 200 ohm resistor. Jun 22 at 12:20
• Why not run all LEDs in series? Jun 22 at 12:38
• To all - For this IR LED, forward voltage is in the 1.4V ballpark, not 0.7V Jun 22 at 14:24
• As an alternative approach: when I needed an ESP8266 IR remote control transmitter, rather than designing a circuit, PCB, case etc, I bought one of these. It has a Tuya controller rather than ESP8266, but it is pin-compatible with the ESP8266, so I de-soldered the Tuya and soldered the ESP8266 in its place. Works very nicely. You may even be able to find a similar device that is already 8266-based. Jun 23 at 10:09

With $$\h_{FE}=40\$$, base current will have to be $$\I_B=\frac{500mA}{40}=13mA\$$ worst case, but there's no way you can expect the IO to source or sink that much current.

By the way, your calculation for the 1kΩ resistance is incorrect. It should be:

$$R_B = \frac{V_{RB}}{I_B} = \frac{3.3V - 0.7V}{13mA} = 200\Omega$$

You could overcome the problem of limited current available from the IO port by connecting two transistors in a darlington pair arrangement:

simulate this circuit – Schematic created using CircuitLab

Correction: I used $$\R_1=10k\Omega \$$, but that was wrong. I have changed R1 as follows.

In the worst case, where $$\h_{FE}=40\$$, combined current gain for the pair of transistors is $$\{h_{FE}}^2=1600\$$. To obtain collector current $$\I_C=500mA\$$ requires base current of at least $$\I_B=\frac{500mA}{1600} = 310\mu A\$$. The base will be at 1.4V instead of 0.7V (there are two base-emitter junctions in series), so maximum base resistance should be:

$$R_B = \frac{3.3V - 1.4V}{310\mu A} = 6.1k\Omega$$

I've used $$\R_1=4.7k\Omega\$$ to ensure base current is well above the minimum.

You'll lose a volt or so across Q2, so I've reduced all the LED resistances to compensate, keeping current in each at around 100mA.

In this application the 2N2222 is right on the edge of its capabilities, and will get quite warm. The IRLZ44N is a much better fit:

simulate this circuit

• First of all thanks for your help. I tried both of this circuits . Mosfet did not transmit any code but with the Darlington transistor circuit, transmited codes clearly measured distance to 4-4.5 meter. Do you have any suggestion about increasing distance ? Jun 23 at 15:14
• @Grammerking I think your MOSFET is damaged, or not what you think it is. Since you have nearly 1W of power in those LEDs, I think your problem is at the receiving end. If the LEDs are pointed towards the receiver, I think that's enough power to cover a much greater distance than 4m. What does the receiver circuit look like? Jun 23 at 15:24
• By the way thanks for your help darlington ones worked. It didn't worked cause of my mistake. But as i said mosfet doesn't works. I tried to use mosfet with not pulse directly 3.3V to 0V and its switch correctly. Jun 23 at 16:31
• Can I ask you a questions about darlington. You tried to make in first circuit Ib=0.33 mA and you designed gain for 1680 times as ı understood for output current as approximately 554 mA. Why do you add R2 resistors in this circuit. I researched about it they adds R2 resistor for rising down for square signal. But how do you decide this resistor value ? Jun 24 at 13:03
• @Grammerking Since you require the LEDs to switch on and off very quickly (for data transmission), R2 is included to help discharge Q2's base quickly, which helps Q2 switch off. When Q1 is off, Q2's base is effectively disconnected from everything, stored charge will dissipate slowly, and Q2 will take a comparatively long time to switch off without R2 to provide an easy discharge path. I aim for R2 current to be a small fraction of Q2 base current with 0.7V across it. Jun 24 at 13:31

With 5V power to the LEDs, 0.7V across LEDs (as hypothesized in the question), 30Ω resistors, and a saturated BJT, we'd expect like (5-0.7-0.2)/30 ≈ 140mA per LED, thus ≈ 700mA total IC. With hFE = 40 we'd need ≈ 18mA into the base of the BJT. But we can't get nearly that with a 1kΩ resistor and like 3V out of the ESP8266 (less a VBE); we'll only get like 2.5mA into the base!

Drastically reducing the 1kΩ resistor (like to 100Ω) might work, but is not a recommendable solution, because

• the 12mA rating of the ESP8266 output would be significantly exceeded
• 700mA is dangerously close the IC and ICM of 600mA and 800mA for the MMBT2222A
• the hFE of the MMBT2222A indeed is like 40 at high current, but that's with 1V VCE, so we could run into thermal problems with the MMBT2222A

If we stick with a BJT and the same loads, we need a beefier BJT, with more current allowance, more dissipated power, and better gain at saturation; or a darlington (albeit at the expense of increased saturation voltage).

But as pointed in comment, we can put some LEDs in series. We can't put 4, much less 5 diodes in series, because VFWD of the TSAL6200 is more like 1.3V @100mA, rather than 0.7V as stated in the question.

Here is a minimally modified schematic that should work, albeit with only 4 LEDs, only 100mA per LED, and only little margin for the MMBT2222A current, power dissipation and gain.

simulate this circuit – Schematic created using CircuitLab

Perhaps we could use 3 LEDs in series, with like 8.2Ω series resistors, if the tolerance on the 5V is tight enough. The higher the LED supply voltage, the more LEDs we can put in series, and improve the efficiency on top of that.

The only reason I see why a properly wired IRLZ44N would not work (with the 1kΩ resistor removed or drastically reduced) is due to the high GS capacitance, which will damp things, and could be a problem in applications where the signal driving the IR LEDs is a modulated square wave (which increases selectivity).

• We can also use another transistor to get the base current for the main transistor, in a Darlington-like arrangement. Jun 22 at 21:09
• I tried this circuit. Sometimes led transmits codes to reciever. But generally it fails to transmit code more than 1 meter distance. I don't have any oscilloscope therefore i couldn't look this circuit. Jun 23 at 15:06