PCB Heaven

General Category => Your projects => Topic started by: fuzail on May 08, 2013, 23:40:49 PM

Title: Air conditioner control
Post by: fuzail on May 08, 2013, 23:40:49 PM
Hey everyone.
I am planning to design a common interface to control all the 3 different air conditioners in my house.
I had planned to learn certain of the data transmitted by the remote control, store it and then resend it as and when required.
however, my first few runs of trying to see what the remote is sending have been weird.

i am using an Arduino with an Ir sensor to read the ir data. using 2 particular programs
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html (http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html)
http://learn.adafruit.com/ir-sensor/overview (http://learn.adafruit.com/ir-sensor/overview)
it seems every time i receive data from the remote, it is different, when using an ac remote.
with a tv remote i get nearly the same data, but with the ac remote the data is very different
i have yet to test if any of the code i read works, because i don't have the resistor [size=78%](due to certain problems in my locality)[/size][size=78%] [/size]i need to connect in series with an ir led.
ill probably be getting the resistors in a day or so.

is this behavior normal ?
getting different data, every time for the same button press.

i was initially thinking of decoding each of the remote signals, so as to figure out what is the data being sent. like [size=78%]http://www.pcbheaven.com/userpages/Reverse_Engineering_Fidji_Air_Condition_IR_Protocol/index.php?topic=worklog&p=2 (http://www.pcbheaven.com/userpages/Reverse_Engineering_Fidji_Air_Condition_IR_Protocol/index.php?topic=worklog&p=2)[/size]
that way i can manipulate just the variable i want to , instead of learning the entire data and then re-transmitting.
however not having an oscilloscope, i don't know if that is even possible.

any suggestions or help would be very much appreciated.
Title: Re: Air conditioner control
Post by: cheerio on May 09, 2013, 02:22:43 AM
maybe you should check if the stuff you received was exactly what the remote sent. the arduino uses the atmega328 if i remember correctly. a very versatile microcontroller. check out the datasheet on page 120 http://www.atmel.com/Images/doc8161.pdf (http://www.atmel.com/Images/doc8161.pdf), you can use the "input capture" unit to read @ the IR-Led pin in the remote.
Title: Re: Air conditioner control
Post by: George on May 09, 2013, 06:41:01 AM
Here's some links for you


Title: Re: Air conditioner control
Post by: fuzail on May 10, 2013, 14:20:25 PM
after further testing, what i have realized is, the distance from which i transmit the data from my remote somehow seems to effect the data.
like if i was to capture the data with the sensor placed 5ft away from the remote. +/- 2 ft and the signal remains reasonably same.
however if was to then stand 10-15ft away the signal changes drastically.

you mean that i should physically hack into the remote control ?
i would much rather not do that, because i don't want to end up with a busted remote.

thanks for the link, but i have already gone through them.
the second link you posted, i am trying to use that library as well.
Title: Re: Air conditioner control
Post by: kam on May 10, 2013, 19:02:06 PM
Keep in mind also that air-condition manufacturers have very weird protocols. It can be for example that the IR sends twice the signal, but the second signal is inverted (for error correction). This happens for example with the mitsubishi remote that i tested some time ago. Add a filter to your software to filter out every second reception and see what happens.
Title: Re: Air conditioner control
Post by: fuzail on May 13, 2013, 11:19:38 AM
i am able to send the on and off commands to one of the ac units succesfully.
now comes the difficult part.
i have some raw data that i record from the remote control that looks like this. those i think are basically the on and off times.

Code: [Select]
how do i go about decoding this data into bits, so that i can decode the data and then  reconstruct the code, altering only what i need.
Title: Re: Air conditioner control
Post by: kam on May 16, 2013, 10:54:07 AM
This is the fun part! What i do to reverse-engineer a code is to record a series of different push buttons and then try to find what changes every time.
Title: Re: Air conditioner control
Post by: fuzail on May 17, 2013, 17:58:23 PM
yeah looking at your project on the fidiji airconditioner helped me alot.
what i don't understand is how do you select which of the on-off sequence is a 1 bit and which one is a 0 bit.
through some trial and error and lil bit of luck i was able to decode how the bits were set on one ac.

the next ac i am totally stumped.!
the way the bits change is so random (at least to me, i am poor when it comes to these binary/boolean logic)

Code: [Select]
1111 at 17
1110 at 18
1100 at 19
1101 at 20
1001 at 21
1000 at 22
1010 at 23
1011 at 24
0011 at 25
0010 at 26
0110 at 27
0111 at 28
0101 at 29
0100 at 30

those bits could however be inverted. as i interpreted it in the wrong way i.e 1 instead of 0 and 0 instead of 1.
Title: Re: Air conditioner control
Post by: kam on May 18, 2013, 12:59:13 PM
Lets invert them

Code: [Select]
0000 at 17
0001 at 18
0011 at 19
0010 at 20
0110 at 21
0111 at 22
0101 at 23
0100 at 24
1100 at 25
1101 at 26
1001 at 27
1000 at 28
1010 at 29
1011 at 30

and convert them to dec:
Code: [Select]
0 at 17
1 at 18
3 at 19
2 at 20
6 at 21
7 at 22
5 at 23
4 at 24
12 at 25
13 at 26
9 at 27
8 at 28
10 at 29
11 at 30

it really makes no sense... You can just use this pattern as-is... copy it and use it. But it is really crazy.
Title: Re: Air conditioner control
Post by: Sir N on June 23, 2013, 08:00:44 AM
it really makes no sense... You can just use this pattern as-is... copy it and use it. But it is really crazy.
Although I can't see a reason for doing so (unless it's a "wheel" or similar), it has a distinct Gray code pattern (i.e. only one bit shifts at each iteration), but I'll agree that relatively few codes doesn't warrant much scrutiny, just pop them into a time table and use raw :)