# IR LED from TV Remote

#### Alessandro Marchei

Joined Apr 21, 2020
10
Good morning,

I am building a project using IR LED to communicate with a vs1838 IR sensor via NEC protocol.

I studied very well the circuitry of a simple tv remote control and I am wondering why the sensor reads the signal from my LED only if it's just 2-3 meters away from it and while looking straight at the receiver. Insead, if I use the remote, it seems that it can send data from every angle and every distance .. also 10meters or more.

Supposing my code generated from arduino to emulate the NEC protocol (at 38 kHz frequency)is correct (and it does), what could be the problem?

I am driving the LED with a npn transistor (as in the remote control) at 40-50 mA of current, which I think is fair enough.

Why is it so hard for my led to communicate with the sensor? Any advice?

PS : Could it be that tv remote controls have an optimal shape at the emitter, so that the beam is spreaded all over the directions?
https://ak.picdn.net/shutterstock/videos/10017164/thumb/1.jpg

Last edited:

#### ericgibbs

Joined Jan 29, 2010
13,274
Hi AM,
Where did you get the transmitter LED and what is its type number.?
E

#### Alessandro Marchei

Joined Apr 21, 2020
10
Hi AM,
Where did you get the transmitter LED and what is its type number.?
E
Hi,

I salvaged it from another old tv remote control, so I think it doesn't depend much on the type, because I tried different types and all of them have the same problem

Joined Apr 16, 2011
536
Wild guesses only.....

1) 50mA may be insufficient unless that is the average current - some IR LEDs can cope with 1A peak and 100mA continuous. (show your schematic)

2) Inaccurate current measurement - how are you measuring?

3) Inaccurate protocol timings (poor coding) - (show your code) - "learned" timing may not match original timing

4) Slow switching - edges should be square, rounded off edges could in theory reduce reliability - (show your schematic)

5) something else I have not thought about

#### ericgibbs

Joined Jan 29, 2010
13,274
Hi,
If you have a mobile phone with an inbuilt video cam, you can compare the apparent brightness of the Remote and the Arduino Remote LED’s.

In a darken area with a low ambient light level, cover over the phone camera lens,with your hand and point the Remote at the camera lens and press a button on the remote, you should see a the LED flickering, do the same for the Arduino remote and compre the LED brightness.

Most mobile phones are able to detect the IR signal.

E

#### DickCappels

Joined Aug 21, 2008
7,565
I have noticed that higher-powered (as determined by peak currents) IR LEDs have narrow beams.

#### Alessandro Marchei

Joined Apr 21, 2020
10
Wild guesses only.....

1) 50mA may be insufficient unless that is the average current - some IR LEDs can cope with 1A peak and 100mA continuous. (show your schematic)

2) Inaccurate current measurement - how are you measuring?

3) Inaccurate protocol timings (poor coding) - (show your code) - "learned" timing may not match original timing

4) Slow switching - edges should be square, rounded off edges could in theory reduce reliability - (show your schematic)

5) something else I have not thought about
Sorry but now I cannot share schematics or code, but I think the major issue could be the current at 99%.. in the tv remote the driver is composed by a npn transistor with the LED at the collector, the base connected to the output pin from the microcontroller, and the current limiting resistor is placed at the emitter with just 4 OHMs.. Assuming 3V power supply, the current at the collector should be at least 80 mA, quite a lot

So now I have to try to increase the amount of current and let's see..

#### Alessandro Marchei

Joined Apr 21, 2020
10
Hi,
If you have a mobile phone with an inbuilt video cam, you can compare the apparent brightness of the Remote and the Arduino Remote LED’s.

In a darken area with a low ambient light level, cover over the phone camera lens,with your hand and point the Remote at the camera lens and press a button on the remote, you should see a the LED flickering, do the same for the Arduino remote and compre the LED brightness.

Most mobile phones are able to detect the IR signal.

E
Thank you for the advice.. this evening in absolute darkness I will try to compare the brightnesses with my phone.. but it seems they are pretty the same if checked in a luminous room..

#### ericgibbs

Joined Jan 29, 2010
13,274
hi AM,
Let's know how it goes, I would say that 100mA would be the correct current level for the LED.
Are you using the Arduino 5V to drive the LED. Resistor> NPN.?
Post a sketch.

I used a Nano to make a universal remote, works fine.
BTW: you can pass the NEC code from a laptop to the Arduino, write a simple PC program to do that, and then it is possible to create some novel features.

Simple Sketch:

C-like:
/* SKY
IR Transmitter Demonstration 1
IR-Xmit-Demo1.ino
Control TV using IR Library
IR LED must use Pin #3
*/

// Include IR Remote Library by Ken Shirriff

#include <IRremote.h>

String cmdSKY = "";
String rxdString;
boolean rxdEOL;

// Define a variable for the button state
int buttonState = 0;

// Create IR Send Object
IRsend irsend;

void setup()
{
Serial.begin(38400);
}
void loop(){
if (rxdEOL) {
Serial.print(rxdString);
cmdSKY= rxdString.substring(2,1);

for (int i=1; i <4;i++){;
if (cmdSKY=="P"){
irsend.sendRC6
(0xC00C24, 24); //
delay(100);
}
if (cmdSKY=="R"){
irsend.sendRC6
(0xC00C3E, 24); //
delay(100);
}
if (cmdSKY=="D"){
irsend.sendRC6
(0xC00C21, 24); //
delay(100);
}
if (cmdSKY=="U"){
irsend.sendRC6
(0xC00C20, 24); //
delay(100);
}

if (cmdSKY=="F"){
irsend.sendRC6
(0xC00C28, 24); //
delay(100);
}

}

//  Serial.print(inpString +"...");
//  Serial.println(sync);
rxdString="";
cmdSKY="";
rxdEOL = false;
Serial.println("*" + rxdString);
}

}

void serialEvent() {  // Master Event
while (Serial.available()) {
// get the new byte:
// add it to the rxdString:
rxdString += inChar;

if (inChar == '\n') {
rxdEOL = true;

}
}  }

#### ericgibbs

Joined Jan 29, 2010
13,274
hi,
You may find this Sketch more helpful, it works the TV and Sky box.
E
Change the .txt extension to .ino