Back in a previous post I tried to decode the barometer reading from the AcuRite console. I just couldn't get it, but one of the readers, Play Kube, stepped up and nailed it for us. The post is here <link> and his findings are down in the comments. He emailed them to me and I posted them for him. Then I added code to my stuff and recorded the readings for a few days and this is the correlation to my (very accurate) fence post barometer. I spent quite a bit of time making sure my barometer compared to the weather stations around me and it was dead on. The decoded AcuRite readings follow mine really, really well. Take a look:
Isn't that great? There's a couple of caveats though: The console barometer is NOT temperature or altitude corrected. That's because we don't have access to the temperature or altitude corrections that the chip manufacturer supplies inside the chip. These values can be read and the math applied to get the reading dead on, but we don't have them to work with.
The way I corrected the readings was to simply adjust the algorithm to compensate. This means that if I move the console up or down by a significant amount (I move to sea level) or the temperature changes (put it in the sun) the readings will change. However, in most of our houses the temperature stays pretty stable and it's unlikely we'll be moving soon. If one of these does happen, just readjust the algorithm and you'll be all set for the next time.
Looking at the chart, the difference in the readings is less than a mbar and tracks exactly. Here's the code I used to decode the reading:
float bar = 6.23 * (R2[23] << 8 | R2[24]) - 20402;
weatherData.barometer = bar / 100; // convert to mbar from pascals
weatherData.barometer += 81.1; //adjust for altitude
It's a simple linear equation like a line graph from high school algebra. Take the last two bytes and form a single number from them, then use a slope of 6.23 and an offset of -20402. This will get you the barometric pressure reading if you were at the same altitude and temperature as the person that figured it out. So, to adjust it to your location, just go look up the barometric pressure reading for your location at the same time and add the difference in. That's what the 81.1 number above means, I just added it in as the last step. The changes will be in GitHub soon.
Don't think this is too simple a solution. The manufacturer of the chip put a lot of work into getting the sensor to follow pressure changes, then they put the adjustments for temperature and fixed altitude in the chip so they can be read and applied. There was a lot of work done to get it to work. The trick was to get the slope correct, then the offset was just the method of getting it to line up vertically. The altitude offset is simply necessary to adjust for the specific location.
Slick, but remember, change altitude or temperature and you may have to revisit the algorithm and change the values. We owe this discovery to Play Kube for sending me the mail a few days ago.
I still haven't found the battery level from the weather head though.