Air Conditioning Web Controlled by Arduino

74,762

545

69

Published

Introduction: Air Conditioning Web Controlled by Arduino

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).

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

  • Creative Misuse Contest

    Creative Misuse Contest
  • Oil Contest

    Oil Contest
  • Water Contest

    Water Contest

69 Discussions

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 more answer

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


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

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

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

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

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.

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

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

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

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

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

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

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.

Buna MoniCris,

Foarte bun si constructiv, insa te rog daca poti sa pui un sketch pentru un arduino uno, pe partea de receive data si send data, ar fi mult mai usor pentru un incepator sa faca sistemul, si apoi sa treaca la partea cu webserver?

Incearca sa explici putin mai bine cum se face receptia datelor, si apoi ce se pune mai exact in "unsigned" dupa ce s-au receptionat datele.

1 reply

Salut. Multumesc pentru comentariu. Nu am pus sketch-ul de pe receive, pentru ca acela se gaseste impreuna cu libreria de la IRreceive. Sunt lucruri care sunt usor de gasit online. Mie mi-a fost greu sa gasesc un astfel de proiect. Crede-ma ca sunt multi care incearca sa foloseasca sketchul meu cu aceleasi coduri. Nu pot sa scriu o explicatie pentru unii care nu au pus niciodata mana pe arduino.
Sper sa ma intelegi.

0
user
InnaC1

1 year ago

Great tutorial, thank you! :)

Great instructable!

Is it not possible to use the Uno alone(without ethernet) and send simple on/off signals? I receive data from my remote but I couldn't figure out to send data.

1 reply