PDA

View Full Version : IR Remote Control Issues



Kamikaze47
- 27th August 2007, 10:08
Hi All,

I'm currently making a PIC controlled Infrared Remote Control so that I can control all the various components of my home entertainment setup from a PIC. So far i've been concentrating on my TV.

I have attached an image of the circuit i've made.

The point marked PIC(PWM) is connected to the PICs hardware PWM output, and generates a constant PWM or 48khz at 50% duty cycle.

The point marked PIC(I/O) is connected to one of the PICs digital I/O pins.

I use the PIC to turn on and off that I/O pin to output the correct sequence to turn on my TV.

And it works. However, the range is quite poor. It only works up to 2m away from the TV and only when the IR LED is pointed directly at the TV, whereas my regular TV remote works from anywhere and even if its not pointed anywhere near the TV.

The IR LED's specs are the following: 1.2V typical (2v max), 20mA typical (50mA max), 14-28 mW/cm2

Anyone have any ideas on what may be wrong?

mackrackit
- 27th August 2007, 10:33
What is the angle of the IR? The wider the angle the less range.

Kamikaze47
- 27th August 2007, 10:39
specs say viewing angle 20 degrees

Jumper
- 27th August 2007, 10:52
Is it the correct wavelength? 950 nm is popular but so is also eight-hundred something and so on..... less correct -> less sensitive receiver

Is it the correct frequency? 40? 48? 56? kHz there are plenty to choose from.... pick the wrong one and you loose performance

Do you provide enough current thru the LED? Even if the LED is specified 50 mA MAX that usually means that it can handle 50 mA constantly. Since you have a 50 % dutycycle and then send bursts out it can take much more. There is a chart in the datasheet that shows max current for different dutycycles. Now you have 30-40? More is better...... many receiver datasheets mention distance when the LED currenct is 100 mA.

I am happily running my IR led's at 700 mA and that is more than enough to change channel for the whole apartment area.

Of all these questions the easiest to solve is frequency (if you have a scope). The others are more or less up to trial and error...

Break open the TV and see if the receiver chip has any markings, then you might get both FQ and wavelength.

/me

Kamikaze47
- 27th August 2007, 11:08
These are the specs on my IR LED:


Parameter min typ max unit test conditions
---------------------------------------------------------------------------------
radiant power 14 - 28 mW/cd2 If=20mA
peak emission wavelength - - 940 nm If=20mA
spectral line half width - - 50 nm If=20mA
forward voltage - 1.2 2.0 V If=20mA
reverse current - - 100 uA Vr=5V
rise time - - 200 nS PW=10uS DC=10% Ifp=20mA
fall time - - 500 nS PW=10uS DC=10% Ifp=20mA
power dissipation - - 150 mW Vr=5V
continous forward current - - 50 mA -
peak forward current - - 1 A PW=10uS DC=10% Ifp=20mA
reverse voltage - - 5 V -
viewing angle - 20 - deg -
operating temp range -45 +25 +100 degC -
storage remp range -45 +25 +100 degC -
lead soldering temp - - +250 degC 5 Sec 1.6mm from base

PW=Pulse Width
DC=Duty Cycle

The frequency of 48khz i found by trial and error. It def works best at 48khz.

How could i get 700mA with this LED? Pref with 5v only?

keithdoxey
- 27th August 2007, 11:46
Hi All,

I'm currently making a PIC controlled Infrared Remote Control so that I can control all the various components of my home entertainment setup from a PIC. So far i've been concentrating on my TV.

I have attached an image of the circuit i've made.

The point marked PIC(PWM) is connected to the PICs hardware PWM output, and generates a constant PWM or 48khz at 50% duty cycle.

The point marked PIC(I/O) is connected to one of the PICs digital I/O pins.

I use the PIC to turn on and off that I/O pin to output the correct sequence to turn on my TV.

And it works. However, the range is quite poor. It only works up to 2m away from the TV and only when the IR LED is pointed directly at the TV, whereas my regular TV remote works from anywhere and even if its not pointed anywhere near the TV.

The IR LED's specs are the following: 1.2V typical (2v max), 20mA typical (50mA max), 14-28 mW/cm2

Anyone have any ideas on what may be wrong?

Couple of things.....

1. The schematic for your LED driver has the IR LED the wrog way round !!

Assuming your switching transistors have a Vsat of 0.2V each and the IR LED has its lowest possible Vfwd of 1.2V then the resistor will be dropping 3.4v giving a current of 22.6mA.

2. Even if your TV is using a carrier frequency of 48KHz, its almost certainly wrong for most of your other kit. The three main families of IR codes are

Philips (RC5, RC6, RCMM) @ 36kHz
NEC and Vairiants @ about 38kHz
Sony @ 40kHz

Generally 38kHz is a good "catch all" frequency as 36 and 40k systems will still have pretty good reception.

You may find that you need to set your PWM to different values for different devices.

dhouston
- 27th August 2007, 11:47
I've never heard of a 48kHz carrier. 32-40kHz is common and there are some that use ~56kHz What is the make/model of the TV?

Kamikaze47
- 27th August 2007, 12:00
Ok, I just tried it with a 10 ohm resistor, so 340mA through the LED. It only seems to have made a very small difference to the range, and I still have to point the LED *directly* at the TV for it to work - Even a few degrees make a difference.

I will try playing with the frequency again.

Also, do you think 50% duty cycle is the best bet? I wasn't sure what to use, and 50% seemed logical, but now i'm considering a lower duty cycle as that means the LED should theoretically be able to handler a higher peak current.

*edit* My TV is a Samsung LA40R71BDX

*edit2* Fixed mistake in schematic (thanks keithdoxey)

Jumper
- 27th August 2007, 12:20
http://www.sbprojects.com/knowledge/ir/nec.htm

Someone said Samsung uses NEC code 38 kHz with a dutycycle around 0.25 to 0.33

HOW IS YOUR TIMING?

Increasing IR current that much would have made a difference if that was the true problem.

Do you have a scope so you can meassure the output of the TV remote control LED? (and if you have a nice digital one you might even post the pic)


/me

Kamikaze47
- 27th August 2007, 14:07
I dont have scope unfortunately. So what I did was hook up an IR receiver to a PIC, and had it sample it every 10uS and output it to my PC which I then put into excel and made a graph. The pic attached has the signal from my TV's remote at the top, and the signal from my home made remote below. The scale on the bottom is in 10's of uS.

As you can see, the timing is pretty close. I would have thought if it was a timing issue, it simply wouldn't work at all instead of bad range?

I'm going to try 38khz at 25% and see how that goes.

dhouston
- 27th August 2007, 14:13
Samsung uses 38kHz and sends a 32-bit code similar to the NEC protocol but with a shorter lead-in pulse and with the bits interpreted differently. Samsung uses a 4.5mS start pulse followed by a 4.5mS space. Your example appears to be for the "1" key.

Kamikaze47
- 27th August 2007, 14:17
Samsung uses 38kHz and sends a 32-bit code similar to the NEC protocol but with a shorter lead-in pulse and with the bits interpreted differently. Samsung uses a 4.5mS start pulse followed by a 4.5mS space.

Sounds exactly like what i've observed. Do you know of a page on the net somewhere that has more detailed info on the protocol they used? I havn't been able to find any info on it.

Jumper
- 27th August 2007, 15:01
When you PIC-scoped the remote what receiver did you use? What is the range and sensitivity using the standard tv remote control and this receiver?

Then we can get an idea of the FQ used. If you have good distance with the remote then it must be your LED that has a major output power problem. It might be burnt due to over current along the evolution chain.

Have you tried to move one thansistor to the base of the other, so you do all the mixing on the base.

Maybe just loose both transistors and sink current with the PIC and make a software mixer by turning on and off HPWM (and connect the led there with a resistor)

what partnumber is the led?
what part number is the receiver you have used?

/me

dhouston
- 27th August 2007, 15:21
Sounds exactly like what i've observed. Do you know of a page on the net somewhere that has more detailed info on the protocol they used? I havn't been able to find any info on it.
I don't recall seeing any detailed description. There is a simple description at http://www.techdesign.be/projects/011/011_waves.htm and there are CCF codes on RemoteCentral.com and at http://ir.premisesystems.com/. There are a few detailed descriptions of the NEC protocol. It was the first and was copied with minor changes by many others. Here's a datasheet for an early NEC encoder chip - http://davehouston.net/Nec6121.pdf

EDIT: BTW, I find it easier to record the codes as .wav files using a soundcard. This way you can use a wave editor to view them. See http://davehouston.net/learn.htm

OTOH, if you sample with a PIC using a phototransistor, you can get the carrier frequency and eliminate any guesswork.

ardhuru
- 28th August 2007, 06:10
Hi,

This technique should help you get a substantial improvement; instead of gating the LED using HPWM and a data pin, use the data pattern to control the HPWM pin itself (keep the HPWM running all the time, and just turn the HPWM pin to an input wherever you dont want a transmission); Darrel had suggested this during an earlier post pertaining to X10 transmission and it worked like a charm.

If nothing else, it would at least eliminate the drop across one transistor, and you would save a pin as well. You would also find the waveform far more consistent with the original remote.

Regards,

Anand

Kamikaze47
- 28th August 2007, 08:21
Ok, here's what i've done since the description in my original post:

- Changed the LED's resistor to 10 ohm
- Removed one transistor, turning on and off PWM to control the LED
- Changed the frequency to 38kHz
- Changed the duty cycle to 25%
- Improved the timing using TMR0 for timing instead of PAUSEUS

The end result is an improvement, but not spectacular. The range is improved, however I still need to point the LED pretty much directly at the TV for it to work - Whereas i can point my normal TV remote anywhere in the room and it will work (even pointing directly away from the TV).

Perhaps I need some kind of diffusing material in front of the LED? I'm not sure what to use tho. Or maybe I need to get an LED with a better viweing angle, but i'm not sure that this is the case, unless my tv's remote has a 360 degree viewing angle - lol. I assume that my tvs remote is simply powerful enough to bounce off the walls and eventually find its way to the tv no matter what direction i point it.

keithdoxey
- 28th August 2007, 10:33
Looking at the schematic again, I dont think you are getting enough drive to the transistors.

Either change the transistors to PNP types and invert your gating signal or put the transistors where the LED is and the LED where the transistors are so that the transistors are sinking current rather than sourcing it.

You may also need to reduce the value of the base resistors to get more drive.

ardhuru
- 28th August 2007, 11:53
Perhaps I need some kind of diffusing material in front of the LED? I'm not sure what to use tho. Or maybe I need to get an LED with a better viweing angle, but i'm not sure that this is the case, unless my tv's remote has a 360 degree viewing angle - lol. I assume that my tvs remote is simply powerful enough to bounce off the walls and eventually find its way to the tv no matter what direction i point it.

I dont think any external diffusing material would help. A lot of remotes have the LED body itself sticking out of the remote. You're right about the signal bouncing off objects; IR does tend to reflect well, although the signal strength must be dropping signaificantly after every refelction.

I suspect now its just a matter of getting the frequency and/or duty cycle right. You could also try 2 LEDs in series, pointing in a slightly divergent manner to give you a wider coverage.

Regards,

Anand

ardhuru
- 28th August 2007, 12:05
Ok, I just tried it with a 10 ohm resistor, so 340mA through the LED.


Just realised; if my math is right, you are *not* getting 340 mA thru' the LED with a 4.7K bias resistor; I would reduce that to 1 K; at the most 2.2 K.

Regards,

Anand

dhouston
- 28th August 2007, 12:17
Are you sending single or multiple copies of the IR? Most of the receivers need to see multiple copies to set their AGC and receive threshold so most protocols send more than a single copy.

Kamikaze47
- 28th August 2007, 14:12
Excellent! Working perfectly now :)

Switching the transistor and LED around so that the transistor is sinking current, and changing the bias resistor to 1k did the trick (Thanks keithdoxey and ardhuru)

It now has pretty much the same range and capability as my regular TV remote.

Thanks very much to all for your help.

My next step is to get it working with my Receiver. Getting that working should be much smoother now tho. I can actually change the PWM frequency on the fly by writing to the appropriate registers, so even if my other equipment works on different frequencies it shouldn't be a problem.