AnsweredAssumed Answered

Problem with MS5611 Barometer Pressure Reading

Question asked by Nijat Ibrahimov on Nov 28, 2017

Hi all! I am trying to read temperature and pressure values (then, convert pressure to altitude) from MS5611 barometer using I2C interface with STM32F4. So far, I managed to read both temperature and pressure values. I can read the sensor calibration values, do the digital conversion (long enough delay for conversion to be completed) and second order temperature compensation. Hence, I get very good, responsive temperature readings.

The problem is pressure value is not as stable as temperature value. When I try to calculate the relative altitude using barometric formula, I get weird results. Such that, relative altitude value changes from 0 to 5-6 meters even if barometer is still. Moreover, when I move barometer up, pressure value increases (hence, relative altitude decreases), which is not possible  . 

So, what could be the reason for this problem? Should I apply some sort of digital filter? 

 

My pseudo-code to is as follows: 

 

pressure = readPressure()

start_altitude = measureAltitudeFromSeaLevel(pressure)

while (1) {

      pressure = readPressure()

      current_altitude = measureAltitudeFromSeaLevel(pressure)

      relative_altitude = current_altitude - start_altitude

}

Outcomes