Air Conditioner IR Controller

Hello,

I am new here, so go easy :slight_smile:.

I wanted to build an air conditioner IR controller, and wanted help if figuring out if I can use the Wio Link and Grove components to make this work?
The first phase would be to control the A/C to switch between COOL and FAN based on temperature. Future phases will include using my phone when away from the house to turn on A/C, and other ideas.

Components I think I would need:

  • Wio Link
  • Grove - Temp&Humi Sensor SKU: 101020011
  • Grove - Infrared Receiver SKU: 101020016
  • Grove - Infrared Emitter SKU: 101020026

The steps:

  1. record from my existing remote the commands I would like to transmit to the A/C: Off, Fan, Cool.
  2. code a solution that will read the temperature and based on the result transmit the correct IR.

My questions:
1 can this be done?
2 do I have the correct list of components?
3 can I use IFTTT ? or should I code a server ?

Any and all help welcome, Thanks

Is a great project. I have often thought about why smart thermostats don’t come with an IR blaster for window units.

Your part list looks ok to me.

You can probably get it working with basic commands from IFTTT. For more control, you’ll want a server.

Alternately, you can use the “advanced user guide” to reprogram the wio link to remove the need for a server.

Great, how do I go about recording IR / playing back IR. Is there documentation?

The IR modules were not on the original list of compatible grove modules. So you won’t find much for wio link specific instructions.
seeedstudio.com/wiki/Grove_- … d_Receiver

I can tell you how it “should” work.

  • Connect the IR receiver to any digital port connector
  • Load up your wio link app on your smartphone,
  • tap the corresponding port connector
  • scroll down to find and select the infrared receiver device
  • Update the firmware
  • Press the API button. You should then see some demo server commands.
  • Use the GET to read an IR number

Thanks, I appreciate the advice.

I would like to have someone confirm that this will work - anyone from the Wio team can comment?

Hi joshuaguedalia! I’m one member of the Wio team.The advice wassabi gave you is quite useful! Thanks wassabi :smiley: !

Since you are a new learner, I suggest you start with IFTTT , work with some basic function.

If you want to try further experiment, you can try the advanced user guide of wio link. Meanwhile you may encounter serveral issues, and you can ask us in this forum any time! We will answer your question as soon as possible! :slight_smile:

I managed to do exactly what are you intending, but with an arduino. The most problematic part was about getting the IR codes from the remote. The Carrier unit I have at home uses very long ir commands (somewhat non-standard, twice the usual lenght) so I made an specific software to get them from the remote and dump the timings on screen. I haven’t managed to change the timings into hexadecimal codings, so I sent then to the AC unit replicating the timings. I fiddle on the Wio Link today and sought it ask for hexa. I don’t know if it is possible to convert the timings into hexa (non-standard) and I don’t know if it would receive the very long commands of AC control. Maybe it will require some aditional coding into the IR drive on Wio…

Thanks for the information.

It sounds like you were successful with the arduino - do you have any code you can share, or specific details describing the process?

If I understand correctly, you are working on deciphering the IR code - that is why you wanted the HEX - correct?

For my project, at this phase, I do not need to decipher the code, just play it back exactly as transmitted.

Are you successful with the Wio to capture and transmit the IR code?

I just received Wio Link. Didn’t try it yet (else from the trivial). I used 1 software for arduino to receive the IR codes, which I saved from serialMonitor into a txt file. Afterwards, in another sketch I use the acquired IR codes (in timings format, not Hex). I think this sounds exactly the same you want to do, but with wio… Here goes the code for reading the on-off timings on arduino (I used the code from AnalysIR ):

[code]/*
Author: AnalysIR
Revision: 1.0

This code is provided to overcome an issue with Arduino IR libraries
It allows you to capture raw timings for signals longer than 255 marks & spaces.
Typical use case is for long Air conditioner signals.

You can use the output to plug back into IRremote, to resend the signal.

This Software was written by AnalysIR.

Usage: Free to use, subject to conditions posted on blog below.
Please credit AnalysIR and provide a link to our website/blog, where possible.

Copyright AnalysIR 2014

Please refer to the blog posting for conditions associated with use.
http://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino/

Connections:
IR Receiver Arduino
V+ -> +5v
GND -> GND
Signal Out -> Digital Pin 2
(If using a 3V Arduino, you may connect V+ to +3V)
*/

#define LEDPIN 13
//you may increase this value on Arduinos with greater than 2k SRAM
#define maxLen 800

volatile unsigned int irBuffer[maxLen]; //stores timings - volatile because changed by ISR
volatile unsigned int x = 0; //Pointer thru irBuffer - volatile because changed by ISR

void setup() {
Serial.begin(9600); //change BAUD rate as required
attachInterrupt(0, rxIR_Interrupt_Handler, CHANGE);//set up ISR for receiving IR signal
}

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

Serial.println(F(“Press the button on the remote now - once only”));
delay(5000); // pause 5 secs
if (x) { //if a signal is captured
digitalWrite(LEDPIN, HIGH);//visual indicator that signal received
Serial.println();
Serial.print(F(“Raw: (”)); //dump raw header format - for library
Serial.print((x - 1));
Serial.print(F(") “));
detachInterrupt(0);//stop interrupts & capture until finshed here
for (int i = 1; i < x; i++) { //now dump the times
if (!(i & 0x1)) Serial.print(F(”"));
Serial.print(irBuffer[i] - irBuffer[i - 1]);
Serial.print(F(", "));
}
x = 0;
Serial.println();
Serial.println();
digitalWrite(LEDPIN, LOW);//end of visual indicator, for this time
attachInterrupt(0, rxIR_Interrupt_Handler, CHANGE);//re-enable ISR for receiving IR signal
}

}

void rxIR_Interrupt_Handler() {
if (x > maxLen) return; //ignore if irBuffer is already full
irBuffer[x++] = micros(); //just continually record the time-stamp of signal transitions

}[/code]

And here goes the code to read the temperature and send commands to Carrier AC, using the txt-saved timing codes. It checks the temperature once every 60 secs, and if it is too high, it sends the on-command. If it is too low, it sends the off-command:

[code]#include “DHT.h”
#include “IRremote.h”

#define DHTPIN A0 // pino umidade e temperatura

// Grove DHT11
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);
IRsend irsend;

int khz=38; //Frequencia IR

unsigned t_off[] = {4440, 4400, 560, 1632, 556, 544, 556, 1640, 560, 1632, 556, 544, 556, 544, 568, 1624, 564, 536, 564, 540, 560, 1636, 564, 536, 564, 536, 560, 1632, 560, 1632, 564, 536, 564, 1632, 560, 544, 564, 1628, 560, 1632, 560, 1632, 556, 1632, 568, 532, 568, 1628, 560, 1636, 564, 1632, 564, 536, 564, 536, 564, 536, 564, 536, 564, 1628, 560, 540, 560, 544, 564, 1632, 560, 1632, 564, 1628, 564, 536, 564, 536, 564, 536, 560, 540, 560, 544, 556, 544, 568, 532, 564, 540, 564, 1632, 564, 1628, 560, 1632, 560, 1628, 560, 1636, 564, 5252, 4436, 4396, 564, 1628, 564, 536, 560, 1636, 564, 1624, 568, 532, 564, 536, 564, 1628, 564, 540, 560, 540, 568, 1628, 560, 540, 560, 544, 556, 1632, 568, 1624, 564, 536, 564, 1632, 568, 536, 564, 1628, 560, 1632, 568, 1624, 564, 1628, 560, 540, 560, 1636, 564, 1628, 560, 1640, 560, 540, 560, 540, 588, 512, 588, 512, 588, 1604, 584, 516, 584, 516, 596, 1604, 596, 1596, 560, 1632, 560, 540, 556, 544, 588, 512, 588, 512, 588, 512, 596, 508, 592, 508, 592, 508, 592, 1604, 564, 1628, 560, 1632, 556, 1636, 564, 1632, 608};
unsigned t_on[] = {4436, 4388, 568, 1624, 564, 536, 564, 1632, 568, 1624, 564, 536, 564, 540, 556, 1636, 564, 536, 564, 540, 560, 1636, 564, 536, 564, 536, 560, 1632, 560, 1632, 568, 532, 564, 1636, 564, 536, 564, 536, 564, 536, 564, 1628, 560, 1632, 568, 1624, 564, 1628, 564, 1656, 540, 1632, 568, 1624, 564, 1628, 560, 540, 560, 540, 560, 544, 556, 544, 564, 536, 564, 1632, 560, 1632, 564, 536, 564, 536, 564, 1628, 560, 540, 560, 540, 560, 544, 568, 532, 564, 540, 560, 1632, 560, 1632, 564, 536, 564, 1632, 560, 1632, 564, 1628, 564, 5228, 4440, 4396, 564, 1628, 564, 536, 560, 1636, 564, 1628, 564, 536, 560, 540, 560, 1632, 568, 536, 564, 540, 560, 1636, 564, 536, 560, 540, 560, 1632, 560, 1632, 564, 536, 564, 1636, 564, 540, 560, 540, 560, 540, 560, 1632, 564, 1628, 564, 1628, 560, 1632, 556, 1640, 560, 1636, 564, 1628, 560, 1632, 556, 544, 568, 532, 596, 504, 596, 504, 596, 508, 592, 1604, 592, 1600, 560, 540, 560, 540, 588, 1604, 568, 532, 588, 512, 588, 516, 592, 512, 588, 508, 592, 1604, 564, 1628, 560, 540, 560, 1636, 564, 1628, 560, 1636, 564};

int contador = 0;

int TMIN = 23;
int TMAX = 25;
void setup()
{
Serial.begin(9600);
Serial.println(“Controle de Temperatura Carrier”);

dht.begin();

}

void loop()
{
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to A0 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h))
{
    Serial.println("Failed to read from DHT");
}
else
{
    Serial.print("umidade: ");
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("temperatura: ");
    Serial.print(t);
    Serial.println(" *C");
    if (t<TMIN && contador < 1){
       Serial.print("Desligando... ");
       irsend.sendRaw(t_off, sizeof(t_off)/sizeof(int), khz);
       contador = 15;
    }
    
    if (t>TMAX && contador < 1){
       Serial.print("Ligando... ");
       irsend.sendRaw(t_on, sizeof(t_on)/sizeof(int), khz);
       delay(10000);
       contador = 15;
    }
    
    if (contador>0){
      contador--;
    }
    
    delay(10000);
    delay(10000);
    delay(10000);
    delay(10000);
    delay(10000);
    delay(10000);

}

}[/code]

Thanks erdtmann, I am currently waiting for the delivery of my Wio and other accessories for this project. Once I receive them I will let you know what happens, I may resort to getting an arduino and using your code.

Also, in reviewing your code I see that you wait 15 minutes (var contador) after sending IR (ON/OFF), I assume that is so you don’t get into a loop or keep sending the IR signal multiple times?

Hi guys, so I got my equipment, played with Wio Link (basic stuff) - works nicely.

I attached the Infrared Receiver and Infrared Emitter, using the API was able to read a signal {"data": "20df10ef", "len": 4} from my TV Remote and then play it back via Emitter. Cool!

BUT … when I try my AC Remote I get a different looking signal {"data": "0000000200000004000000", "len": 11} , and I get the same signal for different commands, my guess is it’s a longer signal (like erdtmann suggested) and I am only seeing the first part.

Can I set a parameter that will tell the Wio Link to read longer signals?

Thanks for your help.

Bump

If I were you, I’d get advice from the guys in any repairing serivice