Page 1 of 2

SAMSUNG remote control decoder

Posted: Mon Sep 21, 2009 6:57 pm
by Spanish_dude
Hi everyone,

I made a SAMSUNG remote control decoder.

First of all I want to say that I only have one SAMSUNG remote control, so I don't know if the program I made is compatible with other SAMSUNG remote controls.
Secondly, I didn't find much info (almost nothing) about the SAMSUNG protocol, so I measured the IR signal of the remote control with a 36kHz IR receiver and a scope and the program is based on the IR signal.

The remote control send a data of. The first half (16 bit) is the address and the second half (16 bit) is the command.

Before it sends the 32 bits, there is a startbit of ~9ms => ~4.5ms low and ~4.5ms high.

Image

The SAMSUNG remote controls uses pulse distance encoding of the bits. Each pulse is ~660Βµs long. A logical "1" takes 2.25ms to transmit, while a logical "0" is only 1.15ms.

The first thing that the microcontroller will do is 'detect' the startbit. To do this, a first loop is executed to detect the first half of the startbit (~4,5ms low) and then a second one will detect the second half of the startbit (~4,5ms).

After the startbit is detected, a third loop is executed to detect the ~660Βµs pulse (logical '0').
If it didn't detect it, nothing happens. If it did detect it, then it will wait until the signal is high.
When it is high, a variable named timer will increase by one every 50Βµs, until the signal is low (= the 660Βµs) again.
If the variable timer is greater than 18, then an array called Address[bit] = '1' else it'll be '0'.
The first time this part of the program is executed the variable bit is = 0.
After that the variable bit will increase by one and the variable timer is reset to 0. This will be done 16 times, so that the microcontroller will save 16 bits in the array Address.

A fourth loop will be executed and will do the same as the third one, but it will 'save' each bit in an array called Command.

Then the saved bits are converted into decimal numbers and then in hexadecimal.
Once that is done, you can read on the LCD the Address and the Command.


It's still on a breadboard, but I made a little circuit that controls to relays and with that remote control decoder and some code added to the program, I can turn two 40W lights on and off using four buttons of the remote control. Two to turn the light on and two to turn them off.
I also added a double electric switch (don't know the right english term ^^), so I can turn the lights on and off with that double switch AND the remote control.

That's it for now, I hope you understood something : D

Nicolas

Re: SAMSUNG remote control decoder

Posted: Fri Feb 05, 2010 6:36 pm
by goblin
Thanks Spanish Dude,
Did you by any change also made a Samsung IR transmitter. Since my Samsung stereo does not have a alarm clock function it would be nice to control it via IR, a RTC and a micro.
But your code is a start.

Re: SAMSUNG remote control decoder

Posted: Wed Mar 17, 2010 7:22 pm
by Spanish_dude
Hi,

First of all, sorry for the late reply.

I think, not really sure about it, that I made a SAMSUNG IR transmitter.
I'll try to find it or re-program it.

Re: SAMSUNG remote control decoder

Posted: Wed Mar 24, 2010 1:04 pm
by Harry Tuttle
Hello,

That looks like NEC Extended Protocol developed by NEC Electronics. I have just made a transmitter to operate the shutter on my camera which is controled by this IR protocol, it took age's to figure it out!!

Have a look at:
http://www.sbprojects.com/knowledge/ir/nec.htm

regards,
ben

Re: SAMSUNG remote control decoder

Posted: Sat Feb 05, 2011 1:34 pm
by goblin
Hello Spanish Dude,
it has been a while, but did you find your Samsung IR transmitter.
regards

Re: SAMSUNG remote control decoder

Posted: Sat Feb 05, 2011 2:44 pm
by Spanish_dude
Hi,

I'm sorry, I totally forgot about that ...

I did find a program for a SAMSUNG IR transmitter somewhere in my files, but I don't remember if I did try it "in real" and if it worked...
I'm using RA0 as output for the IR.

The attached file is what you need !
If you have any problems/questions just ask me.

Re: SAMSUNG remote control decoder

Posted: Sun Feb 06, 2011 8:36 pm
by goblin
thanks dude
i will dive into it this week. let you know if i have any questions

Re: SAMSUNG remote control decoder

Posted: Sun Feb 06, 2011 9:06 pm
by Harry Tuttle

Re: SAMSUNG remote control decoder

Posted: Wed Mar 09, 2011 9:21 pm
by goblin
goblin wrote:thanks dude
i will dive into it this week. let you know if i have any questions
hello again dude
something went wrong during importing to an AVR chip.
would you be so kind to send the c code. and i will try to solve the missing variable
regards

Re: SAMSUNG remote control decoder

Posted: Wed Mar 09, 2011 10:18 pm
by Spanish_dude
goblin wrote: hello again dude
something went wrong during importing to an AVR chip.
would you be so kind to send the c code. and i will try to solve the missing variable
regards
Sure ;)

Re: SAMSUNG remote control decoder

Posted: Tue Apr 12, 2011 7:48 am
by greentech
Hello Spanish,

I have tried to learn your example, but i am unable to understand how i will do this via an analogue input method, rather than serial data.

the remote i am working on is Sony RMT-CY3A i have captured its modulation for reference. Hope you can explain. :)

Re: SAMSUNG remote control decoder

Posted: Tue Apr 12, 2011 7:48 am
by greentech
Hello Spanish,

I have tried to learn your example, but i am unable to understand how i will do this via an analogue input method, rather than serial data.

the remote i am working on is Sony RMT-CY3A i have captured its modulation for reference. Hope you can explain. :)

Re: SAMSUNG remote control decoder

Posted: Tue Apr 12, 2011 1:45 pm
by Spanish_dude
The only experience I have with IR protocols is this samsung IR remote control.
Try to search on google some info about your remote controls protocol.

Seems like your remote uses this protocol : http://www.sbprojects.com/knowledge/ir/sirc.htm

cheers,

Nicolas

Sony remote control decoder

Posted: Fri Apr 15, 2011 5:04 pm
by greentech
Please some one help me with Sony Cy3a Remote. I am trying to decode but all goes invain.... :? .

please gimme some :idea:

Re: SAMSUNG remote control decoder

Posted: Fri Apr 15, 2011 9:27 pm
by greentech
what i am not getting is:

How to detect the start pulse which is for about 4.2 ms..

and secondly how to store address and command & then how will a detect the whole code all over again.. if i keep pressing the remote button the pulse repeats after about 21ms

i am driving the pic micro at 4Mhz

Re: SAMSUNG remote control decoder

Posted: Sat Apr 16, 2011 1:27 pm
by Spanish_dude
Hi,

Look how I have made my decoder, that should be enough to help you ;)

Check your input, if it's low, check if it's low for 4.2 ms, then do the same for the data that's being received. That's it.

Sony remote control decoder

Posted: Sat Apr 16, 2011 3:20 pm
by greentech
i tried but all invain, i keep on getting different hex values each time if i keep pressing the button.

Re: SAMSUNG remote control decoder

Posted: Mon Apr 18, 2011 5:35 pm
by Spanish_dude
From your oscilloscope picture your signal is high, when nothing is received.

Let's assume you're using RB0 as input.

From what you said, the start pulse is a 4.2ms low pulse.
To check if you are receiving some data, you'll need to check the 4.2ms pulse.
So first thing to do is wait until you receive that 4.2ms start pulse.

Code: Select all

char counter = 0; // this is a counter used for the 4.2ms pulse

while(1)
{
    RB_0 = PORTB & 0x01; // read RB0

    if (RB_0 == 0) // if RB0 is low
    {
        delay_us(100); // delay for 100 µs
        counter = counter + 1; // increment counter with 1

        // 100µs * counter is the time the input RB0 is low
        if (counter >= 40) // if the counter is 40 or higher (40 * 100µs = 4ms)
            break; // exit loop
    }
    else
        counter = 0; // else reset counter
}
Once the program exit this loop, you'll be receiving data. Don't forget that after each low pulse you're receiving a high pulse of 600µs (?).
This data needs to be "decoded" the same way I did with the start pulse.

I'll let you try to decode the data.
If you still have problems I'll show you how to do it, but you'll see that it's pretty easy to do !

(Of course we are not using any interrupts here, but you could use one)

remote control decoder

Posted: Tue Apr 19, 2011 6:24 am
by greentech
Billion Thanks for replying brother....Ill give it a try and let you know the latest.

Best Regards.....& may Fate always shine on u.

Sony IR decoder

Posted: Tue Apr 19, 2011 3:16 pm
by greentech
Finding the start pulse took alot of time, finally i have done it according to your advice. You are good in it.

I am now trying to decode the data but not really getting how to go by 600us pulses..... there is also a 1200us low pulse in the data.

Plz shed some light on this :idea:

Re: SAMSUNG remote control decoder

Posted: Tue Apr 19, 2011 4:35 pm
by Spanish_dude
Hi,

I made this little program, I haven't tested it, but I think it should work.
Simulation won't work as I'm using C code.

Sony IR decoder

Posted: Tue Apr 19, 2011 6:34 pm
by greentech
Thanks alot brother...

ill try understand it and then get back to u.
:) Million thanks again.....

Sony Cmy3a emote control decoder

Posted: Fri Apr 22, 2011 8:08 pm
by greentech
Brother, i tried to understand the code which u sent. It is functioning also.. but some times the variables change. Specially there are three buttons when i press then they bring different variable onto the lcd.

1- power button brings up Address =4 command = 21 but this differs.
2- forward button also brings on command and adress.
3- the stop button is also doing the same thing. all other buttons are functioning well..

could it be the problem with my hardware?

i am using sharp infrared receiver with no resistors and capacitors. +ve is hooked up to +5V, -ve is to ground. and tx straight to rb6 input to pic.

please guide.

Best regards.

Re: SAMSUNG remote control decoder

Posted: Fri Apr 22, 2011 9:45 pm
by Spanish_dude
Hi,

In this post : http://www.matrixmultimedia.com/mmforum ... red#p13641
The member used a pull-up resistor, so you could try that ?

Also, try to check the signal of the power, forward and stop button. Check if those are changing (I doubt they are).

I can't help more than that, try to play with the program and see if you can get it to work 100%.

Re: SAMSUNG remote control decoder

Posted: Tue May 17, 2011 11:06 am
by greentech
it works. Thankyou very much for your assistance. I really appreciate it bro. please send me your address i would love to send u some gifts......:)