Tag Archives: aircon

Remote /Cloud Air Conditioner Control using Arduino, Bluetooth and J2EE

So, we have this very old air conditioner in our lab with a wired thermostat, which basically works alright but doesn’t have a remote control. The air conditioner is so old that the spare parts of this system are not even available in the market right now. As part of making everything “futuristic”, we decided to do little tweaking to enable wireless cum cloud control for this thingy.

The initial step was to check how the system works. The thermostat is DC powered and have its own proprietary protocol for sending commands and signals to the machine. Examining the terminals of the ON/OFF switch with a multimeter revealed that shorting the terminals for a few seconds would send the ON/OFF signal to the system. And I guess, this is how most of the thermostats, irrespective of the brand, do the job.

Now that we know how to turn ON/OFF the system, time to gather the hardware. Do reverse engineering, what needs to be at the end of the system is a Relay, which can do the “shorting”. And what can power the relay? A 5V signal. And where should it come from? From an output pin of Arduino. And what should trigger the signal? A command from PC/Mobile/Tablet. And how should the command be transmitted. Via Bluetooth/Zigbee/Wi-Fi. Here we use Bluetooth, because the hardware is comparatively cheap, and it can be easily integrated with Arduino. So here it goes, the complete hardware and software list for making this system.

1. Arduino (Can be any. Here I use Uno)
2. Bluetooth Adapter for Arduino HC-05 or HC-06
3. 5V Relay
4. Wires and Jumpers
5. Breadboard/ Soldering Board
6. Arduino Programming Software
7. Eclipse IDE where we run the Dynamic Java Application for web interface.
8. Serial Terminal for Windows, For Example TeraTerm
9. Bluetooth Serial Terminal Software for Android (Optional)
10. And obviously the thermostat connected to AC and a little bit of patience 😉

Start by wiring the HC-06 to the Arduino. Connect the TX pin of HC-06 to the RX pin of Arduino. Connect the RX pin of HC-06 to the TX pin of Arduino through a voltage divider. Connect Vcc(5V) and GND pins of HC-06 to respective terminals (Refer figure).

Take the output from any of the Arduino digital pins. In my case, I used pin number 10 (Of Arduino Uno). This output is connected to one of the the energizing coil terminals of the relay. And the other pin is connected to the GND. The outputs of the relay are connected across the ON/OFF terminals of thermostat.


Time to program the Arduino. Set the pin 10 as output and make it LOW and HIGH with a delay of 1 second. Why because the shorting has to persist for a second for the thermostat to turn ON. Do the same thing for turn OFF process as well. During programming, make sure you disconnect the HC-06 from Arduino.

char VAL;
int AC = 10;
void setup() {
pinMode(AC, OUTPUT);
void loop() {
Serial.println(“AC CONTROL \n”);
Serial.println(“Press 1 to turn ON or 0 to turn OFF”);
while (!Serial.available());
VAL = Serial.read();
if(VAL == ‘0’ ) {
digitalWrite(AC, LOW);
if( VAL == ‘1’ ) {
digitalWrite(AC, HIGH);
}Now that the entire hardware setup is ready, we should check if this really works. Pair your laptop or PC with the HC-06 (Obviously, your machine should have Bluetooth. Use a Bluetooth adapter, if it is not available inbuilt). The password should most likely be “1234”. Open a serial terminal, for eg TeraTerm. Connect to the respective COM port. Type “1” to see if the relay is working. You can also use Bluetooth Serial Terminal for Android to check.

To enable local control using a web application, we should make a dynamic Java application and run it on a local server. Import RxSerial and RxParallel libraries for Java. Open the respective COM port, set the Baud Rate to send the commands. For the front-end, use JSP-JSF or HTML-5 to create a simple web page. Note that for cloud control, the program should be written in such a way that the web app should send a signal to the local machine which is connected to the HC-06 via Bluetooth. This signal should trigger opening the COM port on our local machine.

Export this application as a WAR file and upload to cloud server. The cloud server should support JSP-JSF /HTML and should also have an application server like Apache Tomcat. Do note that the local web application and the server should be running the same version of the Web Server; Tomcat or JBOSS or whatever. Otherwise, there might be problems launching the application from Web.


You could also make an Android application to do the control from mobile or tablet. Bluetooth Terminal Apps are available though, as I already mentioned.

That’s it. Restart your application server after deploying the web application. And voila!! You can control your AC from web. Further modifications like temperature control, auto scheduling ON/OFF can be done easily. But yeah, once you are done with the basic stuff, you can always build on top of it. 🙂


Rahul Ashok