Introduction: Air Conditioning Web Controlled by Arduino

Picture of 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

Picture of 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

Picture of 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

Picture of 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 or With static IP, just open ports on router and use it.


internal IP:

external IP: 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:

If you use a dynamic IP service:


Hope you enjoy this instructable.



shimakaze (author)2017-10-03

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

MoniCris (author)shimakaze2017-10-06

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.

shimakaze (author)MoniCris2017-10-06

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

MoniCris (author)shimakaze2017-10-07

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

shimakaze (author)MoniCris2017-10-07

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

snadeem5 (author)2017-01-27

we will try with ac remote as nodemcu

MoniCris (author)snadeem52017-10-07

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.

ParaschivL (author)2017-08-01

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.

MoniCris (author)ParaschivL2017-10-07

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.

InnaC1 (author)2017-04-21

Great tutorial, thank you! :)

Gökhan Türkeli (author)2017-01-03

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.

we will try nodemcu to send ac code

snadeem5 (author)snadeem52017-01-26

we will send codes with uno they cant receive it

how to operate ac remote with arduino

MoniCris (author)snadeem52017-01-27

I don't get your problem. Please explain better

MoniCris (author)snadeem52017-01-27

I will try with ESP07(ESP8266) I will write a review.

@snadeem5, I just received my nodemcu package yesterday. Please let me know if you succeed:)

Yes you can use only UNO, but where's the fun.
Maybe can be something like this: uno, DHT22 and IRled, you can use an thermostat. UNO is switching on or off the AC if the condition "temperature" is high or low.
If you have problems with ir codes, please explane more information about it.

The fun is to be able to control the AC:) That's enough for me.

I tried to do what you said but I couldn't do it. I couldn't make the code work

As far as I understand code consist several parts:

1- define the signals

2- define the output pin

3- operate selected signal

So I modified your code as attached. But it doesn't work. I made something wrong I guess. I checked the led with phone cam but it doesn't work.

I can get the signals with your scheme but I cannot send them.

snadeem5 (author)2017-01-26

i will send raw and nec codes from arduino but ac cannot ON

what will do to ON AC

hail15 (author)2016-10-08

Hi Cristian

Can this project receive all code of air-conditioner? i need to receive a lot air-conditioner because i learn graduate thesis and i need you project

thank you very much, Cristian

siddiquek (author)2016-09-18

Hello Monichris,

I am going with the wifi sheild in my implementation. Please support me to add the sketch for wifi purpose.

MoniCris (author)siddiquek2016-09-30

Hi. I do not have a wifi shield to test it, but please my sketch with this on in the link:

SufianS (author)2016-08-10

Hi MoniChris, it awesome project. I have some question.

Can i using arduiono genuino? and how i want to link the ardiuno to the web pages?

Thankss :)

MoniCris (author)SufianS2016-09-30

Hi. Thanks.

There is no "arduino genuino". Arduino is the name in USA, and Genuino is the name in Italy (or Europe I think).

So, "Genuino UNO" is the same board like "Arduino UNO"

When I write the instructables there was no Genuino.

What do you mean with "link the ardiuno to the web pages"?

To create the web pages (web server), please check


JohnD466 (author)2016-05-23

Hi Chris

Im totally new to html.

What part of html code sets the text size and font of most of the text on the web page.

I can see the font size of the "STATUS" but where is the rest of it set.

Thanks for the article

MoniCris (author)JohnD4662016-09-30

I'm not good in html too. Please Google for that.

Dm87 made it! (author)2015-11-08

Thanks for this project, Cris so helpfull person and really awesome. Hope anyone else can be made it also...

MoniCris (author)Dm872016-09-30

Great. Thank

MoniCris (author)Dm872015-11-10

Great! That's nice to see. I'm proud. Thank you.

PanagiotisS8 (author)2016-07-29

Hi MoniCris! Very nice project! I have 2 questions:

1) Can I do it with a wifi shield? Cause the A/C is not on the same room of the router.

2) The adress for the remote, will it work from everywhere or only on my house's network?


MoniCris (author)PanagiotisS82016-08-01

Hi. Thanks.
1) Shure youcan do it. You only need to modify the sketch according to the wifi shield.
2) in your home, normally you type in the internal IP like , but when you are outside or in 3G, you need to open some ports on your router. Than you must find your "external" IP from here and then you must tipe on your smartphone the IP and the port. You need to check with your InternetServiceProvider if is possible to open some ports on your router.

RizkiA16 (author)2016-04-04

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

Dm87 (author)2015-11-05

hi Cris, I have problem to get code from IR receiver. when I follow your step, on my terminal always give code without stop, even when Im not pressed any button. is that something wrong I miss it. Please advice

Dm87 (author)Dm872015-11-06

my last problem fixed by replacing with another type IR receiver.
But now I have abother problem because I cant connect from browser with my IP configuration, can you please give some advice... Thanks before

MoniCris (author)Dm872015-11-07

Ok. So it was another type of Ir receiver. Please look at the picture with the typer of ir receivers. Now, if you installed the ethernet library, please run the simple web server example where you can see the analog inputs on the web page. Also please check if all the device are conected to the same interbal network (not 3G)

Dm87 (author)MoniCris2015-11-07

thanks for your advice Cris, I was able to connect with browser now, its seems because I have an IP conflict with another computer after make double cross check as your stated. Now I can see my DHT result its valid compare to my other temperature stuff in my room, but I have inaccurate status for AC, arduino said it OFF even actually it is ON and I failed to controll it with the button because when I try to pressed DRY or COOL, then it wouldnt do anything to the AC, do you have any suggest advice for this troubleshoot.. thanks before for this amaze project

MoniCris (author)Dm872015-11-08

Great. A tip for IP: set an IP from the end of the list (

For the state of the AC, arduino for now, is not able to check the state. What you see in the browser, is the last comand sended to the AC. You can see something real, by looking at the temperature and humidity to understand better what is active.

You have checked all three codes by sending one by one to see if the AC is accepting it?

Please look in the other comments. I posted an photo with an ideea to better check if the AC is running or not.

Dm87 (author)MoniCris2015-11-08

I made it, Thanks for your advice and help Cris... Your project is awesome for me.... Next I wanna try to implement CT. Wish you all the best

MoniCris (author)Dm872015-11-10

That's very kind of you. Thank you. So, soon, I will see an instructable about this CT sensor. Good luck.

ihabosman (author)2015-10-27

Hi cristian thanks for that great project ,I'm trying it but i'am stuck in many thing so could u please help me;

first thing the codes I get from the remote what I should do with it or where I should put them?

MoniCris (author)ihabosman2015-10-28

Thanks. So! After you get the codes in the terminal, you need to copy them to a text file, and then need to cancel all "-" signs. After this copy this code to the "send" sketch. Please tell me exactly where are you blocking at? Please look also in my examples. Need to be nearly the same.

bingdo72 (author)2015-09-22

This is good.
I have been searching some application references in which WIZnet solution is applied, and found your project using Ethernet Shield.
In the Ethernet Shield WIZnet's W5100 chip is embedded.
If you are O.K. I'd like to post this article in WIZnet Museum ( for others.

MoniCris (author)bingdo722015-09-22

Would be a pleasure for me. Thanks.
Could you please send me an link to this article when you post it?

nice_man_36 (author)2015-09-01

really nice work i think to do the same project i will

MoniCris (author)nice_man_362015-09-01

Thank you

mnowak7 (author)2015-09-01

Where did you got your mega from? like the design with the sd card

MoniCris (author)mnowak72015-09-01

There's no sd on mega. The sd is on the ethernet shield witch is on arduino mega.

frank984 (author)2015-08-31

Have you seen this ^^^ other similar project?

MoniCris (author)frank9842015-08-31

Wow! That's the same. I know why I did not find it before. Smart lamp in the title did not make me think to the air condition. Anyway, is a good project too.

About This Instructable




More by MoniCris:Air Conditioning web controlled by Arduino
Add instructable to: