View previous topic :: View next topic |
Author |
Message |
RatherBeFlying
Joined: 14 Jul 2004 Posts: 11
|
Replace IR LED with PIC |
Posted: Sat Jul 23, 2005 8:15 am |
|
|
Hi all,
We need to remove the IR LED from a device and connect a PIC pin instead. Mainly to log usage of the device for later analysis.
The unit is a basic IR transmitter similar to a remote control, the IR LED anode connected to the emitter of a transistor while the cathode is connected to a current limiting resistor then to ground. The collector of the transistor is connected to supply rail. So simply the unit internal IC fires the base of the transistor accordingly to switch on/off the IR LED. We are assuming it is using 38khz carrier similar to a TV remote and initially we will be coding on this assumption.
Our idea is physically remove the existing IR LED and connect the PIC pin to the emitter of the original unit transistor. Now the PIC pin is going on/off according to the original IC firing of the base.
We are counting the high/low duration now but seems this method is producing different micro seconds intervals on each test even if the same button is hit again.
We think its possible to decode the codes using A to D in PIC but we have no idea how to configure it correctly. A simple code will be highly appreciated
Thanx to all. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sat Jul 23, 2005 9:06 am |
|
|
There are multiple encoding protcols for IR. A very common one is RC5. Try google "rc5 infrared"
It is not wise to use simple timing because the times are implementation as well as battery voltage dependant. Most IR protocols, including RC5, use a pulse width modulation technique - the relative time a pulse is active versus quiet.
There are multiple PIC implementations on the web. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Sat Jul 23, 2005 9:42 am |
|
|
This may help just to see how I captured/measured the signal from a regular commercial IR remote control for A/V equipment. If at all possible, I recommend that you use an oscilloscope (a digital scope) to look at the signal that drives the IR LED. If not, then this code may still do what you want, depending on the modulation scheme.
http://www.ccsinfo.com/forum/viewtopic.php?t=21290 |
|
|
RatherBeFlying
Joined: 14 Jul 2004 Posts: 11
|
|
Posted: Sat Jul 23, 2005 11:29 am |
|
|
Thank you both.
Yes, i think we should find a scope and hook it up to the IR LED and check the signal.
if we are working on the receiver side, i guess would be easier as we will get the signal digitally from the IR decoder IC modulated on the same freq of the transmitter. But as we are working on the tx side itself after removing the IR LED itself then we only have the transistor base high then low to try to decode each button. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Jul 23, 2005 6:37 pm |
|
|
Not sure how an A/D is going to help you decode a digital signal. You need to use the ccp module, external interrupt, or poll the signal. I hope that you are not trying to do this with a slow clock. Keep in mind the pic runs at 1/4 the osc. Take you operating freq and divide that by 38KHz to get an idea of how many instructions can be executed between pulses. Remember that interrupts have an overhead associated with them for saving and restoring certain registers. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sat Jul 23, 2005 8:23 pm |
|
|
Quote: | But as we are working on the tx side itself after removing the IR LED itself then we only have the transistor base high then low to try to decode each button. |
Depends on the remote control but you IR LED probably has a forward volt drop of around 1.5 volts. If it is being driven from a higher voltage source (very likely) then there will be a series current limiting resistor. Instead of removing the LED you could just short it out (or replace it with a series resistor after calculating the appropriate value base on the resistance value of the existing series resistor and the voltage dropped across it). Then you will have a digital input to sense. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sat Jul 23, 2005 8:24 pm |
|
|
Quote: | But as we are working on the tx side itself after removing the IR LED itself then we only have the transistor base high then low to try to decode each button. |
Depends on the remote control but you IR LED probably has a forward volt drop of around 1.5 volts. If it is being driven from a higher voltage source (very likely) then there will be a series current limiting resistor. Instead of removing the LED you could just short it out (or replace it with a series resistor after calculating the appropriate value base on the resistance value of the existing series resistor and the voltage dropped across it). Then you will have a digital input to sense. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Guest
|
|
Posted: Sun Jul 24, 2005 11:44 pm |
|
|
Hi
I found a IR remote control example from this website it may be helpfully |
|
|
|