Go Down

Topic: Unable to control Air conditioner using Arduino (Read 281 times) previous topic - next topic

AshwiniGunjal

I trying to control  my office AC using Arduino. In this project I am using IR LED to send hex code to AC.
my office have 4 AC, 2 is cruise 1 samsung 1 lloyd. I am success controlling cruise and samsung AC but I am
unable control lloyd AC.
I have done following step:
1) Reverse engineering to read remote  IR code
I am using following code to remote raw code

<code>

#include <IRremote.h>

int RECV_PIN = 11;
int a[300];

IRrecv irrecv(RECV_PIN);
decode_results results;


 
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(8,OUTPUT);
}

// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
//  decode_results *results = (decode_results *)v


void dump(decode_results *results) {
  int count = results->rawlen;
  if (results->decode_type == UNKNOWN) {
    Serial.print("Unknown encoding: ");
  }
    else if (results->decode_type == NEC) {
    Serial.print("Decoded NEC: ");
  }
  else if (results->decode_type == SONY) {
    Serial.print("Decoded SONY: ");
  }
  else if (results->decode_type == RC5) {
    Serial.print("Decoded RC5: ");
  }
  else if (results->decode_type == RC6) {
    Serial.print("Decoded RC6: ");
  }

  else if (results->decode_type == JVC) {
    Serial.print("Decoded JVC: ");
  }
  else if (results->decode_type == PANASONIC) {
    Serial.print("Decoded Panasonic: ");
  }
  Serial.print(results->value, HEX);
  Serial.print("(");
  Serial.print(results->bits, DEC);
  Serial.println(" bits)");
  Serial.print("#define Something_DEC ");
  Serial.println(results->value, DEC);
  Serial.print("#define Something_HEX ");
  Serial.println(results->value, HEX);
  Serial.print("Raw (");
  Serial.print(count, DEC);
  Serial.print("): ");
  for (int i = 0; i < count; i++) {
    if ((i % 2) == 1) {
      Serial.print(results->rawbuf*USECPERTICK, DEC);
      a=(results->rawbuf*USECPERTICK);
      digitalWrite(8,HIGH);
      delay(10);
      digitalWrite(8,LOW);
      delay(10);
    }
    else {
      Serial.print(-(int)results->rawbuf*USECPERTICK, DEC);
     a=(results->rawbuf*USECPERTICK);
      digitalWrite(8,HIGH);
      delay(10);
      digitalWrite(8,LOW);
      delay(10);
    }
    Serial.print(" ");
 
  }

  Serial.println("");
  int len=0;
  for (int j=0;j<count;j++){
    Serial.print(a[j]);
    Serial.print(",");
    len++;
  }

  for (int j=0;j<count-1;j++){
        a[j]=a[j+1];
     }
     Serial.println();
Serial.println("******************");
  for (int j=0;j<count-1;j++){
    Serial.print(a[j]);
    Serial.print(",");
     }
     Serial.println();
Serial.println("*******************");
}

void loop() {
  if (irrecv.decode(&results)) {
    dump(&results);
    irrecv.resume(); // Receive the next value
  }
}




</code>


for cruise and samsung AC  I receive 32bit and 64 bit hex and row code.
but lloyd AC I get following:

FFFFFFFF(0 bits)
#define Something_DEC 4294967295
#define Something_HEX FFFFFFFF
Raw (194): -7300 600 -1550 650 -1550 550 -1650 550 -1600 550 -1650 550 -1600 600 -1600 500 -1650 600 -550 550 -550 500 -600 600 -550 600 -500 550 -600 550 -550 600 -500 550 -1650 550 -1600 550 -1650 550 -1600 600 -1600 500 -1650 600 -1600 550 -1600 550 -600 550 -550 600 -500 550 -600 550 -550 600 -500 600 -550 550 -550 600 -1550 550 -1650 600 -1600 550 -1600 500 -1700 550 -1600 600 -1550 550 -1650 600 -550 550 -550 500 -600 600 -550 550 -550 550 -550 550 -600 550 -550 550 -1600 600 -1600 600 -1550 550 -1650 600 -1600 550 -1600 500 -1700 550 -1600 550 -550 600 -550 550 -550 500 -600 600 -550 600 -500 550 -600 550 -550 600 -500 550 -600 550 -1600 550 -550 550 -1650 600 -500 550 -1650 550 -1600 600 -1600 500 -1650 600 -500 600 -1600 600 -550 550 -1600 500 -600 600 -550 550 -550 500 -1700 550 -550 550 -1600 550 -600 550 -1600 600 -550 550 -550 600 -1550 550 -600 550 -1650 550 -550 500 -1650 600 -500 600 -1600 600 -1600 550
7300,600,1550,650,1550,550,1650,550,1600,550,1650,550,1600,600,1600,500,1650,600,550,550,550,500,600,600,550,600,500,550,600,550,550,600,500,550,1650,550,1600,550,1650,550,1600,600,1600,500,1650,600,1600,550,1600,550,600,550,550,600,500,550,600,550,550,600,500,600,550,550,550,600,1550,550,1650,600,1600,550,1600,500,1700,550,1600,600,1550,550,1650,600,550,550,550,500,600,600,550,550,550,550,550,550,600,550,550,550,1600,600,1600,600,1550,550,1650,600,1600,550,1600,500,1700,550,1600,550,550,600,550,550,550,500,600,600,550,600,500,550,600,550,550,600,500,550,600,550,1600,550,550,550,1650,600,500,550,1650,550,1600,600,1600,500,1650,600,500,600,1600,600,550,550,1600,500,600,600,550,550,550,500,1700,550,550,550,1600,550,600,550,1600,600,550,550,550,600,1550,550,600,550,1650,550,550,500,1650,600,500,600,1600,600,1600,550,
******************
600,1550,650,1550,550,1650,550,1600,550,1650,550,1600,600,1600,500,1650,600,550,550,550,500,600,600,550,600,500,550,600,550,550,600,500,550,1650,550,1600,550,1650,550,1600,600,1600,500,1650,600,1600,550,1600,550,600,550,550,600,500,550,600,550,550,600,500,600,550,550,550,600,1550,550,1650,600,1600,550,1600,500,1700,550,1600,600,1550,550,1650,600,550,550,550,500,600,600,550,550,550,550,550,550,600,550,550,550,1600,600,1600,600,1550,550,1650,600,1600,550,1600,500,1700,550,1600,550,550,600,550,550,550,500,600,600,550,600,500,550,600,550,550,600,500,550,600,550,1600,550,550,550,1650,600,500,550,1650,550,1600,600,1600,500,1650,600,500,600,1600,600,550,550,1600,500,600,600,550,550,550,500,1700,550,550,550,1600,550,600,550,1600,600,550,550,550,600,1550,550,600,550,1650,550,550,500,1650,600,500,600,1600,600,1600,550,
*******************

here I get
FFFFFFFF(0 bits) like this.

______________________________________________________________________________________


I used following  code to send Raw data to AC:

<code>
#include <IRremote.h>

IRsend irsend;  // An IR LED is controlled by GPIO pin 4 (D2)



unsigned t20[]={650,1550,550,1650,600,1550,600,1550,550,1650,600,1550,650,1550,500,1700,600,500,600,500,600,550,600,500,600,500,650,500,550,550,600,500,650,1550,500,1650,650,1550,600,1550,550,1650,600,1550,650,1550,600,1550,650,500,600,500,600,500,650,500,600,500,600,550,600,500,600,500,650,1550,600,500,600,1550,650,1550,600,1600,600,1550,650,1550,550,1600,600,500,650,1550,500,600,650,450,650,500,500,600,650,500,600,500,600,1600,600,500,600,1550,650,1550,600,1600,600,1550,600,1550,650,1550,600,500,650,1550,600,500,650,450,650,500,500,600,650,500,600,500,600,1550,650,1550,600,500,650,1550,600,1600,600,500,600,1550,600,1600,600,500,600,500,650,1550,600,500,650,500,600,1550,600,500,650,500,600,500,650,1550,600,500,650,1550,600,500,600,1550,650,500,600,500,650,1500,650,500,550,1650,600,500,600,1550,550,600,600,1550,650,1550,500};
unsigned t21[]={600,1550,650,1550,500,1700,600,1550,600,1550,600,1600,600,1550,650,1550,550,550,650,500,600,500,550,550,650,500,600,500,600,500,650,500,600,1550,650,1550,600,1550,650,1550,600,1550,650,1550,600,1550,600,1600,600,500,650,450,600,550,600,500,650,500,600,500,600,500,650,500,600,1550,550,600,600,1550,650,1550,500,1650,600,1550,650,1550,550,1650,600,500,600,1550,550,600,600,500,650,450,550,600,600,500,650,500,550,1600,600,550,600,1550,600,1550,650,1550,600,1550,600,1600,600,1600,600,500,600,1550,650,500,600,500,600,500,650,500,600,500,600,500,600,550,600,1550,650,500,500,1650,650,1550,600,500,550,1650,600,1550,650,1550,550,550,600,1600,600,500,500,600,600,1600,600,500,600,500,650,500,600,1550,650,500,600,1550,600,500,650,1550,600,500,650,500,600,1550,600,550,600,1550,600,500,650,1550,600,500,650,1550,550,1600,650};


void setup() {
 
  Serial.begin(115200);
 // Serial.begin(9600);
 pinMode(led,OUTPUT);
}


void loop() {
  // put your main code here, to run repeatedly:


  irsend.sendRaw(t20, sizeof(t20)/sizeof(int), 38);  // Send a raw data capture at 38kHz.
  delay(2000);

 
  irsend.sendRaw(t21, sizeof(t21)/sizeof(int), 38);  // Send a raw data capture at 38kHz
  delay(2000);

}
</code>

I am unable to control Air conditioner.please help me to solve my problem . If I give incomplete information then please mention in comment.
Thank you.




Go Up