Shop OBEX P1 Docs P2 Docs Learn Events
Credit Card sized IR Remote control — Parallax Forums

Credit Card sized IR Remote control

mojorizingmojorizing Posts: 249
edited 2006-02-13 21:17 in Robotics
This project is an example of how one would add an IR remote control to a project. It uses a credit card sized remote control that can be sourced from Ebay for less than $5. The remote is made by Creative Labs and has a receiver that plugs into your PC serial port to enable remote control of your PC. Inside the receiver there is a 3 terminal IR module that has grnd,pwr,and signal output terminals, and can be removed from the PCB of the receiver. Below is a picture of the Creative Labs PC IR remote with receiver.

remote.bmp


With the IR module on a protoboard and powered up with +5 vdc, the idle state of the output is +5 vdc.

button1arrow.bmp


This screen shot taken with an Oricom Pocket Oscilliscope in Serial Protocol mode shows what the serial stream looks like after pressing button #2. The IR module output is connected to LA7( nothing is connected to LA6) and is read from top to bottom, left to right. This screen shot shows a 9ms zero pulse to tune the AGC then a series of logic zero and one (+5 vdc) pulses that contains system address and command data. Over 40ms. of the serial stream is identical for all buttons. Using the Oricom Pocket Oscilloscope I noticed that the last 8 bits of each button press were different and I used this fact to distinguish between buttons on the remote. A logic level, be it zero or +5vdc, is 0.579 ms long followed by an idle state (+5vdc) of 0.55ms. Using this rule, button #2 gives a byte of 01010010.

closeup.bmp

A comparison of button #3 is below.

button3.bmp

The last 8 bits of Button #3 are 10101000. Using the Pocket Oscilloscope I was able to determine the last byte of each button command.

To use this information in a project, it is will be necessary to sense the initial falling logic level when the IR module senses the remote control, then wait the required time (58.3 ms) and then sample the IR output every 1.2 ms for 8 times. This is best done using a timer in the ISR that is incremented using the RTCC.

Basically what happens is the SX is running in a loop named “snooze” with MIWU enabled on selected pins, in this example it’s rb.5 for the IR sensor module, but in addition it could be button pushes on a front panel, etc. When the initial IR pulse occurs, the SX enters the ISR , swaps the wkpnd_w with “Interrupt” which contains the source of the MIWU. The MIWU is disabled and from here until the interrupt is service, the SX is running with the RTCC interrupt enabled for every 10 microseconds. The timers for the particular source of interrupt are preloaded with the correct value and the SX leaves the ISR. , the GlobalInterrupt flag is set, and the SX leaves the ISR.
Now the SX calls routines sequentially that handle the source of the interrupt, in this case, the IR. Each routine is a state machine where the SX progresses thru each state as time goes on. This is important to realize and you’ll see that the IRRemoteinterrupt has only 2 states. Notice in the code after the label “IRRemoteinterrupt” how another interrupt source is handled, such as a front panel button debounce, The SX is running in RTCC mode and the initial interrupt would be the front panel button push but while the debounce timer is incrementing an IR pulse in received on rb.5. This pin (IR) is polled and it’s associated timers and flag is initialized at this time.
Anyway, as the IR timers increment the SX finally reads the state of rb.5 after the proper delay then delays further until 8 bits of the IR stream are read. The IR command is compare to set values and the code prceeds from there to respond correctly to the given IR remote. In the end the interuppt flags are cleared and the SX re-enters the MIWU mode.


I stripped this code from a project that I did using a SX52 with 3 sources of interrupts, this IR remote, a mechanical button, and 8 address lines of a SRAM where I needed to intercept the memory at certain addresses and take control. I hope the code is not too confusing, but I think the credit card size remote controller is great for projects.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bad spellers of the world untie!

Post Edited (mojorizing) : 2/12/2006 5:59:21 AM GMT

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-09 19:59
    Very cool, so cool I checked out the offerings on ebay. Those looking for one themselves, be careful who you get it from, Tekgems is trying to charge $11 in shipping for a shipping weight of 1 lb. I know for a fact USPS Priority is about $5 for such a package and $6 is quite a bit for handling charges.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-09 20:13
    mojorizing,

    ·· I would recommend editing your post to remove the pasted code and instead attach it so that the screen doesn't have to be scrolled left/right so far to read the text.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • mojorizingmojorizing Posts: 249
    edited 2006-02-09 20:38
    How embarassing, I had to get my son to show me the finer points with MS Paint to format the pics! tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-09 22:19
    Thank you!· Or rather, my 1024 X 768 laptop screen thanks you!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-09 22:35
    Can you provide a little more definition on the labels you use for the buttons? The labels button1-button12 are abit unclear as to which they actually are. Here is how I interpret the buttons in left->right, top->bottom:

    play, stop, pause, eject
    previous, rewind, fast forward, next
    1, 2, 3, shift
    4, 5, 6, mouse
    7, 8, 9, volume up
    start, 0, mute, volume down

    Also have you investigated the behaviour when a button is continued to be held down, does it repeat the entire transmission, or is there some sort of continuation command?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • mojorizingmojorizing Posts: 249
    edited 2006-02-12 05:56
    You're right, Paul. I put new labels over some of the buttons with a label maker and I didn't use the original layout when I stripped down the code. I updated the IR_remote.SRC to reflect this. I didn't use 2 of the keys, so they're not in the code...and they're not in my notes either! I can't recall exactly, but the command is repeated a few times followed by a common repeat command when any button is kept depressed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!

    Post Edited (mojorizing) : 2/12/2006 6:13:00 AM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-13 21:17
    Thanks, it appears that previous and play are the missing codes. It should be trivial to deduce which codes they are given the information you've provided. Did you investigate if there is any manipulation of the data when it is sent via RS-232 to the PC? If not what other chips are on the board (anything besides a level shifting chip to up the 5V to RS-232 levels)? The reason I ask is it would be nice to keep the thing in it's orginal package and interface to the SX via RS-232 so it could still be used for it's original intent as well. And unfortunately I don't have the diagnostic equipment to determine it myself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.