building infra red remote control switch

Discussion in 'Embedded Systems and Microcontrollers' started by 4EverYoungs.71, Jun 4, 2014.

  1. 4EverYoungs.71

    Thread Starter New Member

    Jun 4, 2014
    4
    0
    Hi everybody
    I'm new friend on this usefull forum and also very beginner on microcontroller hardware and programming so pls help.
    I want to build a remote control switch cct using 16F84A,i understand the backbone of the circuit,except one thing,

    what's the content of the remote control transmitted signal ?
    how to decode and encode the signal of the remote control?
    how to distinguish between the different pressed buttons?

    thanks in advance.
     
  2. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    IR remotes typically work by sending bursts of 38KHz. There are receivers for this that are very good. A transmitters is just an IR LED pulsed by your microcontroller, fairly high power is good. There are many protocols for coding the functions. Typically they consists of a sequence of long and short bursts to encode a number. You can find lots of info online about these codes.

    I am currently working on an IR interrupter alarm that uses these components:

    IR dectector TSOP2438
    IR led TSAL7200

    This combination is so sensitive that you practically have to totally enclose the LED in order for it not to be detected, you can point it an any direction and it will still be seen by reflection. I wanted to use these because my interrupter needs to work in sunlight, so a simple IR on / off detection would be impossible.

    Bob
     
  3. pwdixon

    Member

    Oct 11, 2012
    488
    56
    There are a number of different formats, all created by various manufacturers of tv's etc. You will need to google the particular format that you want to work on.

    You will also find it much easier to encode a signal and transmit rather than receive and decode, especially with a limited PIC processor. You might be able to find example circuits and code online that will either do what you want or at least guide you towards a solution.
     
  4. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,343
  5. 4EverYoungs.71

    Thread Starter New Member

    Jun 4, 2014
    4
    0
    Thanks for all of u my friends and thanks for the links,
    but i need more details from "pwdixon" u said "You will also find it much easier to encode a signal and transmit rather than receive and decode",

    do u mean i create custom format for my own and let the processor send it via IR led and at the receiver cct i check the received signal to distinguish between different buttons
     
  6. hexreader

    Active Member

    Apr 16, 2011
    249
    82
    I have a finished project that may do all that you want.

    ... but I will not give you the link unless you ask, as it will leave nothing for you to do, and may take all the fun away.

    Let me know if you want the finished project.

    Is this a school project? or a home hobby project?

    I have used Sony IR protocol, which is the simplest common protocol, as explained here:
    http://www.sbprojects.com/knowledge/ir/sirc.php
    Other protocols and basic operation is described very well elsewhere in the site.
     
    Last edited: Jun 6, 2014
  7. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    I would like to see your project, Hexreader.

    I just posted an SIRC Decoder Demo on another forum yesterday.

    Cheerful regards, Mike

    [​IMG]
     
    Last edited: Jun 6, 2014
    absf and micropad like this.
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I bought a bag of 5 ebay remotes, very cheap.

    They use a common format sending a start bit and then 4 bytes;
    byte1 = device code (usually 00)
    byte2 = device code inverted (FF)
    byte3 = key code
    byte4 = key code inverted

    (edit; has been corrected) :)
     
    Last edited: Jun 7, 2014
  9. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Got a link, Roman? I suspect a number of us might be interested. Thanks.
     
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I'm not sure if this is the same seller I bought from before, but it is the same remote. I bought a bag of 5;

    [​IMG]
    http://www.ebay.com/itm/HX1838-Infr...nfrared-Remote-Control-NEC-Code-/251539222962

    The one above is $2.82 with the receiver module included.

    Without the receiver the remote is $1.72.

    I can post a screen capture from my IR sniffer software if you like, that will show the data pulses and format.
    :)

    (edit) After seeing my screenshot again I realised I wrote the data bytes in the wrong sequence in my previous post. Sorry!
     
    Last edited: Jun 7, 2014
    MMcLaren, absf and djsfantasi like this.
  11. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Here's the screen capture.

    The waveform is shown as active high (HI = IR carrier) so you need to invert it as the IR sensor goes LO when it detects carrier.
     
  12. micropad

    Member

    Dec 24, 2011
    38
    0
    Can you please explain this area
    Code ( (Unknown Language)):
    1.  
    2. movf    TMR0,W          ; pulse lo time (64-us ticks)     |B0
    3.         addlw   -(2600/64+1)    ; test for ~2400 ± 200 usecs      |B0
    4.         addlw   400/64+1        ; C=1 (2200..2600 usec range)?    |B0
    5.         skpc                    ; yes, skip (in range), else      |B0
    6.         goto    irloop          ; branch (abort & start over)     |B0
    7.  
    8.  
     
  13. 4EverYoungs.71

    Thread Starter New Member

    Jun 4, 2014
    4
    0
    Thank u Hexreader,
    if i fail to do it, i will tell u to kindly show me your project, and want to let u know that my project is a home hobby project.
     
  14. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    I've been looking for something exactly like that and in that price range but I guess I wasn't using the right search terms.

    Thank you, Roman. I really appreciate it.

    Regards, Mike
     
  15. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    No probs. :)

    It's actually a pretty good way to get a keypad on a project. For the pin cost of 1 input pin, and parts cost of a cheap IR sensor, you get a 21 key keypad (that can be used from across the room).

    For years I've been using 12 key keypads that cost $15 and need 8 pins to connect.

    One thing I tried that worked really well was to receive and decode the IR pulses in a timer interrupt which runs a few times faster than the pulse period. The int decodes and error checks the IR data, and if all is good it just outputs a single byte for the pressed key (and 0 for no_key).

    So the IR is handled totally automatically and all the other code needs to do is check that one byte to see if a key has been pressed.

    Someone of your ability could whip that up in assembler pretty easily.
     
  16. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    That's exactly what I had in mind. It's a 1-pin keypad solution for $1.75... Nice!

    I've decoded SIRC at 100-usec interrupt intervals in the past and it worked well, taking only a handful of instructions. I've never done NEC protocol though.

    Thanks again... Mike
     
  17. hexreader

    Active Member

    Apr 16, 2011
    249
    82
    Last edited: Jun 24, 2014
Loading...