Air Conditioning Web Controlled by Arduino

95,038

560

73

Hello there

The high temperature of this summer, make me think to this project. May be there are similar on the internet, but I didn't find.

This project is based on arduino, and runs well on boards bigger than UNO, which has not so much memory. With this you can switch ON or OFF, your home's air conditioning system, checking the ambient temperature and humidity, and all this, through your phone's browser away from home. ... of course, if you have a internet connection at home and on your cell phone (not just smartphones).

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Hardware

  1. Arduino Mega
  2. Ethernet shield
  3. 5v(USB), 6v or 9v power plug for arduino
  4. LAN ethernet cable
  5. DHT22(or DHT11) sensor for temperature/humidity
  6. Infra Red (IR) LED from a remote control or less than 1€ in electronics shop
  7. temporary: an IR receiver
  8. temporary: a breadboard with three wires

Step 2: Getting the Codes

The remote control of the air conditioning systems have always an lcd screen with settings. When you press any button, the IR led sends ALL the configurations which are shown on the remote's lcd, plus the modification by pressing that button.

All the other remotes (TV, DVD, HiFi...) are different -> every time you press the same button, you get the same short code. But that's another nice story.

To make the receiver, we can use our arduino (UNO is good enough) and the IR receiver. Please see the photo above with few models and pinout. Just look at the housing and the pins. In my case, is the first on the list.
Put the receiver on the breadboard and connect + to 5V, - to GND and S to arduino's Digital 2. Connect the arduino to the computer and download the arduino sketch "Long_IR" down here and load it on the arduino.

To get the codes for OFF, DRY, COOL or even HEATING, we need to set the lcd on the remote with the configuration that we need, for example DRY/25°C/no Swing/Fan auto . Then open the terminal, arduino will wait for data from the remote. Now put the remote in the front of the arduino receiver and press "ON/OFF". After you see on the terminal the code coming, press again "ON/OFF".

In this way, the first code you get on the terminal is OFF and the second one is DRY/25°C/no Swing/Fan auto .

You can copy this codes to a text file.

Now, you can do the same for COOL, and you can copy only the code for COOL.

In the text file with the codes cancel all the "-" (minus) sign and put it in the sketch

Step 3: First Test in the Home Network

First I tried with arduino UNO, but I get out of memory (only 2kb) for the variables. Uno is ok if you want to just activate the air conditioning (one code). If you need buttons to switch OFF!, switch ON cooling, switch ON drying, switch ON heating, you definitely need an arduino Mega.
DHT22 is an option. But is nice to see the temperature and humidity in your house, one hour before your arrival.

Mount the ethernet shield on the arduino. Connect DHT22 to +, GND and digital pin 2. Please refer to DHT22 connection: here Connect the IRtransmitter led to GND and digital pin 9. Note that I did not use a resistor. I see that with the resistor, the IR light is werry weak (AC did not receive), and without the resistor is better. How did I "see"? take a look at: this instructable . Then connect arduino to network.

Libraries used for this are most of them located by default il the arduino IDE. Libraries which you may need are DHT and IRremote, witch you can also, get it here. Download the sketch down here and load it on your arduino.

Change the network configuration with yours > mac, IP ... < .

Codes may be different because we're using a different AC manufacturer. Just change my codes, with your codes, keeping the same meaning of the codes: my OFF with your OFF, my DRY with your DRY and so on...

Load the new sketch and from the pc conected to your home network, just tipe in the browser the arduino's IP.

Keep the IR led straight to the AC not more than 5 meters away. Then check if you can see in the browser the temp/humidity values, and looking at the AC press the commands OFF, DRY, COOL.

In this case, you can use this to control the AC from inside your home network.

Step 4: Setting Up Router

For this you need to refer to your router manufacturer and open the ports that arduino can be seen from outside.
If you have a dynamic IP, you must use a free service like noip.com or dyndns.org. With static IP, just open ports on router and use it.

Example:

internal IP: 192.168.1.100

external IP: 2.230.yyy.xxx find your's here

You need to open a port on external IP to go on port 80 of the internal IP. We chose port 7000.
The address you will need to call in the browser from outside, look's like this: http://2.230.yyy.xxx:7000

If you use a dynamic IP service: http://user.noip.com:7000

_________________________________________________

Hope you enjoy this instructable.

Cristian

2 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

73 Discussions

None
RizkiA16

3 years ago

hello cris, i very interest with your project, i get some problem when i try to get ir signal with your code, but i get the other code in other site finaly i can record my remote signal, but when i record a signal i get a difference raw code although i try with a same button its always defference, i thinks it's ok the signal i record for turn off my ac like this [Raw (101): 8828 3050 -1650 450 -1150 450 -1150 450 -350 450 -400 450 -350 500 -1100 450 -400 450 -450 400 -1150 450 -1100 450 -400 450 -1100 500 -400 400 -400 450 -1100 500 -1150 450 -350 500 -1100 450 -1150 450 -400 450 -350 450 -1200 400 -400 450 -350 500 -1150 400 -450 400 -350 500 -350 450 -400 450 -400 450 -350 450 -400 450 -350 450 -450 400 -400 450 -350 450 -400 450 -350 500 -350 500 -350 450 -350 500 -350 450 -400 450 -400 450 -350 450 -1150 450 -400 450 -350 450 -1150]

and i try to convert it to : [unsigned OFF[] = {3050,1650,450,1150,450,1150,450,350,450,400,450,350,500,1100,450,400,450,450,400,1150,450,1100,450,400,450,1100,500,400,400,400,450,1100,500,1150,450,350,500,1100,450,1150,450,400,450,350,450,1200,400,400,450,350,500,1150,400,450,400,350,500,350,450,400,450,400,450,350,450,400,450,350,450,450,400,400,450,350,450,400,450,350,500,350,500,350,450,350,500,350,450,400,450,400,450,350,450,1150,450,400,450,350,450,1150};]

like your intructions , but when i try to send it to my ac , my ac don't give a respond like nothing happen, i check with my ir transmitter is send a light with my phone camera, but why my ac don't give a respond for that signal ? , can you advice me ? help me cris, thanks

1 reply
None
queserasera701RizkiA16

Reply 6 weeks ago

hi chris, i am having same problem with this guy. please help me

None
MichaellQuinn

Question 3 months ago

Hi, Nice tutorial Cris !
can I use 4 IR LEDS? and if it is possible, can you please explain how to wire them..
Thanks !

None
GayanL4

7 months ago

this is amazing project which is help to reduce the your home electricity bill . i suggest to add one more option to this project that call motion controlling is that possible to add motion detector for this project and control the A/C room temperature non occupied condition (Room)

thanks

None
jaybee79a

1 year ago

Thanks for sharing this project. I tried to add it in the "made it" section, but I couldn't even add a picture or a comment.

I changed some parts of the script (website text) to German and added a prototype shild between the Arduino and the Ethernet shield. On the prototype shild there are connectors for the infrared diodes and the DHT22 sensor. I use 2 diodes in series with 4 small 10 Ohm resistors that are switched on by a small mosfet instead of connecting ther diode directly to the arduino port. The DHT22 and the diodes are placed about 1,5m away from the Arduino using a servo cable from my model planes.

The arduino is powered by an old nokia charger controlling a LG aircondition installed last year.

ac_control.jpg
None
GIVENPHOSHOKO

Question 1 year ago

i am trying to use my arduino to switch on the aircon when is cold and switch it off when is warm without using the remote.i don't know how to go about it.please help

1 answer
None
MoniCrisGIVENPHOSHOKO

Answer 1 year ago

Hi.

in the setup is better to create a variable "boolean msgCoolSent and msgOffSent = false" // if not, every 15 or 30 minutes will send the command

In the loop just read every 15 or 30 minutes the DHT sensor and then create a condition:

If the temperature is higher than 25,

if msgCoolSent = false ... send COOL command, then msgCoolSent = true

....

If the temperature is lower than 18,

if msgOffSent = false ... send COOLOFF command, then msgOffSent = true

is the same sketch as an thermostat

Good luck


None
rastafari20

1 year ago

Nice Job!!!! just want to ask if it is possible to send the same command via GSM module? so that i dont need to use internet???

1 reply
None
MoniCrisrastafari20

Reply 1 year ago

Thank's.

Of course is possible. Cancel the html part, and add a GSM shield to arduino, and create the condition:

if sms from "your number", do next:

if message DRY, send the IR command DRY

if message OFF, send the IR command OFF

if message TEMP, read the temperature and humidity and send an SMS to "your number" with Temperature and Humidity.

// the last one, just to have a feedback to know if is neccessary to turn on or not the AC

___ Good luck

None
maxdanluca

Question 1 year ago on Step 4

I tried to read the codes of my ARH465 remote control of AC Samsung but every time I read defferent code. Why? Can you help me? I used TSOP4838 IR receiver connetted to Arduino UNO. I show you two defferent codes:

Command: ON - Only Fan

Raw: (231) 3028, -9024, 540, -508, 564, -1556, 540, -508, 540, -540, 532, -536, 532, -516, 540, -560, 540, -504, 544, -508, 484, -1584, 540, -512, 536, -532, 508, -1536, 540, -512, 536, -532, 540, -1504, 540, -1532, 536, -1508, 588, -1504, 540, -1528, 544, -504, 540, -512, 508, -560, 540, -508, 544, -504, 544, -508, 540, -528, 568, -504, 544, -504, 544, -508, 536, -536, 536, -540, 540, -508, 540, -532, 536, -564, 540, -508, 540, -508, 540, -512, 532, -536, 536, -512, 540, -508, 540, -508, 540, -512, 564, -504, 540, -508, 544, -504, 544, -508, 540, -552, 544, -504, 544, -508, 540, -532, 484, -564, 540, -1508, 480, -1584, 540, -1556, 540, -1504, 512, -1908, 3004, -9044, 536, -1560, 536, -508, 540, -536, 460, -588, 540, -504, 544, -508, 540, -532, 460, -584, 540, -512, 540, -1528, 540, -508, 540, -536, 540, -1576, 548, -1500, 484, -1580, 544, -1528, 532, -516, 540, -1556, 540, -1504, 536, -1528, 544, -1524, 540, -1504, 544, -1528, 540, -1504, 564, -1500, 592, -512, 456, -592, 536, -512, 540, -504, 544, -556, 536, -512, 544, -504, 544, -564, 532, -516, 532, -536, 536, -512, 536, -512, 536, -516, 480, -588, 536, -1508, 536, -1532, 540, -536, 536, -1528, 540, -512, 536, -1528, 544, -1504, 540, -528, 540, -508, 544, -536, 536, -512, 480, -592, 540, -508, 536, -1528, 540, -1504, 544, -1528, 540, -1508, 508,

Raw: (231) 3000, -9076, 536, -508, 540, -1528, 544, -504, 540, -512, 536, -516, 476, -592, 540, -508, 540, -508, 536, -516, 584, -1508, 592, -504, 540, -536, 532, -1536, 540, -532, 536, -512, 540, -1504, 532, -1536, 544, -1524, 544, -1500, 484, -1584, 540, -508, 540, -536, 512, -532, 544, -504, 568, -508, 540, -532, 460, -588, 540, -508, 540, -536, 540, -532, 540, -508, 544, -556, 540, -512, 536, -532, 516, -532, 540, -508, 540, -508, 540, -508, 540, -532, 508, -540, 540, -508, 540, -512, 536, -536, 512, -536, 536, -536, 540, -512, 536, -532, 536, -564, 540, -508, 544, -504, 540, -532, 488, -560, 544, -1500, 544, -1528, 536, -1556, 540, -1504, 516, -1904, 3004, -9020, 560, -1556, 544, -508, 540, -512, 536, -536, 536, -508, 540, -508, 540, -508, 540, -532, 508, -544, 536, -1528, 592, -508, 540, -512, 556, -1536, 540, -1584, 536, -1508, 536, -1528, 544, -504, 544, -1524, 544, -1552, 540, -1556, 540, -1532, 536, -1508, 536, -1528, 544, -1528, 536, -1508, 536, -512, 536, -536, 536, -512, 540, -508, 540, -512, 532, -536, 564, -508, 540, -508, 540, -512, 484, -588, 536, -540, 540, -508, 536, -532, 536, -512, 544, -1504, 484, -1584, 536, -512, 536, -1556, 540, -508, 536, -1532, 540, -1528, 544, -508, 540, -504, 540, -512, 544, -528, 540, -508, 540, -532, 540, -1584, 536, -1508, 536, -1528, 544, -1524, 488,

Thanks in advance

Massimo Dani

None
shimakaze

2 years ago

What range do you get with the led? or how far do you put the arduino relative to the AC?

I tried to do the same but I get about 10cm range, this is way too close..

5 replies
None
MoniCrisshimakaze

Reply 2 years ago

Hello
In my case is about 3m, but i need to point it precisely to the AC.
After that I tryied it using a NodeMCU (ESP8266), whitch is using 3,3v, not enough for the ir led. For solving this, I used a npn transistor to control the ir led. Now I'm trying to find a definitive place for it, whitch is at 4 m. I will see
Sorry for the late answer, but the instructables app is not working anymore on ios.

None
shimakazeMoniCris

Reply 2 years ago

You should add the part with the transistor to the instructable, it would be useful.

None
MoniCrisshimakaze

Reply 2 years ago

My Instructable is with UNO and Mega, witch are using 5volts. If you want to use ESP8266 witch have 3,3 volts, You have to google for changing all the sketch, thus, also the voltage witch goes to the IR led. Thank you for your understanding

None
shimakazeMoniCris

Reply 2 years ago

Well it would be useful to make an instructable with the ESP then.

None
MoniCrisshimakaze

Reply 1 year ago

I did the starter. I let you make it bigger.

None
AnkurD8

1 year ago

hello sir, i was also trying to implement the same project but my MEGA is receiving data continuously and that too something unreadable. I have just to see the codes which my remote is sending.

Please help me in this, its very urgent.

Thank You

Screenshot (160).png
1 reply
None
MoniCrisAnkurD8

Reply 1 year ago

look's like you have set the wrong baud rate. Please check your sketch's serial baud rate.

None
MoniCrissnadeem5

Reply 2 years ago

I tried it with ESP8266 and is working fine. I suggest to try with one first, and then starting to change things. If you need help, ask me.