CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Replace IR LED with PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RatherBeFlying



Joined: 14 Jul 2004
Posts: 11

View user's profile Send private message

Replace IR LED with PIC
PostPosted: Sat Jul 23, 2005 8:15 am     Reply with quote

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: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Jul 23, 2005 9:06 am     Reply with quote

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: 1907

View user's profile Send private message

PostPosted: Sat Jul 23, 2005 9:42 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jul 23, 2005 11:29 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Sat Jul 23, 2005 6:37 pm     Reply with quote

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: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Jul 23, 2005 8:23 pm     Reply with quote

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: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Jul 23, 2005 8:24 pm     Reply with quote

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








PostPosted: Sun Jul 24, 2005 11:44 pm     Reply with quote

Hi
I found a IR remote control example from this website it may be helpfully
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group