Pages: [1]   Go Down
Author Topic: Portable Air Condition - IR problems  (Read 1517 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good Morning All,
    I have been working for a few days on trying to interface my arduino to my portable AC unit in my home office.  The air conditioner in question is

http://www.amazon.com/Soleus-Air-LX-140-Evaporative-Dehumidifier/dp/B000HHJ13I

The AC has an existing remote and I have already use the IR library to steal the codes from existing remote.   I have built a circuit using IR leds from remotes I salvaged as well as 2 brand new IR leds.  I tried with and without a transistor.  I even went as far as to use 2 arduinos and had one as a receiver and the other sending to ensure I am sending the same code as the remote was.   

So far to no avail.   So I am curious.   Has anyone else done any work with building IR transmitters?   Is there something I am missing in the circuit.   Should I be using specific transistors?   Maybe I need to add a cap like some of the TV B Gone projects I have seen.   

Here is the latest code I am using to send. 

Code:

int IRledPin =  3;      // IR emitter LED connected to digital pin 3
int orangeLedPin =  7;  // Orange LED connected to digital pin 7
int buttonPin1 = 4;     // "Send" push-button connected to digital pin 4
int buttonState1 = 0; 

void setup()   {               
  // Initialize the Orange LED pin as an output
  pinMode(orangeLedPin, OUTPUT);     
  // Initialize the "Send" push-button pin as an input
  pinMode(buttonPin1, INPUT);
  // Initialize the IR digital pin as an output
  pinMode(IRledPin, OUTPUT);     
  // Set uart baudrate
  Serial.begin(9600);
}
 
void loop()   {
  // Read the state of the "Send" push-button value
 
 Serial.println("send code");
    SendIRCode();
    //delay(15);  // wait 15 milliseconds before sending it again
    //SendIRCode();  // repeat IR code if it is neccesary
 
    delay(10000);  // wait 5 seconds to resend the code
   
}
 
// This procedure sends a 38KHz pulse to the IRledPin for a certain # of microseconds.
void pulseIR(long microsecs) {
 
  cli();  // Turn off any background interrupts
 
  while (microsecs > 0) {
   // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRledPin, HIGH);  // 3 microseconds
   delayMicroseconds(10);         /* hang out for 10 microseconds,
                                     you can also change this to 9 if its not working */
   digitalWrite(IRledPin, LOW);   // 3 microseconds
   delayMicroseconds(10);         /* hang out for 10 microseconds,
                                     you can also change this to 9 if its not working */
 
   // So 26 microseconds altogether
   microsecs -= 26;
  }
 
  sei();  // Turn them back on
}
 
void SendIRCode() {
cli();
pulseIR(3440);
delayMicroseconds(1620);
pulseIR(480);
delayMicroseconds(1240);
pulseIR(480);
delayMicroseconds(1280);
pulseIR(440);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(420);
pulseIR(480);
delayMicroseconds(420);
pulseIR(460);
delayMicroseconds(1280);
pulseIR(440);
delayMicroseconds(420);
pulseIR(480);
delayMicroseconds(420);
pulseIR(480);
delayMicroseconds(1240);
pulseIR(500);
delayMicroseconds(1240);
pulseIR(460);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(1240);
pulseIR(480);
delayMicroseconds(420);
pulseIR(480);
delayMicroseconds(420);
pulseIR(480);
delayMicroseconds(1240);
pulseIR(480);
delayMicroseconds(1240);
pulseIR(480);
delayMicroseconds(420);
pulseIR(460);
delayMicroseconds(1280);
pulseIR(440);
delayMicroseconds(1240);
pulseIR(500);
delayMicroseconds(420);
pulseIR(460);
delayMicroseconds(420);
pulseIR(460);
delayMicroseconds(440);
pulseIR(440);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(420);
pulseIR(460);
delayMicroseconds(460);
pulseIR(440);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(1260);
pulseIR(460);
delayMicroseconds(1260);
pulseIR(460);
delayMicroseconds(1280);
pulseIR(440);
delayMicroseconds(1280);
pulseIR(460);
delayMicroseconds(1260);
pulseIR(440);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(440);
pulseIR(460);
delayMicroseconds(440);
pulseIR(460);
sei();
}


I am considering getting http://www.cooking-hacks.com/documentation/tutorials/control-hvac-infrared-devices-from-the-internet-with-ir-remote/ since it claims to be for HVAC already but i am not sure if its really any different than what I have already built. 

Thanks
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 147
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I have worked with my AC at home and I found that to send a 38khz signal (with amega 2560), I had to put the IR led on for 8 micros and off for 7 micros ( checked with an oscilloscope)

Are you sure about the pulses sequence ? Only one mistake and nothing happens.

I am using a simple transistor (it is necessary due to the several hundred of mAmps required by the LED)  and IR led with no particular specification. No capacitor in the circuit.

My function for the pulse is (so I have accurate duration of the pusles, and 38 khz frequency)

Code:
void blink(int Micros) {
  unsigned long tstart = micros();
  while (micros() - tstart < Micros) {
    digitalWrite(LEDIR,HIGH);
    delayMicroseconds(8);
    digitalWrite(LEDIR,LOW);
    delayMicroseconds(7);
  }
  digitalWrite(LEDIR,LOW); //just to be sure to have the led off
}
« Last Edit: January 04, 2014, 03:49:40 am by B83s » Logged

Dublin, Ireland
Offline Offline
Sr. Member
****
Karma: 13
Posts: 458
AnalysIR - IR Analyzer & Decoder for Arduino & MCUs
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You will need an oscilloscope, logic analyzer or similar to verify if your modulation is correct (allowing for delays in calling functions etc).

Also, your '50%'-ish duty cycle would be better @ 30->40%.

My advice is to use the RAW facility of IRremote which handles all of this for you when decoding/sending.
Examples are provided in the library.

See this topic on suitable IR receivers for AC, paricularly if they have more than 32 data bits (64 marks/spaces) in the signal
http://www.analysir.com/joomla/IRforum/viewtopic.php?f=5&t=16


Which model of  IR receiver did you use to get the timings for your signal? You may not need to change it!
Logged

Blog: http://www.AnalysIR.com/blog/     Twitter: @AnalysIR
Read => 10 common pitfalls with Infrared Remote Control :  http://bit.ly/1cvd0at

Pages: [1]   Go Up
Jump to: