Hi, I have been trying to control my samsung television using arduino.. so I wrote a program to decode the protocol according to the application note from samsung..
Application note: http://www.samsung.com/global/business/semiconductor/products/microcontrollers/downloads/S3F80KB_RemoteController_AN_REV000_090108.pdf
the decoding part was pretty easy.. i got the address and data bits from my remote.. then, i tried to program an IR transmitter.. reverse engineering... I guess the logic is correct because when i transmitted the power key data from one board(tx), i got the same data on another board(rx), as i got from my tv remote.. but when is used it on my tv it didnt work...
if there is someone who has worked with samsung remote protocols, help me out..
here go the codes of receiver and transmitter
Receiver:
/*
This sketch reads info from a samsung remote..
and the address and data are extracted
*/
#define tsop_pin 15
#define led_pin 13
void setup()
{
 Serial.begin(9600);
 pinMode(tsop_pin,INPUT);
 pinMode(led_pin,OUTPUT);
}
void loop()
 {
 boolean bin[32];          //boolean consumes less space
 int addr=0, data=0;
Â
 while(pulseIn(tsop_pin,LOW)<4000); //wait for start bit
 digitalWrite(led_pin,HIGH);        //turn on an led
 for(int i=0; i<32; i++)
 {
  if(pulseIn(tsop_pin,HIGH)>1000) //store binary values
   bin[i]=1;
  else
   bin[i]=0;
 }
 Serial.print("Bit Stream = ");
 for(int i=0;i<32;i++)      //print bit stream
 {
  Serial.print(bin[i],BIN);
 }
 Serial.println();
Â
 Serial.print("Address = ");
 for(int i=0;i<8;i++)      //extract addr bits
 {
  Serial.print(bin[i],BIN);
  if(bin[i]==1)
   addr+=1<<i;
 }
 Serial.print(" ");
 Serial.println(addr);
Â
Â
 Serial.print("Data = ");
 for(int i=0;i<8;i++)      //extract data bits
 {
  Serial.print(bin[i+16],BIN);
  if(bin[i+16]==1)
   data+=1<<i;
 }
 Serial.print(" ");
 Serial.println(data);
 Serial.println();
Â
 delay(50);           //some time to breathe ;)
 digitalWrite(led_pin,LOW);   //turn off the led
}
Transmitter:
`#define ir_led 14
int address = 7;
int data = 2;Â Â Â Â //2 = power button
boolean bin[8],Data[32];
void setup()
{
 Serial.begin(9600);
 pinMode(ir_led,OUTPUT);
 pinMode(7,INPUT);    //a toggle switch
 digitalWrite(7,HIGH);
Â
 dec_to_bin(address);   //convert the address into binary
 for(int i=0;i<8;i++)
 {
  Data[i]=bin[i];
  Data[i+8]=bin[i];
 }
}
void loop()
{
 if(digitalRead(7)==0)  //transmit data when a swtich is pressed
 {
  data=2;
  dec_to_bin(data);   //convert data into binary
  for(int i=0;i<8;i++)
  {
   Data[i+16]=bin[i];
   Data[i+24]=!bin[i];
  }
/*Â for(int i=0;i<32;i++)
 {
  Serial.print(Data[i],BIN);
 }
 Serial.println();
*/
Â
  transmit();     //transmit
  delay(54);
 }
}
void dec_to_bin(int dec)
{
 for(int i=0;i<8;i++)
 {
  bin[i]=dec%2;
  dec=dec/2;
 }
}
void transmit()Â Â Â Â Â Â Â Â Â //carrier = 37.9 KHz
{
 burst(173);          // start bit = 4500/26=170
 digitalWrite(ir_led,LOW);
 delayMicroseconds(4500);   //start bit
 for(int i=0;i<32;i++)
 {
  if(Data[i]==1)
  {
   burst(22);
   digitalWrite(ir_led,LOW);
   delayMicroseconds(1690);   //high bit
  }
  else
  {
   burst(22);
   digitalWrite(ir_led,LOW);
   delayMicroseconds(560);   //low bit
  }
 }
 burst(22);
 digitalWrite(ir_led,LOW);    //stop bit
 delayMicroseconds(560);  Â
}
void burst(int pulses)
{
 for(int i=0;i<pulses; i++)
 {
  digitalWrite(ir_led,1);
  delayMicroseconds(9);
  digitalWrite(ir_led,0);
  delayMicroseconds(17);
 }
}