Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. AC IR code decrypting

AC IR code decrypting

Scheduled Pinned Locked Moved Development
42 Posts 8 Posters 18.4k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Nca78N Nca78

    Hello,

    what are the brand and model of your AC and and how do you get this data (processor/board, IR library used, ...) ? It seems you have something wrong as you don't have full bytes. When I try to split in bytes I have 3 bits alone at the end so you are missing data somewhere.

    Usually the checksum is just a xor. It doesn't seem to be the case for yours, but maybe it's because you are missing some data.

    dpressleD Offline
    dpressleD Offline
    dpressle
    wrote on last edited by
    #5

    @Nca78 Thanks for the answer.
    The brand of the AC is a local brand called "Tadiran" (not sure if its world distributed).
    I am capturing the IR code with following arduino code, please note you need this code because AC have very long IR code since every button push the whole state is sent i.e. fan speed temp mode etc.
    Now i know that the code i am capturing is good because i can successfully transmit it back using any IR library.

    I agree on the uneven bytes and could not figure this out as well, i also tried the XOR checksum and couldn't get it to match.
    The output i am getting from the code is of time delays which i later convert to binary i use the follow mapping to convert to bin:
    HDR_MARK 9000
    HDR_SPACE 4000
    BIT_MARK 620
    ONE_SPACE 1600
    ZERO_SPACE 540
    MSG_SPACE 19000

    Please note that there is a message space of around 19 ms that separates the message in to 2 parts, the second part does not change beside the last 4 digits which i think is the checksum. the long pause is right after the 3 digits, so for an example look at the code i got below for a certain operation, they all got the same checksum:
    cold, 26 C
    Fan:
    Auto
    100100000101000000000110000 0101001000000000000001000000000000001111
    Fan1
    100110000101000000000110000 0101001000000000000001000000000000001111
    Fan2
    100101000101000000000110000 0101001000000000000001000000000000001111
    Fan3
    100111000101000000000110000 0101001000000000000001000000000000001111

    I appreciate the help and hope we can resolve this as i am about to give up...

    #define IRpin_PIN PIND
    #define IRpin 2
    
    
    // for MEGA use these!
    //#define IRpin_PIN PINE
    //#define IRpin 4
    
    
    // the maximum pulse we'll listen for - 65 milliseconds is a long time
    #define MAXPULSE 65000
    
    
    // what our timing resolution should be, larger is better
    // as its more 'precise' - but too large and you wont get
    // accurate timing
    #define RESOLUTION 20
    
    
    // we will store up to 300 pulse pairs (this is -a lot-)
    uint16_t pulses[300][2]; // pair is high and low pulse
    uint8_t currentpulse = 0; // index for pulses we're storing
    
    
    void setup(void) {
      Serial.begin(9600);
      Serial.println("Ready to decode IR!");
    }
    
    
    void loop(void) {
      uint16_t highpulse, lowpulse; // temporary storage timing
      highpulse = lowpulse = 0; // start out with no pulse length
      
      
    // while (digitalRead(IRpin)) { // this is too slow!
        while (IRpin_PIN & (1 << IRpin)) {
         // pin is still HIGH
    
    
         // count off another few microseconds
         highpulse++;
         delayMicroseconds(RESOLUTION);
    
    
         // If the pulse is too long, we 'timed out' - either nothing
         // was received or the code is finished, so print what
         // we've grabbed so far, and then reset
         if ((highpulse >= MAXPULSE) && (currentpulse != 0)) {
           printpulses();
           currentpulse=0;
           return;
         }
      }
      // we didn't time out so lets stash the reading
      pulses[currentpulse][0] = highpulse;
      
      // same as above
      while (! (IRpin_PIN & _BV(IRpin))) {
         // pin is still LOW
         lowpulse++;
         delayMicroseconds(RESOLUTION);
         if ((lowpulse >= MAXPULSE) && (currentpulse != 0)) {
           printpulses();
           currentpulse=0;
           return;
         }
      }
      pulses[currentpulse][1] = lowpulse;
    
    
      // we read one high-low pulse successfully, continue!
      currentpulse++;
    }
    
    
    void printpulses(void) { 
      // IR Remote Results 
      Serial.println("For IR Remote Arduino sketch: ");
      Serial.print("unsigned int raw[");
      Serial.print(currentpulse*2, DEC);
      Serial.print("] = {");
      for (uint8_t i = 0; i < currentpulse; i++) {
        if(i!=0){
        Serial.print(pulses[i][0] * RESOLUTION, DEC);
        Serial.print(", ");
        }
        Serial.print(pulses[i][1] * RESOLUTION, DEC);
        Serial.print(", ");
      }
      Serial.print("};");
      Serial.println("");
      Serial.print("irsend.sendRaw(raw,");
      Serial.print(currentpulse*2, DEC);
      Serial.print(",38);");
      Serial.println("");
      Serial.println("");
    }```
    1 Reply Last reply
    0
    • YveauxY Yveaux

      @dpressle you probably just want to control your airco from mysensors, right?
      Just an idea, but you could also just replay the captured IR sequence, without worrying about the content.

      dpressleD Offline
      dpressleD Offline
      dpressle
      wrote on last edited by
      #6

      @Yveaux Yes, but i want to be able to control each of the parameters separately and not have to record many operations

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pjr
        wrote on last edited by
        #7

        Most likely its manufactured by GREE just like most of local branded stuff ;)

        dpressleD 1 Reply Last reply
        0
        • siklosiS siklosi

          Maybe this will work
          0_1469012872255_upload-7ea967fd-ad75-4816-b5fa-90a88126d92f

          dpressleD Offline
          dpressleD Offline
          dpressle
          wrote on last edited by
          #8

          @siklosi Thanks but this is for a different AC with different protocol.
          The biggest problem with these AC companies is that each one creates its own protocol and makes our lives hard...

          1 Reply Last reply
          0
          • P pjr

            Most likely its manufactured by GREE just like most of local branded stuff ;)

            dpressleD Offline
            dpressleD Offline
            dpressle
            wrote on last edited by
            #9

            @pjr Dont know this one, not sure your local is my local :wink:

            1 Reply Last reply
            0
            • Nca78N Offline
              Nca78N Offline
              Nca78
              Hardware Contributor
              wrote on last edited by
              #10

              Can you please indicate in one of the messages where the 19ms "space" exactly is ?
              Maybe the 3 extra bits are related to this space and they should be discarded before/after the space ?

              Never heard about this brand, where do you live ?

              dpressleD 1 Reply Last reply
              0
              • Nca78N Nca78

                Can you please indicate in one of the messages where the 19ms "space" exactly is ?
                Maybe the 3 extra bits are related to this space and they should be discarded before/after the space ?

                Never heard about this brand, where do you live ?

                dpressleD Offline
                dpressleD Offline
                dpressle
                wrote on last edited by
                #11

                @Nca78 The space is where the space is in the binary i wrote (its actually hard to see):
                100100000101000000000110000 19 ms space 0101001000000000000001000000000000001111

                I am from Israel.

                Thanks.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  ToniA
                  wrote on last edited by
                  #12

                  Would these help:

                  https://github.com/ToniA/arduino-heatpumpir
                  https://github.com/ToniA/Raw-IR-decoder-for-Arduino

                  dpressleD 1 Reply Last reply
                  0
                  • dpressleD Offline
                    dpressleD Offline
                    dpressle
                    wrote on last edited by
                    #13

                    I can send the timings i get from the code before i convert to bin, since i am converting it with notepad++ i might be wrong.

                    1 Reply Last reply
                    0
                    • T ToniA

                      Would these help:

                      https://github.com/ToniA/arduino-heatpumpir
                      https://github.com/ToniA/Raw-IR-decoder-for-Arduino

                      dpressleD Offline
                      dpressleD Offline
                      dpressle
                      wrote on last edited by
                      #14

                      @ToniA I love your library but non of your pre-defined AC's worked for mine.
                      I will defiantly use it once i crack the code of this AC and will pull it to your repository.

                      Thanks.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        ToniA
                        wrote on last edited by
                        #15

                        How about writing a new decode module into Raw-IR-decoder-for-Arduino? I find it very useful in trying to figure out how a certain A/C protocol works.

                        dpressleD 1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          pjr
                          wrote on last edited by pjr
                          #16

                          Gree is the most largest manufacturer of AC devices and Tadiran outdoor unit looks quite a lot like Gree.. at least I'd try that first.

                          e: Oh. Looks like Carrier also has some relation with Tadiran.

                          T 1 Reply Last reply
                          0
                          • T ToniA

                            How about writing a new decode module into Raw-IR-decoder-for-Arduino? I find it very useful in trying to figure out how a certain A/C protocol works.

                            dpressleD Offline
                            dpressleD Offline
                            dpressle
                            wrote on last edited by
                            #17

                            @ToniA can you elaborate?

                            Nca78N 1 Reply Last reply
                            0
                            • dpressleD dpressle

                              @ToniA can you elaborate?

                              Nca78N Offline
                              Nca78N Offline
                              Nca78
                              Hardware Contributor
                              wrote on last edited by
                              #18

                              @dpressle said:

                              @ToniA can you elaborate?

                              From wikipedia :
                              "Tadiran Appliances (also known as Tadiran Air Conditioners), was acquired by the Carrier Corporation, the world’s largest manufacturer and distributor of heating, ventilating and air conditioning (HVAC) systems, itself a subsidiary of United Technologies Corporation (UTC) of the USA and a constitute of Dow Jones Industrial Average. Carrier initially acquired 26%of the company in 1997 and took full ownership of it in 2004.[2]"

                              So looking for Carrier AC infrared should probably help.
                              Is the reference of your remote control (on the sticker at the back) YB1FA ? As it seems to be shared by gree/carrier/tadiran/ferroli/condor

                              1 Reply Last reply
                              0
                              • Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by Nca78
                                #19

                                From the temperature codes, the checksum is obviously a sum, you have to reverse the bits before you sum, the MSB is on the right in both data bits and checksum.

                                16° 0000 checksum 0101
                                17° 0001 checksum 0110 = 0101 + 0001
                                18° 0010 checksum 0111 = 0101 + 0010
                                19° 0011 checksum 1000 = 0101 + 0011
                                20° 0100 checksum 1001 = 0101 + 0100
                                ...
                                27° 1101 checksum 0000 because 0101 + 1101 = 10000 and you keep only the last 4 bits

                                Now we just need to understand what bits are included or not in the sum, it seems the fan speed is not, but we need more messages in different modes and with different settings to be able to know which bits are used or not in the calculation.

                                I take your example code :
                                100100000101000000000110000 19 ms space 0101001000000000000001000000000000001111
                                Split in 4 bits words :
                                1001
                                0000
                                0101
                                0000
                                0000
                                0110
                                000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                0101
                                0010
                                0000
                                0000
                                0000
                                0100
                                0000
                                0000
                                0000
                                1111

                                Invert bit order and try to guess what words are included or not.
                                If you make the sum of included words with binary calculator, it matches the checksum but we must validate with more parameters changed, try with horizontal/vertical swing if you have these on the remote control, then any other specific function.

                                1001 => on + mode, included as it's the only one with LSB = 1 and we have LSB = 1 in checksum
                                0000 => fan speed, not included as shown in your examples on fan speed
                                1010 => temp 16°C + value, included as shown in your examples of temperature
                                0000 => ??? cannot know because 0
                                0000 => ??? cannot know because 0
                                0110 => I think included else I don't have the right checksum
                                000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                1010 => I think not included else I don't have the right checksum
                                0100 => I think included else I don't have the right checksum
                                0000 => ??? cannot know because 0
                                0000 => ??? cannot know because 0
                                0000 => ??? cannot know because 0
                                0100 => I think included else I don't have the right checksum
                                0000 => ??? cannot know because 0
                                0000 => ??? cannot know because 0
                                0000 => ??? cannot know because 0
                                1111 => binary sum of all included words, only the 4 LSB bits are kept

                                dpressleD 2 Replies Last reply
                                0
                                • Nca78N Nca78

                                  From the temperature codes, the checksum is obviously a sum, you have to reverse the bits before you sum, the MSB is on the right in both data bits and checksum.

                                  16° 0000 checksum 0101
                                  17° 0001 checksum 0110 = 0101 + 0001
                                  18° 0010 checksum 0111 = 0101 + 0010
                                  19° 0011 checksum 1000 = 0101 + 0011
                                  20° 0100 checksum 1001 = 0101 + 0100
                                  ...
                                  27° 1101 checksum 0000 because 0101 + 1101 = 10000 and you keep only the last 4 bits

                                  Now we just need to understand what bits are included or not in the sum, it seems the fan speed is not, but we need more messages in different modes and with different settings to be able to know which bits are used or not in the calculation.

                                  I take your example code :
                                  100100000101000000000110000 19 ms space 0101001000000000000001000000000000001111
                                  Split in 4 bits words :
                                  1001
                                  0000
                                  0101
                                  0000
                                  0000
                                  0110
                                  000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                  0101
                                  0010
                                  0000
                                  0000
                                  0000
                                  0100
                                  0000
                                  0000
                                  0000
                                  1111

                                  Invert bit order and try to guess what words are included or not.
                                  If you make the sum of included words with binary calculator, it matches the checksum but we must validate with more parameters changed, try with horizontal/vertical swing if you have these on the remote control, then any other specific function.

                                  1001 => on + mode, included as it's the only one with LSB = 1 and we have LSB = 1 in checksum
                                  0000 => fan speed, not included as shown in your examples on fan speed
                                  1010 => temp 16°C + value, included as shown in your examples of temperature
                                  0000 => ??? cannot know because 0
                                  0000 => ??? cannot know because 0
                                  0110 => I think included else I don't have the right checksum
                                  000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                  1010 => I think not included else I don't have the right checksum
                                  0100 => I think included else I don't have the right checksum
                                  0000 => ??? cannot know because 0
                                  0000 => ??? cannot know because 0
                                  0000 => ??? cannot know because 0
                                  0100 => I think included else I don't have the right checksum
                                  0000 => ??? cannot know because 0
                                  0000 => ??? cannot know because 0
                                  0000 => ??? cannot know because 0
                                  1111 => binary sum of all included words, only the 4 LSB bits are kept

                                  dpressleD Offline
                                  dpressleD Offline
                                  dpressle
                                  wrote on last edited by
                                  #20

                                  @Nca78 I think you are on to something, thanks a lot. I will investigate it further, but in the mean time here is some more data that i took:
                                  mode fan temp
                                  cold auto 26
                                  1001 0000 0101 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1111
                                  cold auto 25
                                  1001 0000 1001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 0111
                                  cold auto 24
                                  1001 0000 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1011
                                  cold fan1 24
                                  1001 1000 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1011
                                  cold fan2 24
                                  1001 0100 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1011
                                  cold fan3 24
                                  1001 1100 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1011
                                  dry fan1 24
                                  0101 1000 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 0111
                                  air fan1 24
                                  1101 1000 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1111
                                  heat fan1 24
                                  0011 1000 0001 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 0000
                                  OFF cold auto 26
                                  1000 0000 0101 0000 0000 0110 0000 1010 010 - 0000 0000 0000 0100 0000 0000 0000 1110

                                  1 Reply Last reply
                                  0
                                  • Nca78N Nca78

                                    From the temperature codes, the checksum is obviously a sum, you have to reverse the bits before you sum, the MSB is on the right in both data bits and checksum.

                                    16° 0000 checksum 0101
                                    17° 0001 checksum 0110 = 0101 + 0001
                                    18° 0010 checksum 0111 = 0101 + 0010
                                    19° 0011 checksum 1000 = 0101 + 0011
                                    20° 0100 checksum 1001 = 0101 + 0100
                                    ...
                                    27° 1101 checksum 0000 because 0101 + 1101 = 10000 and you keep only the last 4 bits

                                    Now we just need to understand what bits are included or not in the sum, it seems the fan speed is not, but we need more messages in different modes and with different settings to be able to know which bits are used or not in the calculation.

                                    I take your example code :
                                    100100000101000000000110000 19 ms space 0101001000000000000001000000000000001111
                                    Split in 4 bits words :
                                    1001
                                    0000
                                    0101
                                    0000
                                    0000
                                    0110
                                    000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                    0101
                                    0010
                                    0000
                                    0000
                                    0000
                                    0100
                                    0000
                                    0000
                                    0000
                                    1111

                                    Invert bit order and try to guess what words are included or not.
                                    If you make the sum of included words with binary calculator, it matches the checksum but we must validate with more parameters changed, try with horizontal/vertical swing if you have these on the remote control, then any other specific function.

                                    1001 => on + mode, included as it's the only one with LSB = 1 and we have LSB = 1 in checksum
                                    0000 => fan speed, not included as shown in your examples on fan speed
                                    1010 => temp 16°C + value, included as shown in your examples of temperature
                                    0000 => ??? cannot know because 0
                                    0000 => ??? cannot know because 0
                                    0110 => I think included else I don't have the right checksum
                                    000 19 ms space => I ignore this part as it's not matching the 4 bits words, and only 0s anyway
                                    1010 => I think not included else I don't have the right checksum
                                    0100 => I think included else I don't have the right checksum
                                    0000 => ??? cannot know because 0
                                    0000 => ??? cannot know because 0
                                    0000 => ??? cannot know because 0
                                    0100 => I think included else I don't have the right checksum
                                    0000 => ??? cannot know because 0
                                    0000 => ??? cannot know because 0
                                    0000 => ??? cannot know because 0
                                    1111 => binary sum of all included words, only the 4 LSB bits are kept

                                    dpressleD Offline
                                    dpressleD Offline
                                    dpressle
                                    wrote on last edited by
                                    #21

                                    @Nca78 can you please explain why do you add 0101 to the checksum in the temperature example?

                                    Nca78N 1 Reply Last reply
                                    0
                                    • dpressleD dpressle

                                      @Nca78 can you please explain why do you add 0101 to the checksum in the temperature example?

                                      Nca78N Offline
                                      Nca78N Offline
                                      Nca78
                                      Hardware Contributor
                                      wrote on last edited by Nca78
                                      #22

                                      @dpressle
                                      I add it because it is the initial value of the checksum when temperature is 16°C = 0000
                                      I just wanted to show than an increase of 1 in temperature was producing an increase of 1 in checksum.

                                      I think your minus sign (= 19ms pause ?) is in wrong position as it is supposed to be after the 6 (and not 8 ) first words ?

                                      Please take some values by changing the horizontal and vertical swing so we can try to change the second part of the message. After that try some other functions if you have (anything like "eco"/"quiet"/"turbo" options for example) and also if you have it the timer.

                                      dpressleD 1 Reply Last reply
                                      0
                                      • Nca78N Nca78

                                        @dpressle
                                        I add it because it is the initial value of the checksum when temperature is 16°C = 0000
                                        I just wanted to show than an increase of 1 in temperature was producing an increase of 1 in checksum.

                                        I think your minus sign (= 19ms pause ?) is in wrong position as it is supposed to be after the 6 (and not 8 ) first words ?

                                        Please take some values by changing the horizontal and vertical swing so we can try to change the second part of the message. After that try some other functions if you have (anything like "eco"/"quiet"/"turbo" options for example) and also if you have it the timer.

                                        dpressleD Offline
                                        dpressleD Offline
                                        dpressle
                                        wrote on last edited by
                                        #23

                                        @Nca78 OK, i will generate more commands and see if it makes more sense, Thanks for your help.

                                        1 Reply Last reply
                                        0
                                        • P pjr

                                          Gree is the most largest manufacturer of AC devices and Tadiran outdoor unit looks quite a lot like Gree.. at least I'd try that first.

                                          e: Oh. Looks like Carrier also has some relation with Tadiran.

                                          T Offline
                                          T Offline
                                          ToniA
                                          wrote on last edited by
                                          #24

                                          @dpressle said:

                                          @ToniA can you elaborate?

                                          Yes, on my AC IR decoder sketch I have decoder modules for different heatpumps. Like this:

                                          https://github.com/ToniA/Raw-IR-decoder-for-Arduino/blob/master/MitsubishiElectric.cpp

                                          So, write a new one, and add a call to it into https://github.com/ToniA/Raw-IR-decoder-for-Arduino/blob/master/rawirdecode.ino#L315. First you need to write a condition to recognize the protocol (like, from the first bytes + length etc). Then just start adding functionality, like decoding the temperature, then operating mode etc.

                                          dpressleD 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          14

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular