Playing around with the barometer BMP388

1 minute read


Today I played around with the barometric pressure sensor BMP388 that is part of the IMU combo BMI088/BMP388 that’s onboard the CF2.1.

To get a feel for the precision and latency of raw data, I added a log group to the driver sensors_bmi088_bmp388.c. In contrast to a variety of forum posts on I did not have to activate any compiler flags – that’s only necessary to include the measurements in the Kalman filter.

In the original init code for the sensor, the update is very fast, because the smoothing IIR filter within the sensor is set to a low efficacy. One long-term goal could be to combine the flow deck output and the baro output to get flight at constant height over small obstacles, while still benefitting from the flow deck.

Changing the setting to the following

/* Select the output data rate and oversampling settings for pressure and temperature */
bmp388Dev.settings.odr_filter.press_os = BMP3_OVERSAMPLING_8X;
bmp388Dev.settings.odr_filter.temp_os = BMP3_NO_OVERSAMPLING;
bmp388Dev.settings.odr_filter.odr = BMP3_ODR_50_HZ;
bmp388Dev.settings.odr_filter.iir_filter = BMP3_IIR_FILTER_COEFF_31;

yields a much smoother, but also much slower update:

Image of raw BMP388 data

The picture shows movements of the crazyflie roughly +/-80cm above or below a table surface, with propellers off. Moving the flie left and right while tilted (simulating wind) does not disrupt the measurement (around 60kms in the graph)

I tested higher oversampling settings, but BMP3_OVERSAMPLING greater than 8x did not work. The above-sea-level measurement at the same IIR and sampling rate was not very convincing indoors:

Image of raw BMP388 data

So I guess relative height is the way forward.