While working on improving a portable weather station project, I noticed discrepancies with barometer measurements from the BMP180 sensor upon cross-referencing my data and locally reported weather data. Barometric pressure in my area generally is in the 1014 β 1018 Millibar range, readings from my sensor indicated an average of 951 millibar. After investigating if I had a bad sensor and going over numerous ways to calculate something to calibrate the BMP180 I came up with a solution using standard deviation that could hopefully shed light on this topic (if itβs been done or considered before? I donβt quite know). More accurate measurements were noticed after converting the default pascal(Pa) to millibar(Mbar = Pa / 100) then to inHg(Inch of mercury = Mbar / 33.864). Below is the calculation with (basePressure = 29.92inHg) as the "standard" pressure:
baroTemp = bmp.readTemperature();
pressure = bmp.readPressure();
mBar = pressure / 100;
sensorPressure = mBar / 33.86;
sumCalc = basePressure + sensorPressure;
meanCalc = sumCalc / 2;
diff1 = meanCalc - sensorPressure;
diff2 = meanCalc - sensorPressure;
diff1Sq = diff1 * diff1;
diff2Sq = diff2 * diff2;
sumDiff = diff1Sq + diff2Sq;
variance = sumDiff;
realPressure = sensorPressure + variance;
This calculates the variance, then adds it to the measurement from readPressure as the value for realPressure. So far the measurements have been very close to matching with locally reported weather data. Feel free to shed more wisdom. Thanks!