Mikroe Pressure 4 click - BMP280 I2C or SPI Barometric Pressure & Temperature Sensor
- Product ID: 7510
- MPN: MIKROE-3020
Pressure 4 click is an absolute barometric pressure measurement Click board™, which features a low power consumption, high precision barometric pressure sensor. Capable of using both SPI and I2C communication protocols, Pressure 4 click allows being interfaced with a broad range of various microcontroller units (MCUs). The sensor used on this Click board™ features onboard processing capabilities, such as the IIR filtering, used to filter out abrupt changes of pressure. Low power consumption allows Pressure 4 click to be used in many portable, battery-powered applications. Besides the pressure, it can also measure the ambient temperature, which can be used for the compensation calculations.
Besides the pressure readings, the Pressure 4 click also offers very accurate temperature reading, which is required for the pressure readings compensation. Oversampling up to 16 times combined with the filtering options allows very low noise influence on measurement results. Depending on the application in which the Click board™ is used, different power saving, oversampling, and filtering settings can be implemented, resulting in an optimal performance in given conditions. All these features make the Pressure 4 click an ideal solution for weather stations, indoor flying toys navigation, drones, variometers, and similar applications that rely on reliable barometric pressure measurements.
How does it work?
The sensor used on the Pressure 4 click is the BMP280, a digital pressure sensor, from Bosch Sensortech. This sensor is produced using the Bosch proprietary APSM manufacturing technology. APSM is an abbreviation for the Advanced Porous Silicon Membrane, which is CMOS compatible technology, used to hermetically seal the sensor cavity, in an all-silicon process. This advanced MEMS technology offers a high measurement precision of only 0.12 hPa, as well as low TOC (thermal coefficient) of only 1.5 Pa/K. The sensor is enclosed in a small metal lid housing and is very resilient: it can operate in a range of 300 hPa to 1100 hPa but can withstand up to 20,000 hPa before the membrane breaks down.
The BMP280 offers a set of pressure and temperature measurement options. It can be programmed to skip either thermal or pressure measurement, allowing faster measurement of the required property. The low TOC of only 1.5K/Pa allows reading of the pressure with very small drift over temperature. Resolution of 0.12 hPa allows calculating of the altitude with the accuracy of 1m, which is ideal for indoor navigation applications (drones, flying toy models, and similar). Since this device is aimed at low power applications, it is powered by the mikroBUS™ 3.3V rail and does not allow voltages up to 5V. Therefore the Click board™ supports only 3.3V MCUs and it is not intended to be connected or controlled via the 5V MCU without a proper level shifting circuitry.
This sensor is comprised of a mixed signal front end (ASIC) and the piezo-sensitive pressure sensing element. The ASIC section provides analog to digital conversion of the measurement as well as the signal processing, in the form of the IIR filtering. The measurement readings and the compensation parameters are available at I2C or SPI bus pins of the BMP280 routed to the mikroBUS™ standard SPI and I2C pins. Pressure 4 click offers a selection between the two, by switching SMD jumpers labeled as I2C SPI to an appropriate position. Note that all the jumpers have to be placed to the same side, as mixed SPI and I2C positions will render the Click board™ unresponsive. Additionally, selection of the I2C communication protocol allows the least significant bit (LSB) of the I2C slave address of the device to be set. This can be done with the SMD jumper, labeled as I2C ADDR.
The overall power consumption depends on several factors, such as the oversampling value, measurement rate, power mode, standby duration, and so on. Bosch Sensortech recommends a set of operational parameters for different applications, in a form of a table, in the BMP280 datasheet. In general, this sensor allows several power modes, regardless of the selected measurement parameters:
- Sleep mode: keeps only the logic section of the sensor IC powered. It is possible to read the device ID and compensation parameters. The power consumption is minimal in this mode.
- Forced mode: when the Forced mode command is received, the device is awakened from the sleep mode; a single measurement is performed, according to previously programmed conversion parameters. After that, the device reverts to the Sleep mode, waiting to be triggered once more by repeated selection of the Force mode. The conversion results can be read from the registers since the Sleep mode keeps the logic section powered up.
- Normal mode: in this mode, conversions are cyclically repeated, with programmable standby periods after each measurement. The power consumption in this mode varies with the standby period duration. Once selected, the cycle repeats, so there is no need to repeat the Normal mode command.
When the measurement is completed, the raw ADC values will be available in the output registers. However, to obtain actual pressure and temperature readings, a compensation algorithm needs to be applied to these raw values. A set of compensation parameters is available in the non-volatile memory of each sensor device. These compensation parameters take into account slight differences between the produced sensors and each BMP280 sensor device has its own set of compensation parameters. The BMP280 datasheet offers detailed instructions on how to apply these compensating algorithms properly. However, MikroElektronika provides a library that contains functions, which can be used for the simplified operation of the Pressure 4 click. The library also contains an example application, which demonstrates their use. This example application can be used as a reference for custom designs.
Pressure / Altitude
It can be used for weather stations, indoor flying toys navigation, drones, variometers, and similar applications that rely on reliable barometric pressure measurements.
BMP280, a digital pressure sensor, from Bosch Sensortech
Very accurate pressure and temperature readings, on-chip IIR filtering of the abrupt changes in pressure, it can use either SPI or I2C communication protocol, sensor IC is produced by using the Bosch proprietary APSM manufacturing technology.
Click board size
M (42.9 x 25.4 mm)
This table shows how the pinout on Pressure 4 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Pressure 4 click electrical specifications
|Pressure measurement resolution||-0.12||-||0.12||hPa|
|Temperature measurement resolution||±0.5||-||±1||˚C|
Onboard settings and indicators
|LD1||PWR||-||Power LED indicator|
|I2C ADDR||I2C ADDR||Left||I2C Address selection bit: left position 0, right position 1|
|I2C/SPI||I2C/SPI||Left||Communication protocol selection: left position I2C, right position SPI|
We provide a library for Pressure 4 click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo application can run on all the main MikroElektronika development boards.
This library will allow a user to read the pressure and temperature values.Key functions:
void pressure4_init();- Generic initialization function.
double pressure4_getTemperature();- Returns the value of the measured temperature.
double pressure4_getPressure();- Returns the value of the measured pressure.
- System Initialization - Initializes GPIO, I2C and log structures.
- Application Initialization - Configures the microcontroller for communication
and initializes the Click board™.
- Application Task - The pressure and temperature data is read from the sensor
and it is printed to the UART.
mikrobus_logWrite("Temperature : ",_LOG_TEXT);
tmp = pressure4_getTemperature();
mikrobus_logWrite(" �C", _LOG_LINE);
mikrobus_logWrite("Pressure : ",_LOG_TEXT);
tmp = pressure4_getPressure();
mikrobus_logWrite(" hPa", _LOG_LINE);
The full application code, and ready to use projects can be found on our Libstock page.
mikroE Libraries used in the example:
- I2C Library
- SPI Library
- Conversions Library
- C_String Library
- UART Library
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
This click board is supported by mikroSDK - MikroElektronika Software Development Kit. To ensure a proper operation of mikroSDK compliant Click board™ demo applications, the mikroSDK package should be downloaded from the LibStock and installed for the compiler you are using.
For more information about the mikroSDK, visit the official page.