BMP390 Barometric Pressure Sensor

From Waveshare Wiki
Jump to: navigation, search
BMP390 Barometric Pressure Sensor
BMP390 barometric.png

I2C, SPI
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

The BMP390 is a 24-bit absolute barometric pressure sensor, with the features of ultra-small form factor, low power consumption, and low noise. This digital high-performance sensor is ideal for a variety of altitude-tracking applications. Supports both I2C / SPI interfaces, compatible with 3.3V/5V voltage levels. It can be easily integrated into projects such as GPS modules, wearables devices, audible devices, and drones, suitable for applications such as accurate altimeters, environment monitoring, and IoT projects.

Feature

  • Support I2C/SPI interface communication, I2C interface by default.
  • Onboard voltage translator and compatible with 3.3V/5V operating voltage.
  • Provide online resources and manuals (Raspberry/Arduino/Pico deno example, user manual, etc.)

Specification

  • Operating voltage: 5V/3.3V
  • Communication interface: I2C/SPI
  • Average operating current: 3.2μA (1Hz)
  • Barometric detection range: 300~1250hPa
  • Barometric pressure absolute accuracy: ±0.50hPa (P=300 ...1100 hPa T=0 ... 65 °C)
  • Barometric pressure relative accuracy: ±0.03hPa (P=700…1100 hPa T=25…40°C)
  • Temperature coefficient offset: ±0.6Pa/K (25°…40°C at 900 hPa)
  • Temperature absolute accuracy: ±1.5℃ (0…65℃)
  • Resolution support: 0.016Pa (In high precision mode)
  • Possible sampling rates: 200Hz
  • Operating temperature: -40~85℃
  • Dimensions: 32mm × 20mm
  • Via-hole diameter: 2.0mm

Interface Description

  • Pin function:
Pin Description
VCC Power Input
GND GND
SDA I2C data
SCL I2C clock
INT Interrupt output, can be connected to I/O
SDO SPI data, can be connected to the host MISO
SDI SPI data, can be connected to the host MOSI
CS Chip selection, can be connected to I/O

The I2C address can be configured through the ADDR pad, the default is not soldered 0Ω resistor, and the I2C address is 0x77, after soldering is 0x76. (Please do not solder this 0Ω resistor when using SPI mode).

Working with Raspberry Pi

Function Library Installation

  • Install WiringPi:
sudo apt-get install wiringpi
#For the Raspberry Pi 4B it may be necessary to upgrade:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear, if it does not appear, it means there is an installation error.

Preparation

Execute the following commands to debug the Raspberry Pi:

sudo raspi-config 

Choose Interfacing Options -> I2C -> Yes to reboot the I2C kernel driver.
Choose Interfacing Options -> SPI -> Yes to reboot the SPI kernel driver.
Save, exit and then reboot the Raspberry Pi.

sudo reboot 

Check whether SPI is normally booted after rebooting:

ls /dev/spi*

BMM150 3-Axis Magnetometer Sensor01.png

WiringPi Demo

Download and unzip:

sudo apt-get update
sudo apt-get unzip
wget https://files.waveshare.com/upload/b/bf/BMP390_Barometric_Pressure_Sensor_code.zip
unzip BMP390_Barometric_Pressure_Sensor_code.zip

I2C

Module Raspberry Pi
VCC 3.3V/5V
GND GND
SDA SDA
SCL SCL
INT NC

  • Check the connection:
i2cdetect -y 1

BMP390 Barometric19.png
The I2C address of the module is 0X77. The address can be changed by modifying the pad, and the I2C address in the demo should be modified after modifying the hardware address.
BMP390 Barometric20.png
BMP390 Barometric020.png

BMP3_ADDR_I2C_PRIM=0x76
BMP3_ADDR_I2C_SEC=0x77
  • Enter the I2C directory to compile the demo:
cd
cd BMP390_Barometric_Pressure_Sensor_code/RaspberryPi/I2C
make clean
make
  • Run the demo:
sudo ./bmp3 
  • Data is displayed:

BMP390 Baromet20.png
Wait a while to get stable data. From left to right, the temperature (in Celsius), and atmospheric pressure (in Pascals) measured by the BMP390 are shown.

SPI

Module Raspberry Pi
VCC 3.3V
GND GND
SDO MISO
SDI MOSI
SCK SCLK
CS 27 (wiringPi code)

  • Enter the SPI directory and compile the demo:
cd
cd BMP390_Barometric_Pressure_Sensor_code/RaspberryPi/SPI
make clean
make
  • Run the demo:
sudo ./bmp3 
  • Data is displayed:

BMP390 Barometric 21.png
Wait a while to get stable data. From left to right, the temperature (in Celsius) and atmospheric pressure (in Pascals) measured by the BMP390 are shown.

Working with Arduino

I2C

  • Connect the module to the Arduino development board.
Module Arduino
VCC 5V
GND GND
SDA SDA
SCL SCL
INT NC

BMP390 Barometric 22.jpg
After wiring the device correctly and determining the communication method and device address, compile and download it to Arduino.
Open: Tools -> Serial Monitor, and select baud rate 115200, you can get the following information.
BMP390 Barometric 23.png
Wait a moment to get stable data. From left to right, the BMP390 sensor is showing the measured atmospheric pressure (in Pascals) and temperature (in Celsius). If the data is not displayed successfully, or if the data is not displayed properly, please check the connection, communication method, and device address for errors.

SPI

  • Connect the module to the Arduino development board according to the following ways:
Module Arduino
VCC 5V
GND GND
SDO 12
SDI 11
SCK 13
CS 10 (SS)

BMP390 Barometric24.png

  • After correctly connecting, check the communication method (The following figure confirms that SPI mode is used when the macro definition USE_IIC is 0) and the device address, compile and download to Arduino.
  • Open Tool -> SSCOM, choose the baud rate as 115200, and get the following information:

BMP390 Barometric25.png
Wait a moment to get stable data. From left to right, the BMP390 sensor is showing the measured atmospheric pressure (in Pascals) and temperature (in Celsius). If the data is not displayed successfully, or if the data is not displayed properly, please check the connection, communication method, and device address for errors.

Working with ESP32

Take ESP32-S3-DEV-KIT-N8R8 as an example.

I2C

Connect the module to the ESP32 development board as shown below:

Module ESP32
VCC 5V
GND GND
SDA 13
SCL 14
INT NC

The ESP32's I2C bus can be mapped to most external pins and can be configured to suit your needs.
BMP390 Barometric 90.png

  • After wiring the device correctly and determining the communication method and device address, compile and download it to Arduino.
  • Open: Tools -> Serial Monitor, select baud rate 115200, and you can get the following information.

BMP390 Barometric 91.png
Wait a moment to get stable data. From left to right, the BMP390 sensor is showing the measured atmospheric pressure (in Pascals) and temperature (in Celsius). If the data is not displayed successfully, or if the data is not displayed properly, please check the connection, communication method, and device address for errors.

SPI

  • Connect the module to the ESP32 development board.
Module ESP32
VCC 5V
GND GND
SDO 10
SDI 11
SCK 9
CS 12(SS)

(The ESP32's SPI bus can be mapped to most external pins and can be configured to suit your needs): BMP390 Barometric 92.png

  • After correctly connecting, check the communication method (The following figure confirms that SPI mode is used when the macro definition USE_IIC is 0) and the device address, compile and download to Arduino.
  • Open Tool -> SSCOM, choose the baud rate as 115200, and get the following information:

BMP390 Barometric25.png
You can get stable data after waiting for a moment. From left to right, you can see the barometric pressure (in Pascals) and temperature (in Celsius) tested by the BMP390 sensor. If it fails to display the data, or the data is abnormal, you should check the cable connection, communication way, and the device address.

Working With Raspberry Pi Pico

Software Preparation

Install Thonny

  • Directly enter Thonny to download.
  • Also, you can click here to download.

Program MicroPython Firmware

  • Online installation: the newest Thonny version can automatically download the firmware.
  1. First, you need to press and hold the boot button of the Pico while connecting the Pico to the PC using the USB cable.
  2. After that, open Thonny and click Tool -> Options... -> Interpreter -> Install or update MicroPython.
  3. In the pop-up window, select the corresponding development board and MicorPython version, and click Install, then wait for the installation to finish.

BMM150 3-Axis30.png
If the software installation MicroPython window keeps prompting downloading variants info... and there is no change for a long time, you can choose to use a proxy or use the following offline installation method instead.

  • Off-line installation method:
  1. Download the firmware and get a .uf2 file.
  2. Press the boot button of the Pico, connect the Pico to the PC with a USB cable, and then a USB storage device appears on the computer.
  3. Open the device folder, and drag the ".uf2" file directly into the folder, after that, the storage device automatically pops up, and the development board reboots, at this time represents the installation is complete, you can open Thonny to see whether the successful recognition of Pico's micro python environment. For more details, please refer to Pico's website.

Hardware Connection

Module Pico
VCC 5V
GND GND
SDA GP2
SCL GP3
INT NC

BMM150 3-Axis 27.png

Demo Use

As shown in the picture:

  1. Verify that a Raspberry Pi Pico development board with Micropython firmware written to it is connected.
  2. Open the unzipped sample demo folder in the upper left corner of the file screen and open the Pico folder.
  3. Select the two .py files, right-click on them, and select Upload.
  4. Open the example demo get_geomagnetic_data.py by double-clicking on the in-chip file screen at the bottom left after uploading.
  5. Click the button above to run.

BMM150 3-Axis 28.png

Resource

Document

Demo

Software

Related Resource

FAQ

 Answer:

The height calculated by the air pressure sensor is generally used as a relative value in a short period. For example, if you take a vertical elevator, record a height before the elevator starts, and record a height when the elevator rises to the 3rd floor, the height difference between the two heights is accurate.

If you need to use it on absolute occasions, you can enter the height of the current position as the initial value of the calculation, and then the movement to observe the height change is accurate. However, if the time is long, it will also be easy to have the problem of height drift.

If the project requires a long time to obtain accurate altitude values and high-frequency requirements, it is necessary to be operated with other sensors for processing, such as GPS.

{{{5}}}


 Answer:

BMP390 is to judge the height by measuring the air pressure, the relative accuracy is ±3 Pascal, which is equivalent to the height of ±0.25 meters; in reality, the error may be large due to the influence of the external complex environment, more parameters are as follows:
BMP390 09.png

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)