Need help building a simple IR learning remote with a PIC


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    21

    Default Need help building a simple IR learning remote with a PIC

    Can someone please help me get started with this project:

    I need a PIC to be able to learn 6 different IR codes and be able to output them depending on certain conditions. Basically a very small learning remote.

    Thanks for any help.

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Just 6 IR codes eg 6 buttons or 6 IR code sets eg for 6 devices.

    If just 6 buttons do you know in advance what type of IR codes

    eg NEC type, Sony, RC5, RC6 These are the common ones and will cover many items but there are still a lot of codes that do not conform to any of the above.

    Panasonic and JVC use codes that are similar to NEC but have subtle differences however the decoding is basically the same once you account for differnt headers and number of bytes in the codes.

    A bit moe information on exactly what you are trying to achieve would make it easier to answer your question.

    Regards
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    Join Date
    Feb 2006
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Thanks for your reply.

    I just need to transmit about 6 different codes.

    The codes are from a proprietary remote (to control a piece of medical equipment). Presently, I do have the codes learned in my Pronto learning remote.

    I would like to store the codes in the PIC using the DATA statement and transmit any of the codes based on certain external conditions the PIC will detect.

    These are my initial thoughts (please feel free to comment on them):

    Figure out the carrier frequency
    Figure out if the IR code is PWM or simple high & lows

    (I think I can get the above from the Pronto editor, I am trying to find my notes on reading the IR data through the PC software ProntoEdit)

    Store the data in the PIC eg (HEADER PULSE), 2H,3L ....

    AND the output pulses with the original carrier frequency (either produced by an external oscillator, or possibly by the PIC itself (comments please))

    The combined data and carrier would drive a transistor that would be connected to an IR LED.


    Comments, ideas suggestions please.

    Thanks

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    If you can supply the codes in Pronto CCF format I can determine whether they use one of the standard protocols and can probably define them in 3-6 bytes (which will make it easier to store them in EEPROM) and suggest code for playback. All the needed details will be in the CCF codes.

  5. #5
    Join Date
    Feb 2006
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    I was up working on this all night, see what you think.


    Assumptions based on ProntoEdit data:

    The carrier is 40K

    Header code: 4.12ms ON , 3.75ms OFF
    Trailer code1: 11.25ms ON, 3.75ms OFF
    Trailer code2: 11.25ms ON, 90ms OFF

    Data 0 = 1.15ms ON, 6.35ms OFF
    Data 1 = 3.55ms ON, 3.75ms OFF

    Data Stream:
    Header Code - IR data (eg off) 0010 - 0 spacer - Trailer Code1 -
    Header Code - Inverse of IR data (eg 1100) - 1 spacer - Trailer Code2

    I see that the PICs cant output a frequency greater then 32767Hz so I plan on ANDing a 555 output with the data stream. Haven't had a chance to test any of this yet. I am also not sure that my timing is accurate (ms ON, MS off).




    This is the OFF string (from ProntoEdit)
    0000 006b 000c 0000 00a5 0096 002e 00fe 002e 00fe 008e 0096 008e 0096 008e 0096 008e 0096 008e 0096 002e 00fe 002e 00fe 002e 00fe 01c2 0e10

    This is the ON string:
    0000 006b 000c 0000 00a5 0096 002e 00fe 002e 00fe 008e 0096 002e 00fe 008e 0096 008e 0096 008e 0096 002e 00fe 008e 0096 002e 00fe 01c2 0e10

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    I was up working on this all night
    That's a shame. I can analyze any CCF code in a minute or two, including a graph of the code. A graph of the ON code is attached.

    What PIC do you plan to use? It's easy to get higher frequencies using hardware PWM. I do it with a PIC12F683 but you'll probably want more pins. There's an example program on the Reynolds Electronics website. Here's some test code that generates ~120kHz.
    Code:
    DEFINE OSC 8
    @ DEVICE PIC12F683, INTRC_OSC_NOCLKOUT
    @ DEVICE PIC12F683, MCLR_OFF
    
    TRISIO.2 = 0				'GPIO.2=Output
    PR2 = 17			        'PWM Period   117.7kHz
    CCPR1L = 8				'PWM Duty-Cycle  
    'CCP1CON = %00001100  			'PWM Mode
    T2CON = %00000100    			'Timer2=ON, 1:1 prescale
    OSCCON = %01110001                      'INT HF OSC 8MHz
    WHILE OSCCON.3>0: WEND                  'OSC startup timeout
    WHILE OSCCON.2=0: WEND                  'INT HF OSC stable
    'CCP1CON = 0 'PWM module off
    WHILE OSCCON.2>0 
      CCP1CON = %00001100 'PWM ON
      PauseUS 1000        'generate 1ms burst 
      CCP1CON = 0         'PWM OFF
      Low GPIO.2
      Pause 10            'pause 10ms
    WEND
    I get somewhat different values.
    • Carrier=38740
      Lead-in=4.259ms ON, 3.872ms OFF
      1-bit=1.187ms ON, 6.557ms OFF
      0-bit=3.665ms ON, 3.872ms OFF
      Lead-out=11.616ms ON, 92.928ms OFF
    If all codes use the same lead-in & lead-out, the binary codes are 1100 0001 11 and 1101 0001 01 for OFF & ON respectively.
    Attached Images Attached Images  

Similar Threads

  1. remote code learning
    By Bruce in forum Code Examples
    Replies: 20
    Last Post: - 21st February 2021, 15:38
  2. Simple RF remote control code
    By Bruce in forum Code Examples
    Replies: 13
    Last Post: - 22nd January 2014, 10:45
  3. No one-way approach to learning ir remote control frequencies
    By selbstdual in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd June 2007, 13:26
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14
  5. multiplexing IR array into PIC 16C7x
    By droptail in forum General
    Replies: 1
    Last Post: - 17th November 2004, 18:30

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts