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](http://img16.imageshack.us/img16/590/sanstitreqv.png)
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