Decoding IR Signals of a Blue Star Air Conditioner using an Arduino

This is part of my project to understand the IR protocol and try to decode IR signals that being send from my AC’s remote to the AC itself. So that the idea is: If I can figure out the different IR signals that being that transmitted, then I should be able to replay the traffic and control the Aircon from my PC or use my own custom IR hub instead of sending data to some third party – Alexa or Google Assistant. This may be applicable on other devices as well that use an IR transmitter/receiver like a TV/remote controlled fan/hubs.

Disclaimer: I am no means an electronics expert. This is just me experimenting and playing around trying to make sense of how IR works with no prior knowledge of how the protocol works. If you are electronics expert, then this post is probably not for you are better off pressing CTRL+W on your keyboard.

Requirements:

  1. KY-022 Infrared Receiver (38kHz)
  2. Arduino UNO U3
  3. Breadboard
  4. 3x Male to Male Jumper Cables.
  5. Arduino ID with IRremote library installed (Link)
  6. Computer to write your code. Duh!

Here is a picture of the KY-22 IR receiver.

ky-022 IR receiever picture

Circuit Connection:

Connect pin labelled “Y” on the KY-022 to Pin 11 on the Arduino
Connect pin labelled G to GND pin on the Arduino
Connect pin labelled R pin to the 5V pin on Arduino

-Below is the source for the IR decoder:

#include <IRremote.h>

int RECV_PIN = 11; // define input pin on Arduino.
IRrecv irrecv(RECV_PIN); 
decode_results results; // decode_results class is defined in IRremote.h

IRsend irsend; 

void setup() { 
  Serial.begin(9600); // Set Serial monitor baud rate
  irrecv.enableIRIn(); // Start the receiver 
} 

void loop() {

  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX); 
    irrecv.resume(); // Receive the next value 
  }
 
  delay(1000);
  
}

Upload the code to the Arduino and then navigate to Tools>Serial Monitor.

Now point your IR remote to the IR receiver sensor and press any key in the remote. Now, you should see the HEX value that was send from the remote in the serial console.

For example, a test case I pointed my AC’s remote to the IR receiver(KY-022) and pressed the power button. This result printed on the Serial Monitor was HEX value 90900E0A. Note: While pressing the power On button, the remote had 25 degrees set.

Here is a sample screenshot of the setup.

sending and decoding IR picture using KY-022

Here is a screenshot of the source and the data from the serial session.

arduino code and serial monitor displaying decoded IR signal

Similarly when pressing the Power Off button in the return, a different IR code of 80900C0A was send.

Hell Yeah!!!!! Ok, maybe I got excited bit too much.

I know this probably sounds dumb, but I did notice something interesting on how this is all put together. So, lets say the temperature of the AC in the remote is set to 16C. Now, if I press the “+” button to increase the temperature to 17C, then I see a different code and if I press it again again, I see a different code being send.

Here what the different hex codes for different temperatures look like(used by pressing the increment/+ sign on the remote):

Temp 16: 90000E0A
Temp 17: 90800E0A
Temp 18: 90400E0A
Temp 19: 90C00E0A
Temp 20: 90200E0A
Temp 21: 90A00E0A
Temp 22: 90600E0A
Temp 23: 90E00E0A
Temp 24: 90100E0A
Temp 25: 90900E0A
Temp 26: 90500E0A
Temp 27: 90D00E0A
Temp 28: 90300E0A
Temp 29: 90B00E0A
Temp 30: 90700E0A

Trying to make sense of IR (Sort Of):

So, in a programming point of view, I was expecting something like “new temperature” = “current temperature” + 1 and then set the value rite? Well this sort of the same with a slight difference which I guess is the way IR protocol works. So, the handheld IR remote has some logic in itself. Here is my assumption of what is happening.

  1. Say, the handheld IR remote for the Air Conditioner has current temperate as 16 degree Celsius (16C).
  2. Now lets say the user, clicks the + sign on the AC remote (IR transmitter) to increase the temperature from 16C to 17C. The IR device knows the old value as 16 from its on-board memory and now knows the new temperate has to be set to 17C. So here, the arithmetic operation i.e. increment is done on the client side i.e on the IR remote itself.
  3. The IR remote has a hard coded value of 17C somewhere in its code. The remote simply sends the IR signal with IR code for 17C. I.e. It will send 90800E0A to the IR Receiver.
  4. The IR receiver (in this case the AC), receives the IR code for 17C and then sets the temperature to 17C. Here, the AC has hardcoded values for each IR code for each temperature in its code. Something like: If “IR code received” == “90800E0A“, then set temperature to 17C.
  5. It looks more like each temperate value is hard coded and the IR remote has these values hard-coded.

Next, I will need to learn how to get a IR transmitter and replay these codes so that I can control my Aircon and other electronics from my PC. Maybe create a DIY IR hub and hook it to my PC?

So, I did buy a IR transmitter to replay the signals but the transmitter that I received was DOA. Well that went well. Haha!

ir transmitter picture

Anyways, will probably order a new transmitter to test this out post the whole COVID-19 shiZstorm.

Regards.

ΞXΤЯ3МΞ

Sources/Credits/References:

PS: Credits to Arduino modules for making it super simple to understand this. Below are credits/resources that helped out.

Arduino Modules.info
IR-Project
Duino4projects
Sparkfun
Robojax

DIY Honor 4C earpiece and Screen replacement

Finally, fixed my phone’s screen and broken earpiece. This is a continuation of my previous post (Disassembling my Honor 4C ) where I dismantled my old bae – Honor 4c and this is my first DIY phone repair.

Here is the repair log:

So, I bought the display and the touch screen digitizer from ebay and it got shipped in a week.

Honor 4c screen replacement from ebay

While trying to replace the screen, I accidentally damaged the earpiece (located on the top of the phone) as I pulled it out the wrong way.

Honor 4c earpiece (broken) picture

 

The red rectangle shown below is the location of the earpiece(next to the secondary camera):

Honor 4c earpiece location

Well, that didn’t go as planned 🙁

Then, I did weeks of research trying to source the earpiece for the Honor 4c online but the earpiece was not available anywhere. Finally, I found it on aliexpress for $4.53 (Link) which was a good deal (including shipping from China).

I got the earpiece delivered in 1 month. It was actually pretty fast shipping considering it was shipped from another country and cleared customs in my country which usually takes a long time. Infact, this is my first item that I purchased from China and from aliexpress.

Parcel from China

Dismantled the phone (again), fixed the earpiece, and mounted the display. And here comes the moment of truth!!!

Honor 4c is Booottttiinnnnnngg!! :D

Booot was successful. 

Tested primary and secondary camera, wifi and earpiece and it was all back to normal. 🙂

 Yaayyyy!!! 

Well, this project had its ups and downs, took long to complete but am am happy that I completed it.

Regards,

ΞXΤЯ3МΞ

Disassembling my Honor 4C

I dropped my phone while running to work and the screen broke due to the impact. I have been using this phone for a very long time (since 13th June 2015) and I dint want to let go (probably due to sentimental value). Most people would just throw the old one away and get a new one but honestly I didn’t really feel the need to get a new one. As of now, I will wait and see. Maybe eventually I might get a new one (Honor 8 Pro maybe?) but I don’t know. So I thought I would keep it with me, give it time, learn and fix it myself even thought I have no clue what I am doing. LOL! May be this whole repair thing is a bad idea and might fail, but its definitely worth a shot.

Here is the picture of the broken screen 🙁

My Honor 4C - broken LCD screen

This is the first time ever that I am taking apart a phone completely so pardon me for any mistakes. I had completed dissembling this phone a while back but just didnt get the time to post about it due to work.

So, I googled for weeks on tutorials on stuff like how to open up this phone, the tools you need and stuff like that.

So, I bought a mobile repair kit which basically has a few screwdrivers, 2 x guitar strum looking things, 2 plastic crowbars and a suction cup. Here is a picture of the kit:

mobile repair kit

So, first thing I did was to remove the back shell.

Honor 4c back shell

So, this is how the back portion looks after removing the back shell.

So, I started off by removing the screws near the battery and then the outer ones. Attaching a picture for their location for reference:

It took me a while to figure out that there under the “Torn invalid” sticker, there is a star screw hidden underneath it. Attaching a picture for reference below:

Now, we can gently take out the blue casing. This is what looks like once we remove the blue casing on the Honor 4c.

My baby is so pretttyyy on the inside!! 🙂 😛

To remove the battery, I had to remove the two screws on the right side of the battery as shown in the red box below:

remove the two battery screws

Now to pop the battery out, I had to lift and disconnect the battery connector as show below.

After disconnecting the battery cable, I was able to remove the battery by simply lifting the battery up.

So, this is how the battery looks like:

back side of the battery

After the removing the battery, disconnect/pull  the below cable.

Honor 4c left side cable

Then disconnect the below two cables.

honor 4c two cables

 

Now, we can separate the motherboard from the phone.

removing honor 4c motherboard removing honor 4c motherboard 2

This is what my Honor 4c motherboard looks like.

 

Honor 4c motherboard

This is what the backside of the display looks like:(which has the Frame which holds the Display and the Touch Screen Digitizer).

Honor 4C LCD Display and Frame

So, I was able to disassemble my phone successfully! Wohoo!! 🙂 I know this is not a big deal for most people but its a big deal to me. I honestly didn’t think I could make it this far as I was alone in this learning journey. I am glad that I gained some knowledge on dissembling phones which is something I had never done before. I did make a video with audio instructions on the whole disassembly process but I am not sure I should upload it to my youtube channel or not. Lemme know what you think below in the comments section.

Do you think its worth repairing this and having it fixed? If you were in my shoes, would you hold on to your old phone?

Leave your comments in the comment section down below. I would love to hear what you have to say.

As always stay happy!  🙂

Happy blogging!

Regards,
ΞXΤЯ3МΞ