IR Remote decode blues

Electronics Computer Programming Q&A
Post Reply
User avatar
HighFrequency
Posts: 122
Joined: Sun Apr 17, 2005 1:01 am
Location: Victoria BC
Contact:

IR Remote decode blues

Post by HighFrequency »

Ok, so I bought some IR receivers on ebay a while back, and wanted to see what I could do with them. So I took them into the lab with my tools and started playing. After I fried one or two, I got it wired right. Then all the codes were the same. DOH! I didn't program the Universal Remote. So now I have a list of the codes for all the digits 0-9. They are 32 bits each (overkill maybe?). They all start with 000010, and then the code starts. My question is this... how would I read the codes? I'm using a PIC16F877A or 628A. I thought of the serial port, but the 32-bit codes are too big, and if I busted them into four 8-bit chummies, it screws the sequence (start/stop bits). <p>Anyone have an idea? I would appreciate a hint, not the full answer. I'm gonna sleep on this tonight and see what I dream up. Thanks all!
There is only one correct answer, mine.
User avatar
HighFrequency
Posts: 122
Joined: Sun Apr 17, 2005 1:01 am
Location: Victoria BC
Contact:

Re: IR Remote decode blues

Post by HighFrequency »

No one has an idea?
There is only one correct answer, mine.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: IR Remote decode blues

Post by philba »

I wouldn't use the serial I/O port anyway. Basically, you want to feed the IR receiver output into a port. <p>I'd use a timer set to interrupt at the IR modulation frequency. Then you could determine the bit sequence based on the port value. I'd wait for the start of the sequence (there is probably some sort of lead-in sequence - whether it is 0001 or not), then start a timer that will interrupt when the next bit is due. In the timer service routine, read the port, shift the value into a temp reg, restart the timer and return. when you reach 8, store byte 1, then repeat for the next 3 bytes. when last byte is saved, set a flag that your main line code is waiting on to get set.<p>You might want to make the first timer period slight longer to make the interrupt happen in the middle of the IR pulse. this gives you a little leeway if the IR modulation frequency is slightly off.<p>You probably also want to discard the lead-in sequence. I'd build it into the state machine.<p>Phil<p>[ August 04, 2005: Message edited by: philba ]</p>
User avatar
HighFrequency
Posts: 122
Joined: Sun Apr 17, 2005 1:01 am
Location: Victoria BC
Contact:

Re: IR Remote decode blues

Post by HighFrequency »

Thanks man, I think that's exactly what I'll do. I should have thought about that. Eventually I'll make my own IR transmitter and encode the signal how I want. But for now, this will work for me. Thanks.
There is only one correct answer, mine.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: IR Remote decode blues

Post by philba »

let me know what you come up with. I've got a background project (i.e. I think about it but never get around to it...) to do something like this. The biggest trick for me is making it universal.<p>By the way, a short term test would be to set up the PIC to read the IR and ship the bits down to a PC. This would allow you to look at what is coming off of the IR detector. Of course, its not needed if you have a DSO...
User avatar
HighFrequency
Posts: 122
Joined: Sun Apr 17, 2005 1:01 am
Location: Victoria BC
Contact:

Re: IR Remote decode blues

Post by HighFrequency »

Yeah, the labs at school have all the fancy equipment. So I was watching the codes on the scope. <p>I looked at the codes I got and some good news came. The numbers are split into 2 groups by the first byte of the code. Inside each group, no 2 numbers have identical 2nd bytes. This will make it much easier to process.
There is only one correct answer, mine.
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: IR Remote decode blues

Post by rstofer »

There are MANY different encoding schemes so select the remote you want to use first.<p>There is one scheme where the data stream is quite long and contains the complement of the data as part of the string.<p>Most codes start with a device code followed by a command sequence.<p>The fastest way to get this done and actually accomplish something is to use either the Athena or DIOS class chips from www.kronosrobotics.com These are very nice controllers with a bunch of capability.<p>I have a couple of small robots that are controlled by IR using these devices.<p>Don't overlook the app notes at www.microchip.com
User avatar
HighFrequency
Posts: 122
Joined: Sun Apr 17, 2005 1:01 am
Location: Victoria BC
Contact:

Re: IR Remote decode blues

Post by HighFrequency »

Unfortunately, I am poor. So I use the chips I have, and the tools that the College provides for me. Which includes PICStart Plus programmers. If I switch to another type of chip, I need a programmer to go with it. And then my girlfriend would have my nuts for buying equipment.
There is only one correct answer, mine.
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: IR Remote decode blues

Post by bodgy »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by HighFrequency:
And then my girlfriend would have my nuts for buying equipment.<hr></blockquote><p>
Hmm, sounds like a trade in is needed! :D <p>I wonder what's available on eBay :confused: <p>Colin
On a clear disk you can seek forever.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: IR Remote decode blues

Post by philba »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by bodgy:
<p>
Hmm, sounds like a trade in is needed! :) Besides, the local supply in Victoria is clearly above average in quality. <p>On the issue of using stuff from kronos - I've never quite understood the appeal. It seems awfully pricey for what you get. I think they are targeting the same market as the BasicStamp. If one knows how to program PICs or AVRs, I don't see the benefit. Especially if you use C.<p>Phil
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: IR Remote decode blues

Post by rstofer »

I guess having all of the prebuilt code is quite useful. I just want to use IR decode, I don't want to invent it and for simple IR controlled toys the little 14 pin Perseus is very handy. I have a hexpod using this and a couple of track type toys using the DIOS chip although Perseus would work.<p>The DIOS logic analyzer is very handy. I have been using it while implementing I2C on the Philips LPC2106 ARM and it has worked quite well. I also have the UUM project and I like it but the simple DIOS logic analyzer is easier to use.<p>The chips are much faster than the Stamp and provide all of the functionality. And, they are cheaper.<p>I do know how to program PICs and AVRs but, if you just want a toy in a hurry, why bother? The Perseus is $9 including everything.<p>It is possible to spend days or even weeks pouring through IR decode projects and getting them to work. Or, buy a chip that has it working and program the remote to fit. Works for me!
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests