Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Samsung IR codes checksum

I had a long time decoding IR codes with optimum's Ken Shirriff Arduino Library. I modified the code a bit so that I was able to dump a Samsung air conditioner (MH026FB) 56-bit signals.

The results of my work is located in Google Docs document Samsung MH026FB AirCon IR Codes Dump.

It is a spreasheet with all dumped values and the interpretation of results. AFAIK, air conditioner unit sends out two or three "bursts" of 56 bit data, depending on command. I was able to decode bits properly, figuring out where air conditioner temperature, fan, function and other options are located.

The problem I have is related to the checksum. In all those 7-byte codes, the second one is computed somehow from the latter 5 bytes, for example:

BF B2 0F FF FF FF F0   (lead-in code)
7F B8 8A 71 F6 4F F0   (auto mode - 25 degrees)
7F B2 80 71 7A 4F F0   (auto mode - 26 degrees)
7F B4 80 71 FA 7D F0   (heat mode - 26 degrees - fan auto)

Since I re-create the IR codes at runtime, I need to be able to compute checksum for these codes.

I tried with many standard checksum algorithms, none of them gave meaningful results. The checksum seems to be related to number of zeroes in the rest of code (bytes from 3 to 7), but I really can't figure it how.

Is there a solution to this problem?

like image 858
Shine Avatar asked Feb 03 '26 13:02

Shine


2 Answers

Ken Shirriff sorted this out. Algorithm is as follow:

  1. Count the number of 1 bits in all the bytes except #2 (checksum)
  2. Compute count mod 15. If the value is 0, use 15 instead.
  3. Take the value from 2, flip the 4 bits, and reverse the 4 bits.
  4. The checksum is Bn where n is the value from the previous step.

Congraturations to him for his smartness and sharpness.

like image 105
Shine Avatar answered Feb 06 '26 10:02

Shine


When bit order in bytes/packets and 0/1 are interpreted properly (from the algorithm it appears that both are reversed), the algorithm would be just sum of 0 bits modulo 15.

like image 39
Dmitry Avatar answered Feb 06 '26 12:02

Dmitry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!