SEN0251

Introduction

The newly introduced BMP388 barometric pressure sensor by DFRobot is equipped with the functionality of temperature and pressure measurement. It supports Arduino code control. Compared with the earlier version of BMP180 and BMP280, this sensor exhibits lower power consumption, higher resolution and higher sampling rate. The barometric pressure is usually used to measure barometric pressure and temperature. But besides that, we can also use the sensor to measure the altitude and the relative floor height due to the fact that there is a certain relationship between altitude and barometric pressure. What’s more, BMP388 enables accurate GPS tracking. So with an IMU sensor and BMP388, you can experience 3D indoor positioning and navigation. BMP388 is based on Bosch’s mature Piezo resistive pressure sensor technology featuring high accuracy as well as low power consumption and high EMC robustness. The sensor features an accuracy of about ±8Pa, which is equivalent to about ±0.5m difference in altitude, and an absolute accuracy temperature of ±0.5℃ for a temperature range between 0℃ and 65℃.


warning_yellow.png Note: do not touch the sensor with your fingers since it is extremely sensitive to the outside environment.


Applications

Specification

Pinout

Silk-screen Description
SDA IIC Data
SCL IIC Clock
INT Interrupt Output Pin
SCK SPI-CLK
SDI SPI-MOSI
CSB SPI-CS
SDO SPI-MISO/IIC Address Select
GND Negative Pole
VCC Positive Pole

Tutorial

To detect the barometric pressure and temperature of the current environment and calculate the altitude of the environment in which the module is located.

Preparation

Hardware

Connection Diagram

Connect the module with UNO main board through I2C interface, as the way shown below.

connection diagram

Sample Code

Download BMP388 library file. How to install the library? Copy the following codes and burn them into the single-chip.

 /*!
  * file bmp388test.ino
  * 
  * Connect BMP388 to IIC interface of Arduino, download the program.
  * Altitude is calculated based on temperature and sea level pressure.
  * The example can count an approximate altitude.
  *
  * @n Open the serial monitor, check the altitude.
  * @n Open serial monitor, the temperature could be checked. 
  * @n Open serial monitor, the atmospheric pressure could be checked.
  * 
  * Copyright   [DFRobot](http://www.dfrobot.com), 2016
  * Copyright   GNU Lesser General Public License
  *
  * version  V0.1
  * date  2018-5-29
  */
#include "DFRobot_BMP388.h"
#include "DFRobot_BMP388_I2C.h"
#include "Wire.h"
#include "SPI.h"
#include "math.h"
#include "bmp3_defs.h"

/*If there is no need to calibrate altitude, comment this line*/
#define CALIBRATE_Altitude

/*Create a bmp388 object to communicate with IIC.*/
DFRobot_BMP388_I2C bmp388;

float seaLevel;

void setup(){
  /* Initialize the serial port*/
  Serial.begin(9600);
  /* 
   * @brief Set bmp388 IIC address
   * @param BMP3_I2C_ADDR_PRIM: pin SDO is low
   *        BMP3_I2C_ADDR_SEC: pin SDO is high(default)
   */
  bmp388.set_iic_addr(BMP3_I2C_ADDR_SEC);
  /* Initialize bmp388*/
  while(bmp388.begin()){
    Serial.println("Initialize error!");
    delay(1000);
  }
  /*You can use an accurate altitude to calibrate sea level air pressure. 
   *And then use this calibrated sea level pressure as a reference to obtain the calibrated altitude.
   *In this case,525.0m is chendu accurate altitude.
   */
  delay(100);
  seaLevel = bmp388.readSeaLevel(525.0);
  Serial.print("seaLevel : ");
  Serial.print(seaLevel);
  Serial.println(" Pa");
}

void loop(){
  #ifdef CALIBRATE_Altitude
  /* Read the calibrated altitude */
  float altitude = bmp388.readCalibratedAltitude(seaLevel);
  Serial.print("calibrate Altitude : ");
  Serial.print(altitude);
  Serial.println(" m");
  #else
  /* Read the altitude */
  float altitude = bmp388.readAltitude();
  Serial.print("Altitude : ");
  Serial.print(altitude);
  Serial.println(" m");
  #endif
  delay(100);
   /* Read the atmospheric pressure, print data via serial port.*/
  float Pressure = bmp388.readPressure();
  Serial.print("Pressure : ");
  Serial.print(Pressure);
  Serial.println(" Pa");
  delay(100);
  /* Read the temperature, print data via serial port.*/
  float Temperature = bmp388.readTemperature();
  Serial.print("Temperature : ");
  Serial.print(Temperature);
  Serial.println(" C");
  Serial.println();
  delay(1000);
}            

Result

Check the value the program read via serial port.

COM15

More Documents

Schematic Diagram

BMP388 Datasheet

DFshopping_car1.png Get Gravity BMP388 Barometric Pressure Sensors from DFRobot Store or DFRobot Distributor.

Turn to the Top