NEC protocall decoding with microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by embedtechnology, Jun 23, 2016.

  1. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    Hi every one.
    I want to decode nec code from the remote hand set mentioned the file bellow.
    I experimented on it for months and came to know about it's command code for each key.
    I have mentioned the code I found in my experiment on every key in HEX in the image
    of the hand set but I have doubt whether those are write or wrong. Please any one help me
    to know the truth. Thank you. code.png
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    So what is the vendor code that goes with each key? They might not be the same for all keys. I can't tell you if they are right or wrong, but I can tell you that your information is incomplete. What are you using for a receiver? What are you using for a microcontroller?
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I did something like this a few years back for giggles. I used an IR receiver module (possibly from Radio Shack of all places) to convert the light into digital pulses. Then I used an oscilloscope to get the pattern send for each key.

    Sorry, I kept no notes and have no recollection beyond that, but it's a good general way to get started. Once you know the key codes you can start on some program code to capture the key strokes.

    Ultimately I got the button's name to display on an alphanumeric LCD display. It was one of the few times my techie toys actually impressed my wife.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
  5. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    Thanks a lot ,
    Actually I want this hand set to implement in my project named REMOTE CONTROLLED
    ELECTRIC SWITCH BOARD . It 's a microcontroller based project.I all ready made it
    with RC5 type remote but physical size of RC5 hand sets available in the market are so much
    bigger than that of this tiny hand set. so I am interested to decode it's 32 bit code.I have also
    deep knowledge in nec coding and decoding technology but I don't know the key codes. So
    I experimented with a mic.and 8 leds to it's port With repeated attempt I found those key codes
    that I already printed on each key in previous image. After searching through internet I could not
    find any vendors for this remote because I don't know about the manufacturer .It is not mentioned
    on the device.Normal information on nec key code available in internet are somehow different from one
    another. So I confused. I hope that U understood my problem.
     
  6. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    The remote hand set that I mentioned is coming with china made FM receiver kit which has
    memory chip read facility.
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    What you need to do is read all 32 bits from the remote. What I called a vendor code is also called the ADDRESS field. It's purpose is to expand the set of buttons that can be handled. You would expect the ADDRESS and it's complement to be the first 16 bits, followed by the command and it's complement in the second 16 bits. I did the decoding by using the input capture feature and measuring the period between edges. The IR receiver took care of demodulating the 38 kHz Carrier.
     
  8. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    I know, but I want command code only. I must ignore address code. Capturing 32 bits is
    not my headache. Moreover my headache is what is the command code for each key?.
    Here is an example. In case of a rc5 remote, suppose you press volume+ button on the
    remote hand set, then certainly it will emit 10 hex(16 dec. ,01 0000 bin) as command code along with
    5 bit wide address code. In case of said nec hand set, the width of command code must be 8 bit instead.
    what will be the volume+ command code? and this is my question.
     
  9. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    It should have leading zeros. If it was me I would also decode the address to prevent other remote with different address codes from aliasing for your remote. Ever been in a place with 5 or 6 remotes? It gets a bit chaotic.
     
  10. hexreader

    Active Member

    Apr 16, 2011
    250
    82
    Whilst Sony and RC5 have standard button codes, there is no standard NEC code for vol+ as you seem to think,

    I suspect that your question cannot be answered unless somebody happens to recognise that exact remote (or some kind of equivalent) and happens to have decoded it.

    A scope and logic analyser may be required to give a sure indication of your remote's IR protocol and coding.
     
  11. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    Thank you hexreader, your answer is really satisfied me.I programmed a micro controller
    to decode nec code and after capturing 32 bits, I took up only command and ~ command
    bytes . After comparing the two complementary command byte , I send the final command
    byte to port_1 of the micro controller to which I connected 8 leds. I read the code from the
    bineary bit pattern of that leds. I repeatedly pressed a same button and got same result
    for each press.This test procedure was going on for every key and at last i came to a conclusion.
    Those key codes I printed on every key in the image of my first post. Am I far beyond the real code ?
    or am I little beyond it? or am I at the real code? Tell me please.
     
  12. hexreader

    Active Member

    Apr 16, 2011
    250
    82
    Sounds like you are doing all the right things. My guess is that your key codes are probably correct.

    The fact that no code is repeated is a good sign too.

    I would take it that you have decoded correctly,
     
  13. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    Thank you very much.
     
Loading...