Cell Phone Controlled AC using Arduino and Bluetooth

Published  November 9, 2017   4
User Avatar Aswinth Raj
Author
Cell Phone Controlled AC using Arduino and Bluetooth

In today’s modern world, where ever we go we have lots of electronic devices around us. But, out of all, there is only one device that we personally have in our pockets all the time. Yes, it is our mobile phones. Now Mobile phones have become more than a device used for communication, they are our cameras, they are our maps, they are our shopping karts and what not?

With this capability in our hands, it is really a boring idea to use Remote controls to control any electronic applications in our home like TV, AC, Home theatre etc. It’s always frustrating to reach for the AC’s Remote from the comfy comfort of our Bed or sofa. Hence in this project we are going to build a small set-up using which you can control the Air conditioner through your Smart phone using Bluetooth and Arduino. Sounds interesting right! Let’s built one

 

Materials Required:

  1. Arduino Mega 2560
  2. TSOP (HS0038)
  3. IR Led
  4. Any Colour LED and 1K Resistor(optional)
  5. HC-06
  6. Breadboard
  7. Connecting Wires

 

Working Methodology:

All the Remote Controls in our home that we use to control TV, Home Theatre, AC etc work with the help of IR Blasters. An IR blaster is nothing but an IR LED which could blaster a signal by repetitive pulsing; this signal will be read by the receiver in the electronics appliance. For each different button on the remote a unique signal will be blasted which after read by the receiver is used to perform a particular pre-defined task. If we are able to read this signal coming out from the Remote, we can then mimic the same signal using an IR LED when ever required to perform that particular task. We have previously made a IR Blaster circuit for Universal IR Remote and for Automatic AC Temperature control.

IR LED

A TSOP is an IR Receiver that could be used to decode the signal coming from the Remotes. We will use this TSOP to decode all the information from our Remote and store it on Arduino. Then using that information and an IR Led we can re-create the IR signals from our Arduino whenever required.

TSOP1738

 

Pre-requisites:

For this Arduino Bluetooth Controlled AC Project, make sure you have an Arduino Mega and not any other version of Arduino, since the code size is heavy. Install the IR Remote Library using this link to work with TSOP and IR Blaster.

 

Working of an AC Remote:

Before we proceed into the project take some time and notice how your AC remote works. AC remotes work in a bit different way compared to TV, DVD IR remotes. There might be only 10-12 buttons on your Remote, but they will be able to send a lot of different types of signals. Meaning the Remote does not send the same code every time for the same button. For example, when you decrease the temperature using the down button to make it 24°C (degree Celsius) you will get a signal with a set of data, but when you press it again to set 25°C you will not get the same data since the temperature is now 25 and not 24. Similarly the code for 25 will also vary for different fan speed, sleep settings etc. So let’s not fiddle around with all options and just concentrate only the temperature values with a constant value for other settings.

Another problem is the amount of data that is being sent for each button press, normal remotes with send either 24 bits or 48 bits but an AC remote might sends up to 228 bits since each signal contains a lot of information like Temp, Fan Speed, Sleep timing, Swing style etc. This is the reason why we need an Arduino Mega for better storage options.

 

Circuit Diagram and Explanation:

Luckily the hardware setup of this Mobile Phone Controlled Air Conditioner is very easy. You can simply use a breadboard and make the connections as shown below.

mobile phone controlled ac using arduino and Bluetooth circuit diagram

The following table can also be used to verify your connections.

S.No:

Component Pin

Arduino Pin

1

TSOP – Vcc

5V

2

TSOP – Gnd

Gnd

3

TSOP - Signal

8

4

IR Led – Cathode

Gnd

5

IR Led – Anode

9

6

HC-05 - Vcc

5V

7

HC05 – Gnd

Ground

8

HC05 – Tx

10

9

HC05 – Rx

11

 

Once you connections are done it should look something like this shown below. I have used a Breadboard to tidy things, but you can also you Male to female wires directly to hook up all components

mobile phone controlled ac using Arduino and Bluetooth

 

Decoding your AC Remote Signals:

The first step to control your AC is to use TSOP1738 to decode AC Remote Control IR Codes. Make all the connections as shown in the circuit diagram and make sure you have installed all the mentioned libraries.  Now open the example program “IRrecvDumpV2” which can be found at File -> Examples -> IRremote -> IRrecvDumpV2

int recvPin = 8;
IRrecv irrecv(recvPin);

Since our TSOP is connect to pin 8, change the line number 9 to int recPin=8 as shown above. Then Upload the program to your Arduino Mega and open the Serial Monitor. 

Point your Remote towards TSOP and press any button, for each button you press its respective Signal will be read by the TSOP1738, decoded by Arduino and displayed in the Serial Monitor. For every change in temperature on your Remote you will get a different Data. Save this Data for we will be using it in our main program. Your serial monitor will look something like this, I have also shown the Word file on which I have saved the copied data.

Decoding IR signals of AC remote control

The Screenshot shows the code for setting the temperature at 26°C for my AC remote. Based on your Remote you will get a different set of codes. Similarly copy the codes for all different level of temperature. You can check all the Air Conditioner Remote control IR codes in the Arduino Code given at the end of this tutorial.

 

Main Arduino Program:

The complete main Arduino program can be at the bottom of this page, but you cannot use the same program. You have to change the Signal code values that we just obtained from the Example sketch. Open the main program on you Arduino IDE and scroll down to this area shown below where you have to replace the array values with the values that you obtained for your Remote.

IR signals of AC remote control in arduino program

Note that I have used 10 Arrays out of which two us used to Turn ON and turn OFF the AC while the rest 8 is used to set different temperature. For example Temp23 is used to set 23*C on your AC, so use the respective code in that Array. Once that is done, you just have to upload the code to your Arduino.

 

We need to import two libraries for this project. One is the IRremote library that we just added to Arduino and the other is the in-built Software Serial Library that helps us in using the Bluetooth module.

#include <IRremote.h> //Lib for IT Blaster and TSOP
#include <SoftwareSerial.h>// import the serial library

 

Next we initialize the Bluetooth Module on pin 10 and 11 and then use an object called irsend to access all the IR features of the library.

SoftwareSerial BT_module(10, 11); // RX, TX
IRsend irsend;

 

Next comes the very important lines of code. This is where the information to control your AC is present.  The one shown below is for my AC remote, you should have obtained yours in the previous step.

Decoded value of air conditioner ir remote

 

Next inside the void setup function, we initialize two serial communications. One is Bluetooth at 9600 Baud rate and the other is Serial monitor at 57600 baud rate.

void setup()
{
  BT_module.begin(9600); //BT works on 9600
  Serial.begin(57600); //Serial Monitor work son 57600
}

 

Inside our void loop (infinite loop), we check if there is anything received by the Bluetooth Module. If anything is received we store that information in the variable BluetoothData.

   while (BT_module.available()) //If data is coming
   {
    BluetoothData=BT_module.read(); //read it and save it
    Serial.println(BluetoothData); //print it on serial for testing purpose
   }

The information received by the Bluetooth will be based on the button pressed on our Android app that we will be installing in our next step. Once the information is received we just have to trigger the respective IR code like below

   if (BluetoothData == '2')
   {
    irsend.sendRaw(Temp23, sizeof(Temp23) / sizeof(Temp23[0]), khz);  delay(2000);//Send signal to set Temperatue 23C
   }

Here if the code ‘2’ is received we have to set the temperature of the AC to 23°C. Similarly we have code from 0 to 9 to perform all the basic control functions of AC. You can refer to the complete arduino code at the end of this page.

 

Installing Android Application:

The final step of the Smart phone controlled Air Conditioned is to install the Android application. The Android application for this project was created using Processing Android Mode. Processing is an excellent tool to create .EXE files or APK files for you Embedded projects. It is an Open source platform just like Arduino and hence completely free to download to use.

 

If you don’t want to get too much deep into it, you can simply download the APK file from here inside the zip file and install it directly on your mobile phone. Open the application and you will get a screen as shown below after which you can proceed down to the next step and enjoy working with the project. But if you want to tweak the program of the application to fit it to your need then you can read further.

Android application for bluetooth controlled ac

 

The complete program file for Processing code can be downloaded from here. This Zip will have the code and image source using which the application works. After open the code you can tweak the following lines to adapt it for your need.

 

As said earlier, Processing is similar to Arduino. So it also has a void setup and void loop (here draw) functions. Inside the void setup function we will instruct the Bluetooth of phone to connect to Bluetooth of Arduino. My device name here is “HC-05” so my line of code will be

  bt.start(); //start listening for BT connections
  bt.getPairedDeviceNames();
  bt.connectToDeviceByName("HC-05"); //Connect to our HC-06 bluetooth module

 

Next inside the load_buttons() functions you can draw as many buttons as you want. I have drawn 10 buttons as shown on the Application. Followed by that we have the read_buttons() function which is used to detect which button you are touching. Each button has a specific colour, so when a user touches the screen we check which colour he has touched and determine which button he has touched. A sample code to create a button and select it based on colour is shown below

fill(255,145,3);  
  rect(width/2-width/4,height/2,width/4,height/12); fill(255); text("25C",width/2-width/4,height/2); //button 5
  if (color_val==-13589993)
  {byte[] data = {'0'};
   bt.broadcast(data);}

The line “byte[] data = {'0'};” is a very important line. This is where we decide which code has to be sent to the Arduino via Bluetooth. Here if this button is pressed the char “0” is sent from Bluetooth to  Arduino. Similarly we can send a different character for different buttons. These characters can then be compared on the Arduino side and respective action can be taken.

 

Go ahead and fiddle around the code, if you have any doubts reach me through the comment section and will try my best in helping you out.

 

Working of Mobile Phone controlled AC:

Once you are ready with your Hardware, Arduino Code and android applications it’s time to enjoy the output. Upload the Arduino Code to your Hardware and place it facing your AC. Now open the android application on your Mobile phone, if everything is working as expected you should see “Connected to: device_name (some code)” as shown below

 

Bluetooth connection indicator of android app

 

Now just press any button on your Android application and it should trigger a respective action on the AC as if you are using a Remote. You can add as many buttons you want by modifying the code and also even automate your AC based on your room temperature or presence. Check the complete Arduino Code and the Video Below.

 

Hope you enjoyed the project and understood the concept behind it. As always if you got any problem in making this work, you can use the forums to post you questions and   get them resolved.

APK file for installing Android Application can be downloaded from here.

Code

/*
 *Bluetooth AC Temperature control using Arduino and TSOP
 * Code by: Aswinth Raj B
 * Dated: 25-11-2017
 * Website: www.circuitdigest.com
 * 
S.No: Component Pin Arduino Pin
1 TSOP – Vcc  5V
2 TSOP – Gnd  Gnd
3 TSOP - Signal   8
4 IR Led – Cathode  Gnd
5 IR Led – Anode  9
6 HC-05 - Vcc 5V
7 HC05 – Gnd  Ground
8 HC05 – Tx 10
9 HC05 – Rx 11

 */

#include <IRremote.h> //Lib for IT Blaster and TSOP
#include <SoftwareSerial.h>// import the serial library

SoftwareSerial BT_module(10, 11); // RX, TX
IRsend irsend;

int khz = 38; // 38kHz carrier frequency for the NEC protocol
char BluetoothData; // the data read by Bluetooth Module
int PevData;

//Decoded Remote Signals For my AC ##CHANGE IT FOR YOUR REMOTE
unsigned int ACoff[] = {2950,1750, 400,1100, 450,1050, 450,400, 400,400, 400,400, 450,1100, 400,400, 400,400, 450,1100, 400,1100, 450,350, 450,1100, 400,400, 400,400, 450,1100, 400,1100, 450,400, 400,1100, 400,1100, 450,400, 400,400, 400,1100, 450,350, 450,400, 400,1100, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,350, 450,350, 450,1100, 400,400, 450,400, 400,1100, 450,1050, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,1100, 450,350, 450,400, 400,400, 400,400, 450,400, 400,1100, 450,350, 450,400, 400,400, 400,400, 400,1100, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 400,1100, 450,350, 450,350, 450,400, 450,350, 450,350, 450,1100, 450};  
unsigned int ACon[] = {2950,1700, 450,1100, 400,1100, 450,350, 450,350, 450,400, 450,1050, 450,350, 450,400, 450,1050, 450,1100, 400,400, 450,1050, 450,350, 450,400, 400,1100, 450,1100, 450,350, 450,1050, 450,1100, 450,350, 450,350, 450,1100, 450,350, 400,400, 450,1100, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,1100, 400,400, 450,350, 450,1100, 400,400, 450,350, 450,1100, 400,1100, 450,350, 450,400, 400,400, 450,350, 500,300, 450,400, 450,350, 400,400, 450,1100, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,1100, 450,350, 400,400, 450,350, 450,400, 450,350, 400,400, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 400,400, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 450,350, 400,400, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,1100, 400,400, 400,400, 450,350, 450,350, 450,1100, 400,400, 450};
unsigned int Temp23[] = {3000,1650, 550,950, 550,1000, 500,300, 550,250, 550,250, 550,1000, 500,300, 550,300, 500,1000, 550,950, 550,300, 550,950, 550,250, 550,300, 500,1000, 500,1050, 500,300, 500,1000, 550,1000, 500,300, 500,300, 550,1000, 450,350, 500,300, 500,1050, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,1100, 400,400, 400,400, 450,1050, 450,400, 400,400, 450,1100, 400,1100, 400,400, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,350, 450,1100, 400,400, 400,400, 450,350, 450,400, 400,400, 450,1100, 400,400, 400,1100, 450,1100, 400,1100, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 450,350, 400,400, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,1100, 400,1100, 450,1100, 400,1100, 450,1100, 400,1100, 400,400, 450};  
unsigned int Temp24[] = {3000,1650, 500,1050, 500,1000, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,1000, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,1000, 500,1050, 500,1000, 500,300, 500,350, 450,350, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,1050, 500,1000, 500,1050, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,300, 500,350, 500,300, 450,350, 500,350, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 500,350, 450,1050, 500,300, 500,1050, 500,1000, 500,1050, 500,1000, 500,1000, 500,350, 550};  
unsigned int Temp25[] = {3050,1650, 500,1000, 550,950, 550,300, 500,300, 500,300, 550,1000, 500,300, 500,300, 550,1000, 550,950, 550,250, 550,1000, 500,300, 550,250, 550,1000, 500,1000, 550,300, 550,950, 550,950, 550,300, 500,300, 500,1000, 550,250, 550,300, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 600,250, 500,300, 550,250, 550,250, 550,300, 550,250, 500,300, 550,300, 500,300, 500,1000, 550,250, 550,300, 500,1000, 550,250, 550,300, 500,1000, 550,1000, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,1000, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 550,300, 500,1000, 550,1000, 500,1000, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 500,350, 500,1000, 500,1000, 500,1050, 500,1000, 500,1050, 500,300, 550};  
unsigned int Temp26[] = {3000,1650, 500,1000, 500,1050, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 450,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 450,350, 500,300, 500,1050, 500,1000, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,1050, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,1050, 450,1050, 500,1000, 500,350, 500,300, 500,300, 500,350, 450,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 450,350, 500,300, 500,350, 450,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 450,1050, 500,1000, 500,350, 500,1000, 500,1000, 500,1050, 500,1000, 500,350, 500};  
unsigned int Temp27[] = {3050,1600, 550,1000, 500,1000, 550,300, 500,300, 550,250, 550,1000, 500,300, 550,300, 500,1000, 550,1000, 500,300, 550,1000, 550,250, 500,300, 550,1000, 500,1050, 500,300, 500,1000, 550,1000, 500,300, 550,250, 550,1000, 550,250, 550,300, 500,1000, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,1000, 550,300, 500,300, 550,1000, 500,300, 500,300, 550,1000, 550,1000, 500,300, 500,300, 550,250, 550,300, 500,300, 550,300, 500,300, 500,300, 550,1000, 500,300, 550,250, 550,300, 500,300, 500,300, 500,350, 500,300, 550,250, 550,1000, 500,1000, 550,1000, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 500,300, 550,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 500,300, 500,350, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,1000, 500,1050, 500,1000, 500,350, 500};  // PANASONIC C4D3:64800024
unsigned int Temp28[] = {3100,1600, 550,950, 550,1000, 550,250, 550,250, 550,250, 550,1000, 500,300, 500,300, 550,1000, 500,1000, 550,250, 550,1000, 500,300, 550,250, 550,1000, 550,950, 550,300, 500,1000, 550,950, 550,300, 550,250, 500,1000, 550,300, 500,300, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 550,250, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 600,250, 500,300, 500,300, 550,300, 500,300, 500,1000, 550,300, 500,300, 500,1000, 550,250, 550,300, 500,1000, 550,1000, 550,250, 550,250, 550,250, 550,300, 500,300, 550,250, 550,1000, 500,1000, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,1000, 500,300, 500,1000, 550,1000, 500,1000, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 550,250, 500,300, 550,250, 550,250, 550,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,1000, 500,300, 500,300, 550,950, 550,1000, 500,1000, 550,1000, 500,300, 550};  
unsigned int Temp29[] = {3100,1550, 600,950, 500,1000, 550,300, 500,300, 500,300, 550,950, 550,300, 550,250, 550,1000, 500,1000, 550,250, 550,1000, 500,300, 550,250, 550,950, 600,950, 550,250, 550,1000, 500,1000, 550,250, 600,250, 550,950, 550,250, 550,300, 550,950, 550,250, 550,300, 550,250, 550,250, 550,250, 550,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,250, 600,250, 550,950, 550,250, 550,300, 500,1000, 550,250, 550,300, 550,950, 550,1000, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,1000, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,1000, 550,250, 550,1000, 500,1000, 550,1000, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 550,1000, 500,1000, 550,1000, 500,1000, 550,300, 500};  
unsigned int Temp30[] = {3000,1650, 500,1000, 550,1000, 500,300, 500,300, 550,250, 550,1000, 500,300, 500,300, 550,1000, 550,950, 550,250, 550,1000, 550,250, 550,250, 550,1000, 550,950, 550,300, 500,1000, 550,950, 550,300, 500,300, 550,950, 550,300, 550,250, 550,1000, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,950, 550,300, 500,300, 500,1000, 550,250, 550,300, 550,950, 550,1000, 500,300, 550,250, 550,250, 600,250, 500,300, 550,250, 550,1000, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 550,300, 500,1000, 550,950, 550,1000, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 500,1050, 500,1000, 500,350, 500,1000, 500,1000, 500,1050, 500,300, 500};  
//Change it for your remote

 

void setup() 
{
  BT_module.begin(9600); //BT works on 9600
  Serial.begin(57600); //Serial Monitor work son 57600
}

void loop()
{  
   while (BT_module.available()) //If data is coming
   {
    BluetoothData=BT_module.read(); //read it and save it
    Serial.println(BluetoothData); //print it on serial for testing purpose
   }

   if (BluetoothData != PevData)
   {
    
   if (BluetoothData == '0')
   {
    irsend.sendRaw(ACon, sizeof(ACon) / sizeof(ACon[0]), khz);  delay(2000);//Send signal to Turn On the AC
   }

   if (BluetoothData == '1')
   {
    irsend.sendRaw(ACoff, sizeof(ACoff) / sizeof(ACoff[0]), khz);  delay(2000);//Send signal to Turn on the AC
   }

   if (BluetoothData == '2')
   {
    irsend.sendRaw(Temp23, sizeof(Temp23) / sizeof(Temp23[0]), khz);  delay(2000);//Send signal to set Temperatue 23C 
   }

   if (BluetoothData == '3')
   {
    irsend.sendRaw(Temp24, sizeof(Temp24) / sizeof(Temp24[0]), khz);  delay(2000);//Send signal to set Temperatue 24C 
   }

   if (BluetoothData == '4')
   {
    irsend.sendRaw(Temp25, sizeof(Temp25) / sizeof(Temp25[0]), khz);  delay(2000);//Send signal to set Temperatue 25C 
   }

   if (BluetoothData == '5')
   {
    irsend.sendRaw(Temp26, sizeof(Temp23) / sizeof(Temp26[0]), khz);  delay(2000);//Send signal to set Temperatue 26C 
   }

   if (BluetoothData == '6')
   {
    irsend.sendRaw(Temp27, sizeof(Temp27) / sizeof(Temp27[0]), khz);  delay(2000);//Send signal to set Temperatue 27C 
   }

   if (BluetoothData == '7')
   {
    irsend.sendRaw(Temp28, sizeof(Temp28) / sizeof(Temp28[0]), khz);  delay(2000);//Send signal to set Temperatue 28C 
   }

   if (BluetoothData == '8')
   {
    irsend.sendRaw(Temp29, sizeof(Temp29) / sizeof(Temp29[0]), khz);  delay(2000);//Send signal to set Temperatue 29C 
   }

   if (BluetoothData == '9')
   {
    irsend.sendRaw(Temp30, sizeof(Temp30) / sizeof(Temp30[0]), khz);  delay(2000);//Send signal to set Temperatue 30C 
   }
   
   }

   PevData = BluetoothData;

delay(100);// prepare for next data ...
}

Video

Have any question realated to this Article?

Ask Our Community Members

Comments