Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Infrared Characteristic

Status
Not open for further replies.

UTMonkey

New Member
Having brushed up Infrared using Nigel's tutorials, I thought I would have a crack at getting my JuneBug to interpret SIRC codes.

My approach "in code" was slightly different, heres how.

1. Use external interrupt on RB0 to detect the rising and falling edges of the output from the infrared module (Bill - Stroke of genius attaching the module on this port!)
2. when the interrupt trips on the falling edge start TIMER0
3. when the interrupt trips on the rising edge stop TIMER0 and take a reading.

This has worked really well (I'll post the code if anyone is interested - and when it is complete;) ).

With TIMER0 at 8 bit 256 prescale, the TMR0L reads:-
0x13 = SIRC Start Bit
0xA = SIRC "One" Bit
0x5 = SIRC "Zero" Bit


This works great at up to 2 meters, my code reads the command and device codes perfectly.

Any further away however and things look a bit odd, debugging my code shows that the TMR0L is different, for instance the "one" bit is now 0x9 and not 0xA.

Is this a property of infrared transmissions at distance? does my code need to compensate i.e.

0x12 - 0x14 = SIRC Start Bit
0x9 - 0xB = SIRC "One" Bit
0x4 - 0x6 = SIRC "Zero" Bit


Any help gratefully received.

Mark
 
The width of the pulses out of the receiver isn't the same as those supplied to the transmitter, and may well vary with signal strength as well - this is why you can't just bung RS232 over an IR link.

Notice that my code checks for values within certain limits, and not absolute values.
 
UTMonkey said:
So basically if I build an element of tolerance into the code, I should be ok?

Yes, give it as much as you can - measure the pulses widths at all ranges, then you know the maximum spread - bear in mind temperature might affect it as well.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top