Universal Remote control

Discussion in 'Programmer's Corner' started by tigrot, Dec 5, 2004.

  1. tigrot

    Thread Starter New Member

    Dec 5, 2004
    2
    0
    Hi!

    currently i am trying to build up a universal remote control so that i gain experience in using microcontrollers. my vision is to have a remote control which just copies the timing pulses of the infrared code coming from another remote, save these pulses so as to be transmitted later.

    i am using pic 16F877 and i have already managed to make an LCD works, 10 by 4 keypad, and an RS232 interface but i have been stuck these last 6 weeks on how to copy the infrared code. i am using pic basic language but assembly language is not a problem to work with.

    can someone please help me??

    thanks
     
  2. cyberhehe

    Well-Known Member

    Oct 6, 2004
    61
    0
    I don't have hands on experience using PIC but I may give you suggestions on how you will go with your infrared solution.

    First I am assuming that you have a good infraRed receiver circuit, that can produce all those pulse output coming from the infrared transmitted signal of the master unit in a clean digital form. What you should do is to have an interrupt driven input available.

    Capturing the IR Signal:

    1. Prepare this interrupt driven input and design an Interrupt Service Routine (ISR) mechanism to handle this input.
    2. Make sure that the input generates an interrupt whenever there is a level change.
    3. Make use of the programmable timer to measure duration of each transistion duration from point to point, meaning measuring either high side or low side of the signal duration.
    4. At the first transition that you encounter where the ISR is serviced, start the programmable timer from 0 and capture(store) the timer's value at the next transition (again the next transistion should allow input ISR service). This value should be the duration where the signal should be at high or low. Do the capturing activities as long as there are signals that is being emmited by the transmitter.
    5. Each of the captured value must be stored in your memory as well as the state, either high or low, of that timer duration it belongs.

    Generating the IR Signal:

    From the database of Captured duration and its corresponding state (high or low), make use of another port as an output where your IR transmitter circuit is interfaced. With the captured value and state pair, emmit the signal information making use of timers, but this time, you must prepare a timer ISR mechanism where you try to control transistions from low to high or high to low.

    Implementation improvement:

    To improve and provide better accuracy on captured duration, I don't know if PIC has the capability or mechanism to automatically capture the timer value that depends on any signal transistion on a specified input (some MCU's has this special feature, i.e. OKI MSM63188A).

    If it doesn't have automatic capture mode, then maybe it is good also to consider the interrupt latency durations whenever you service interrupts and add it on/or subtract it from the timer readings that you get in each capture activity and save the calculated timer value.
     
  3. tigrot

    Thread Starter New Member

    Dec 5, 2004
    2
    0
    Thanks a lot for helping me cyberhehe but the problem is that i am not that fluent in assembly language and so i don't think that i am capable of doing such a thing in assembly.but ironically i have done this in basic language but it isn't working :(

    do you know basic language so as i can send you my program if you don't mind? if yes,can you send me an email on tigrot@onvol.net.

    if you don't know basic language, can you suggest me a good site where i can find some tutorials regarding timers? i have searched the net for a good one, but those that i found where somehow difficult to understand.

    thanks very much
     
  4. cyberhehe

    Well-Known Member

    Oct 6, 2004
    61
    0

    Hi Tigrot,

    Let us do it this way in parallel, don't worry, I can spare some time for this. Send me all those datasheet info about your pics and other stuffs then I can start learning it in parallel. Am flexible in any MCUI platform to use, and it should not be a problem.
     
  5. Perion

    Active Member

    Oct 12, 2004
    43
    1
    I guess if you are just interested in capturing TV Remote IR bursts you could design a simple Ir reciever and connect it to your '877 CCP1 pin. Configure it for input and use use Timer1 configured for capture mode. Then use the CCP module (Capture, Compare, Pwm) for capturing Timer1 values triggered on each rising and falling edge of CCP1 input data (Ir pulse). This is very tricky since you'd have to change modes from rising edge triggered to falling edge triggered on-the-fly and disregard the intial interrupt that gets generated when you do that. Each edge transition should generate a CCP1IF interrupt. In your ISR for that interrupt you'd store the captured timer value (Timer1 is 16 bit) to a table in data memory, clear the interrupt request flag bit, change CCP1 control modes to the other edge transition, disable the interrupt generated by changing modes, then return to polling for the next CCP1 input transition interrupt. At the end you should have a table of timing values that you'd have to manually decode to figure out the particular Ir comm protocol. Maybe there's a less messy way to do it - I dunno. It's what popped into my pee-brain.

    There's some info on the CCP module in the Mid-Range MCU Family Reference Manual - see (Section 14). See also the CCP Module Implementation Guide.

    I never messed with PICBasic - just MPASM - so I probably wouldn't be much help.

    Perion
     
  6. cyberhehe

    Well-Known Member

    Oct 6, 2004
    61
    0
    Exactly as what I have mentioned in my post above, but I would rather have it interrupt driven all through if the PIC has an automatic timer capture mode similar to this MCU:
     
  7. abebts2000

    New Member

    Jul 10, 2007
    1
    0
    I am doing My Final Year Project on Controlling Devices using PC via serial port .ALready I can send the code from serial port and I can Capture it @ the PIC but I can't generate a working remote signal..If U have any Info plz let know..Coz I have left with 1 week for submitting... If I u can also send me the code to be transmitted.. thanks
     
Loading...