News

Altitude Data for Drone Navigation: A Compact Barometric Pressure Sensor and Thermometer from Bosch

July 11, 2018 by Mark Hughes

The BMP388 is a digital MEMS barometer and thermometer in a 2mm x 2mm x 0.8mm package.

This article takes a closer look at Bosch-Sensortec's digital MEMS barometric pressure sensor. Measuring 2mm x 2mm x 0.8mm, this component is designed to be low-power and low-noise.

Bosch-Sensortec’s BMP388 is a very small barometer/thermometer combination that consumes as little as 3.4 µA (with 1 Hz updates). It is designed to provide altitude information to navigation instruments with an accuracy of ±0.66 m.  

The thermometer/barometer combination should prove useful in home weather stations, navigation system augmentation, and drones. It supports both SPI and I2C interfaces.

A similar device, the BMP380, provides absolute pressure for altitude calculation (within ±0.5 m), and the BME680 integrates gas, pressure, humidity, and temperature sensors in a single package.

An accuracy of ±0.66 m might not sound very good at first—but know that Bosch quotes its error specifications over the entire range of the sensor. The device is capable of detecting smaller pressure differences that correspond to ~10 cm of elevation change, and when this sensor is combined with other sensors, it is enough to allow a machine to hover motionless in the sky with an excellent idea of absolute altitude.

 

BMP388 block diagram from datasheet

 

The sensor supports SPI (3-wire or 4-wire) as well as I2C interfacing. An onboard 512-byte FIFO buffer allows data to be taken out in bursts after a configurable interrupt indicates “FIFO full,” “data ready,” or “FIFO storage level exceeded” (AKA the “watermark” interrupt). Configuration is performed via onboard registers, and Bosch has provided source code for controlling the sensor.

Data Filtering with an IIR Filter

The BMP388 includes an infinite impulse response (IIR) filter that allows it to filter out sudden changes in pressure that might be caused by environmental noise.  For example, a sudden change in indoor air pressure caused by someone closing a door or shooting a rifle. These types of events cause an abrupt and short-duration increase in barometric pressure.

To filter out these sudden, temporary disturbances, the BMP388 can send the pressure measurement data through a configurable IIR, or it can send the data directly to a host microcontroller for processing.

 

Measurement flow diagram (modified from datasheet)

 

IIR filters combine the results of a current measurement with that of a previous one to help alleviate any sudden changes or noise. If you are implementing the IIR filter in your device, you need to discard the first data point that it collects, as it cannot be processed by the algorithm.

 

$$\text{data}_{\text{filtered}}=\frac{\text{data}_{\text{filtered−old}}\cdot{\text{filter−coefficient}}+\text{data}_{\text{adc}}}{\text{filter−coefficient}+1}$$

Equation taken from datasheet, page 14


Step response with different IIR filter coefficients from datasheet.

Modes and Power Usage

Other than complete power-down, the device has three modes. After power is supplied to the digital and analog pins, the device enters sleep mode. Changing from sleep mode to the other measurement modes is accomplished by setting particular bits in the “pwr_ctrl” register.

 

Sleep Mode

In sleep mode, the device does not take any measurements. Current consumption is 2 μA. The control and data registers are accessible via SPI or I2C. From sleep mode, the device can enter normal mode or forced mode.

 

Forced Mode

In forced mode, the device performs one measurement cycle, stores the data, and returns to sleep mode.  

 

Normal Mode

In normal mode, the device will repeatedly perform measurements.  The measurement rate is determined by the setting of the “odr_sel” register. Data is then either processed with the IIR filter or stored directly in the FIFO buffer. The device’s current consumption depends on the measurement rate, with lower rates requiring less current.

 

Modes diagram (modified from datasheet)

How Do Drones Maintain Altitude?

One possible application for the BMP388 is use in drone guidance. If you’ve ever played with a toy multicopter craft, you likely have had the opportunity to watch it effortlessly hover at a given altitude. But the BMP388 barometer only has an accuracy of ±0.66 m, which means that the barometer alone is not enough to allow a device to maintain the accurate altitudes that you’ve likely witnessed. The solution is sensor fusion: combine the barometer information and the accelerometer information with a complementary (or other) filter.  

Accelerometer data can be integrated to provide velocity data, and velocity data can be integrated to provide position data. Unfortunately, integration errors accumulate over time, providing positions that grow increasingly imprecise as time passes. On the other hand, they are highly accurate over short intervals. Barometers provide a rough altitude measurement that can be refined by accelerometer data.

A complementary filter combines barometer and accelerometer measurements to provide highly accurate vertical velocity and altitude data. Unlike the more complicated Kalman filter, the complementary filter math is simple enough that it can be performed on 8-bit microcontrollers.

Do you have any thoughts on this very small pressure sensor? Or have you used a different barometer in one of your projects? Let us know in the comment section below.