Skip to main content

Barometer

MS5611 example

If you have not already done that, download drivers and examples code here.

C++

note

If you have not build the examples yet, perform the following commands:

cd C++
make

To check the Barometer example, you need to run this command:

cd Build
./Barometer

Python

Move to the folder with the code and run the example:

cd Python
python Barometer.py

You should see pressure and temperature values:

Temperature(C): 34.3509172821 Pressure(millibar): 1030.4646104
Temperature(C): 34.2971904755 Pressure(millibar): 1030.4639519
Temperature(C): 34.2795449066 Pressure(millibar): 1030.45554448
Temperature(C): 34.3018652344 Pressure(millibar): 1030.46921925
note

Keep in mind that board tends to get hot from Raspberry Pi and would show slightly higher temperature than it is in your room.

For further information see source code, which is mostly self-explanatory. As it takes some time for the sensor to perform conversion, delays are added between calls to methods that start the conversion and read the resulting data. After reading both pressure and temperature values, temperature compensation can be performed to get resulting pressure value.

note

More information about the chip is available in the MS5611 datasheet.