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.

IR Transmitter / Receiver Project

Status
Not open for further replies.

Omar.M

Member
Hello,
I've been working for quite some time on a project following my recent obsession with radio-controlled airplanes.
I've been wanting to create an IR transmitter / receiver set for micro planes (indoor, tiny ones)-- more as a learning process.

However, after many tries I just cannot seem to get it right.
I've tried quite a few things, at first I was using mikroBasic to encode and decode the pulse train which looks something like:
**broken link removed**
But of course I only need three channels.

The biggest problem I was having was timing-- the compiled code was just too inefficient. The transmitter was okay, but the receiver just wouldn't work.

The way I was trying to decode the pulse:

I figured I'd wait for the sync pulse, while in the background using the CCP module to capture the width of the pulses.
I had TMR0 running and that was being used as a sort of counter for the PWM output (for the control surfaces). On TMR0 overflow => values (that were previously captured using CCP and stored in temp. buffers) were saved in their control-surface variable and the timer was reset.

In the main routine I was using TMR0 as a counter-- kept comparing values of each control surface to the value of TMR0 and shut off any pin which had a value less than that of TMR0. This gave me a PWM output for each control surface (in theory).

For example if the throttle value was 120. On TMR0 overflow the throttle pin would be set high. TMR0 would increment, 1, 2, 3, ... 119, 120 (and continue). But as soon as it reached 120, throttle pin would be set low.

After much fiddling with mikroBasic code, I figured it all boiled down to assembly-level coding.
The biggest problem for now with that is capturing the CCP values and scaling them to a 0-255 byte that I can compare.

Anyways, after hovering around Nigel's website for a while I found that perhaps Manchester encoding might work (heck, there's much more code available for it!).

So I'm just wondering, (sorry for the huge post), could I use Manchester coding to get a fairly okay IR TX / RX thing going or does anyone have any other recommendations (perhaps some idea on scaling the captured values from the CCP mode)? I'm rather stumped and confused!

Thanks very much,
-Omar

P.S. Attached is some of the mikroBasic code, just to show you that I did put in some effort!
 

Attachments

  • throttle_test.txt
    2.6 KB · Views: 286
  • full_test.txt
    3.3 KB · Views: 308
Thank you very much. After reading that post and looking at the code, I am really amazed at how simple efficient yet simple the code ended up being.

That's exactly what I was looking for!
After going through the code, it seems the 38kHz carrier was done in software (which was neat) but I was going a different route-- simply ANDing a 38kHz pulse from a 555 timer with the PIC transmitter.

I'm wondering, will this work as well?
-Omar
 
  • Like
Reactions: 3v0
Thank you very much. After reading that post and looking at the code, I am really amazed at how simple efficient yet simple the code ended up being.

That's exactly what I was looking for!
After going through the code, it seems the 38kHz carrier was done in software (which was neat) but I was going a different route-- simply ANDing a 38kHz pulse from a 555 timer with the PIC transmitter.

I'm wondering, will this work as well?

Not as well, as it's less accurate, but it's near enough. However, it seems a huge waste adding extra hardware to produce a poorer result?.
 
Status
Not open for further replies.

Latest threads

Back
Top