title: Samsung IR codes checksum
body: <p>I had a long time decoding IR codes with optimum's <a href="http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html" rel="nofollow">Ken Shirriff</a> Arduino Library. I modified the code a bit so that I was able to dump a Samsung air conditioner (MH026FB) 56-bit signals.</p>
  
  <p>The results of my work is located in Google Docs document <em><a href="https://docs.google.com/spreadsheet/ccc?key=0Aupzmp8AqC8JdGtNOXhUc0R0WC1hbVdRa0p3aDVxdFE#gid=0" rel="nofollow">Samsung MH026FB AirCon IR Codes Dump</a></em>.</p>
  
  <p>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&nbsp;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.</p>
  
  <p>The problem I have is related to the <strong>checksum</strong>. In all those 7-byte codes, the <strong>second one</strong> is computed somehow from the latter 5&nbsp;bytes, for example:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Since I re-create the IR codes at runtime, I need to be able to <strong>compute checksum</strong> for these codes.</p>
  
  <p>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.</p>
  
  <p>Is there a solution to this problem?</p>