Constant current IR LED circuit

An area for more general discussion by the user community for topics not covered elsewhere
User avatar
AnalysIR
Site Admin
Posts: 792
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Constant current IR LED circuit

Post by AnalysIR »

We recently publish a blog post about a constant current IR LED circuit.

See http://www.analysir.com/blog/2013/11/22 ... d-circuit/

If you have any questions about the article or circuit or enhancements, please comment here.
User avatar
AnalysIR
Site Admin
Posts: 792
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Constant current IR LED circuit

Post by AnalysIR »

Sample code used in sketch to generate a circa 37kHz modulated signal @ 50% duty cycle is below:

Code: Select all

/*
  Sample modulation signal
  Turns on an Pin 7 on/off for 13 uSecs, repeatedly.
  This example code is in the public domain.
 */
 
int led = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
  pinMode(7, OUTPUT);   //modulated signal is on Pin 7  
}

// the loop routine runs over and over again forever:
void loop() {
 while (true){   
  digitalWrite(7, !digitalRead(7)); 
  delayMicroseconds(6);  //also allows for delay/ovehead caused by all of the code in this loop             
 }
}
Note: if you are sending IR use IRremote, IRLib or PWM to generate your modulated infrared signal. This code is for testing and measurement purposes only.
mruttmann
Posts: 5
Joined: Tue Mar 20, 2018 2:07 pm

Re: Constant current IR LED circuit

Post by mruttmann »

Currently I'm using just one IR LED I'm my project, but it is supposed to be applied to a classroom (measuring circa 5x5 meters). My professor advised me to use 3 IR LEDs in order to achieve a better range.

My current circuit have a 2N2222 transistor connected to the Arduino port through a 470R resistor. The IR LED is connected to transistor's emitter (anode) directly to GND (cathode). It works well for residential applications (I could activate devices from 3 to 4 meters, but had to point the LED to the device).

What changes I should made to your 2 LED circuit in order to add one more IR LED? The MEGA 2560 digital ports supply 5V, right?

Thanks!
User avatar
AnalysIR
Site Admin
Posts: 792
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Constant current IR LED circuit

Post by AnalysIR »

The circuit on our blog should be enough as is.

All you need to do is to use any 2 from tsal6100, tsal6200 & tsal6400. (all have different angles from narrow to wide)

Mixing the LED angle gives you better coverage, particularly when combined with increased current.

If you calculate the IR current to be up to 300MA (Peak), you effectively have 600mA IR current from the 2 LEDs, which is more than enough.
Light & IR will reflect off most surfaces! walls, windows , ceilings etc

If you really think you need more LEDs, then just duplicate the emitter circuit.

You may also be able to get 3 leds in series with a 5->5.5V supply - if you keep the current lower(=higher value resistor).

Bottom line is that your 'professor' probably wants you to try out all of the variations yourself, as a very good way to learn.
mruttmann
Posts: 5
Joined: Tue Mar 20, 2018 2:07 pm

Re: Constant current IR LED circuit

Post by mruttmann »

Understood.

Thank you very much!
PSteward
Posts: 2
Joined: Thu Apr 16, 2020 10:24 pm

Re: Constant current IR LED circuit

Post by PSteward »

Hello!

Sorry to hijack, I tried building the left circuit:
Image
It does work for the my AC unit but the range is extremely limited versus my 2-AAA battery powered single IR remote (R51M/BGCE). I've tried with 6100/6200/6400 and am really interested to understand why one IR from a remote can work non-line-of-site and a double IR circuit barely works unless facing direct at 6 feet.

Thanks,

--Phil
User avatar
AnalysIR
Site Admin
Posts: 792
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Constant current IR LED circuit

Post by AnalysIR »

Post a photo of your circuit, with connections & resisto values clear. (If the changes below don't work)

One possibility might be....the 3k3 resistor could be limiting current dependinf your NPN.

So lower the value of R3 to 330R.

Changing R4 (with the above change) to 2R, should provide the same output as a domestic remote control.
PSteward
Posts: 2
Joined: Thu Apr 16, 2020 10:24 pm

Re: Constant current IR LED circuit

Post by PSteward »

Wow! Huge difference, works like a charm. Swapped in a TSAL 6400 and it works without pointing as well!
Now I just gotta figure out which of my un-organized emitters are what.....

Thanks!

--Phil
User avatar
AnalysIR
Site Admin
Posts: 792
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Constant current IR LED circuit

Post by AnalysIR »

Great, thanks for the update.

That is the kind of performance you can get with our SendIR modules. (Available via our online shop & actually, they are even a bit better!)
mcolacino
Posts: 1
Joined: Sun Jan 10, 2021 3:20 pm

Re: Constant current IR LED circuit

Post by mcolacino »

First, thank you for all of this work. I have just recently started on thais project and began by understanding your circuit. I then tried putting my scope on the Arduino pin running an IRRemote example sketch. The sketch just initializes the irsend object and sends out an NEC code corresponding to the power on/off of the device I'm trying to control.

Surprisingly while the encoding of the data is correct. the trace shows that the output of the pin is around 440mv to the top of the square wave and 520mv at the peak. This naturally contrasts with your example code which pulses the output pin to max 5V, and in fact the IRRemote code doesn't seem produce enough voltage to forward bias a transistor. I'm wondering if you can shed any light on why this is happening, and suggest a way to work around it short of rewriting the IRRemote library!

Sorry about the low quality jpg but your site rejected a 480kb version of the file as too large!

IMG_0709.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply