Sunday 14 January 2018

Build a Transistor Circuit Board for Controlling Air Conditioner Remote Control With Arduino



























I was supporting a group of student on their graduation project. One of the difficulties they faced was on controlling an A/C unit with Arduino microcontroller.

The first experiment we tried to work it out was by record the A/C remote control beam signal for each needed button by using the IRrecvDump code with IRremote library for Arduino (https://github.com/shirriff/Arduino-IRremote). Then, use these signals to send it to the A/C unit directly. The main problem we faced was on analyzing the ON/OFF signal code. The ON/OFF signal code curries more than one signal code. This includes switch signal + fan speed + thermostat degree. Some times this could include the conditioning mode, as well, such as Dray, Cool, Fan etc. Basically, this was unsuccessful method to work with all A/C remote controls.

The second experiment was by hacking the remote control by adding a sort of wires then attached to Arduino over a relay. Modern remote controls are quite sophisticated and not easy to hack. One mistake in soldering could cause fail of that remote. So, it was too risky to hack and modify the original A/C remote control. However, we did some soldering test on unused remote control until we succeed. Then we wire it up to a number of relay module to control it with Arduino. But relay is quite expensive so that we needed to do a cheap hack without spending much money. Also we want to use less wires to be attached to Arduino to get extra space to add more features.

After first and second experiments we come up with a successful way to control the A/C unit. In this experiment, we got rid of using relay also we didn't need to risk our original remote control. So that, we put our hand on a Universal A/C remote control. Then do some hack to that remote to control the A/C through Arduino interface. This will give us a chance to control different type of A/C. The one we hacked is capable to control 1000 A/C manufacturer type.

Step 1: Gathering Tools





















First of all, you will need to prepare some tools. I'm using:
* Clamps and holders: this helps me to hold the circuit board while soldering.
* Soldering iron set.
* pliers (long & cutter).
* Scalpel blade: I use it to unseal the protective layer over the copper in the A/C remote control, to make it easy to solder a wire to it.
* Jumper wires: a suitable one to connected to Arduino board.
* resistors: I'm using 22K to protect the NPN transistor from overheating and/or damage.
* NPN transistors: any kind of NPN. Use the multimeter to figure out the E B C pins.
* Pins strip & its headers: those are goes to the base and remote control for the interaction.
* Multimeter: I use it for double check the wiring and for finding the NPN transistor pins.
* PCB board: I'm using stripboard type. It is easy to deal with, also, less soldering.
* Marker pen: It used to identify parts on circuit board.
* Drill set with its attachment: I use it for drilling hols into PCB boards. Also for cutting the back cover of the remote control for header pins.
* Drill holder (optional).
* Some screwdriver: for removing the remote control back cover. I'm using a plastic tool kit (that uses with mobile phones), it leaves no scratch on the remote body.
* Tape: I use it for holding the remote control LCD screen and protect it.
* A soft sponge tape: I use it to protect the back of the board base from any direct contact. Also for leveling remote on base.

Step 2: Open the Remote Control & Locate Buttons Line























This is a bit tricky step. First you have to use a screwdriver (screwdriver plastic) to open the remote control chest. Then, you will need to identify both lines for each button.

Some remote controls has a common line for all buttons (see this http://tronixstuff.files.wordpress.com/2011/04/remotepcbss.jpg). This is too easy to hack.
Mostly, modern remote controllers has complicated set of lines. Which could has a shared line that can be common and main (signal) sequentially with each other.

In this step, I identified each combined line with different colors.
From the picture, you will notice that each button has two different colors (e.g. to press on ON/OFF button we have to contact the Red & purple lines).

Also, because I'm using this remote with Arduino, I discard the use of the buttons on bottom, which they set the timing and manage the Air Conditioner to start or stop on a specified time. As this can be easily programmed with Arduino it self. These buttons are identified with color GRAY, which is the common line. So I didn't take it into account.

The final colors combination are PURPLE, RED, BROWN, GREEN, BLUE and YELLOW.

Next step, we will included the header pins to the A/C remote control board.

NOTE THAT YOU CAN USE ANY UNUSED PLASTIC BUSINESS CARD TO OPEN THE REMOTE CHEST SAFELY.

Step 3: Drilling & Soldering

In this step, you need to locate a perfect spot for adding the header pins. Also you have to notice where it should be go through the back cover of the remote control.

I located this spot because it is easy to reach most lines.

In addition, add some tape to the LCD screen to hold it and protect it while soldering and drilling.

* Use the marker pen to locate holes for the header pins.
* Double check that pins are goes fine every time you make a hole.
* Putting a tape shows how the header looks like before you carry on.
* After checking that it fit nicely, make sure there is nothing on the way that can be stuck from both side of the board.
* You have to use a scalpel to remove the layer over the copper in front of the selected pins.
* Start to bend some pins to make a direct contact with lines. Then apply some solder.
* In some case, you will need to use a tiny wire (like those on headphone cable) as bridge.
* For those away lines, try and drill hols next to selected pins and so for lines.
* Apply some glue to hold the header pins from move or broke.

Step 4: Finishing-up & Sealing the Remote Control

After finish from soldering, now it is time to grave a slot at the back cover of remote control.
You will need a small drill. I'm using my Dremel Cordless Rotary Tool.

* First, try to locate and mark where the header pins go trough. You have to be patient.
* When necessarily, remove any extra parts from the heard way.
* Try not to make oversize slot hole, otherwise, you may face some problems when placing on base.
* Have a look at the slot from the back to make sure everything is fine.
* Finally, place back both covers together.

Step 5: Designing the Remote Controller Baseboard

















I'm quite weak with electronic circuit. Here I seeked for some help from my brother. He has more experience with circuit boards than me. Also, without doubt, YOUTUBE helps me a lot.

In this step, we needed to design a cheap & easy to build circuit board that deal with A/C remote control as a fixed base.
After googling & doing some search, we barely found a perfect way to control the an A/C unit. Most projects shows how to hack a remote control and leave it open. Which it cannot be used as normal handheld remote control as before. In addition, many projects uses a relay module to short the buttons circuit. This could be quite expensive and/or ended with an ugly look and nosy.

However, all what we need is a small and easy to build circuit. Which can be able to open and close the circuit to make the short connection. So we are using an NPN transistor to do this.

For some information & tutorials about NPN and differences between NPN & PNP transistors, have a look at this video:
http://www.youtube.com/watch?v=DLl7-CmVT7w&feature=relmfu

* You need to identify the E, B and C pins of that NPN. I used the multimeter to do so. (Sorry, I didn't explain this here. You can youtube it)
* B goes to resistor (10K& - 22K&) then to Arduino digital pin.
* E is the common pin between all NPN transistors. This will go to Arduino GND pin.
* C connected directly to each pin on the A/C remote control lines.

NOTE THIS DESIGNING PICTURE HAS 4 NPN TRANSISTORS AS AN EXAMPLE. YOU CAN ADD AS MUSH AS YOU NEED.

Next step shows how to build the base for A/C remote control that connected to Arduino board.

Step 6: Building the Baseboard

It is so obvious here that PCB stripboard helped me a lot. I didn't need to do much soldering. Also, it looks more organized in a perfect way.

Based on the previous step, I built the baseboard by soldering the NPN and resistors. Also, I add the wires which connected to Arduino digital pins.
Now it is time to locate the perfect place where the remote control placed on baseboard.
* Add the pins strip to the remote back heard.
* Place it in the center of the base.
* Make sure to keep away from the NPN & resistors.
* Mark it if necessarily.
* Make notches to separate some copper on the PCB stripboard.
* Apply soldering.
* Add wires, then solder it as well.

Step 7: Programming & Coding

Now here come the time to program it. You can use the BLINK sketch on the Arduino example code as a start.

- First of all, in setup function, you need to initialize the digital pins as an output. Also make sure all pins are set to "LOW". This will prevent from pressing on any key by mistake when Arduino star-up.

void setup() {             
  // initialize the digital pins as an output.

 pinMode(2, OUTPUT);      // PURPLE
  pinMode(3, OUTPUT);      // RED
  pinMode(4, OUTPUT);      // BROWN
  pinMode(5, OUTPUT);      // GREEN
  pinMode(6, OUTPUT);      // BLUE
  pinMode(7, OUTPUT);      // YELLOW

  digitalWrite(2, LOW);    // set the pin to OFF
  digitalWrite(3, LOW);    // set the pin to OFF
  digitalWrite(4, LOW);    // set the pin to OFF
  digitalWrite(5, LOW);    // set the pin to OFF
  digitalWrite(6, LOW);    // set the pin to OFF
  digitalWrite(7, LOW);    // set the pin to OFF
}


- To switch ON the A/C unit, first, identify the button color then pin number. After that, add this code to loop function. From the picture above, notice the ON/OFF pins on arduino are D3 (RED) and D6 (BLUE). Those pins should set to "HIGH" for 10ms then to "LOW".

void loop() {
  digitalWrite(3, HIGH);   // press button
  digitalWrite(6, HIGH);
  delay(10);              // wait for a response to take effect
  digitalWrite(3, LOW);    // release button
  digitalWrite(6, LOW);


  while(1 == 1) {          // to prevent loop on Arduino
  }

}

- I added the while condition to stop Arduino from pressing on key constantly.

- If you want to set the A/C temperiture 3 degres up, then you will need to add for loop. But first, identify which pins control that button. In this case they are D4 (BROWN) and D5 (GREEN).

for(int i = 0; i < 3; i++) {
    digitalWrite(4, HIGH);   // press button
    digitalWrite(5, HIGH);
    delay(10);               // wait for a response to take effect
    digitalWrite(4, LOW);    // release button
    digitalWrite(5, LOW);
    delay(1000);           // wait one second between each press
  }


- I added anther delay within one second to simulate the real press on remote keys by hand. This will leave a brake time until the A/C unit response to the previous signal.

VIDEO:


Additional notes:
* Make sure all the pins on Arduino set to "LOW" when it is not needed.
* Arduino has a continuance loop function which will not stop or terminate until you force it to.
* A Universal Air Conditioner remote control has a hundreds number of codes to deal with different units. Make sure you set it to your own unit before use it with Arduino.
* You can put a label on the back of your A/C remote control to identify each pin with Arduino pins.
* Using the baseboard makes the remote control easy to carry when its no need to place it on its base.
* Beside the prices of Arduino, wires and PCB board, the A/C Universal Remote Control cost is about 12$. The total cost, including all stuff, is around 65$.


Future work:
This is not a complete project. It has some issues. E.g. when the Arduino set A/C unit to a specific configuration then someone takes off the remote from its base and reset it to a different configuration. In this case, Arduino has no idea what new configuration it has been set.
As a solution, we can add Arduino Mini to the remote control (http://arduino.cc/en/Main/ArduinoBoardProMini). This will record any new configuration that has been set in time the remote control is not on its base.
Also, there can be added a wireless Xbee module, so that, we can get rid of the baseboard. So with any key pressed, it will send the new configuration to the main Arduino interface.


I hope this could help you in your projects.
Please leave a comments if there is any
incomprehensible step.

THANKS FOR YOUR ATTENTION :D

No comments:

Post a Comment