简介

DFRobot新推BMP388气压传感器Breakout版本,具有温度检测和大气压检测双重功能。支持Arduino代码控制,相对于旧版的BMP180,BMP280,BMP388拥有更低的功耗,更小的尺寸,更高的分辨率以及更高的采样频率。 气压传感器通常用于大气压检测和温度检测,并且由于气压和海拔高度之间的关系,人们通常可以利用气压来检测海拔高度和相对的楼层高度。在导航方面,气压计也可以用来增强GPS定位效果或者配合IMU传感器,实现三维(3D)室内导航。 BMP388基于博世成熟的压电式压力传感器技术,具有高EMC稳健性,高精度,低功耗等特点。精度约为±8Pa,近似高度误差为±0.66 m,支持0~65℃温度检测。

注意:由于传感器对环境条件非常敏感,请勿用手指触摸。

应用领域

技术规格

注意:该传感器默认I2C地址为0X76。

引脚说明

BMP388气压温度传感器正面引脚说明

BMP388气压温度传感器背面引脚说明

丝印 功能描述
SDA I2C数据
SCL I2C时钟
INT 中断输出引脚
SCK SPI-CLK
SDI SPI-MOSI
CSB SPI-CS
SDO SPI-MISO/I2C地址选择
GND 电源负极
VCC 电源正极

使用教程

准备

接线图

连接模块与UNO主板(通过I2C接口),按照如下图的方式连接。

样例代码

#include <DFRobot_BMP3XX.h>

/* If using Gravity products, choose these two interfaces and comment subsequent interfaces. */
// DFRobot_BMP388_I2C sensor;
// DFRobot_BMP390L_I2C sensor;

/**
 * Select the chip version BMP388/BMP390L
 * Select communication interface I2C, please comment out SPI interface.
 * I2C communication address settings: eSDOGND: connect SDO pin to GND, I2C address is 0×76 now.
 *                   eSDOVDD: Connect SDO pin to VDDIO (3v3), I2C address is 0×77 now
 */
// DFRobot_BMP388_I2C sensor(&Wire, sensor.eSDOVDD);
DFRobot_BMP390L_I2C sensor(&Wire, sensor.eSDOVDD);

/**
 * Select chip version BMP388/BMP390L
 * Select communication port SPI, please comment out I2C port
 * Set up digital pin according to the on-board pin connected with SPI chip-select pin.
 * Notice: csPin used here is D3 digital pin on ESP32, other non-conflicting pins can also be selected as external interrupt pins.
 */
// uint8_t csPin = D3;
// DFRobot_BMP388_SPI sensor(&SPI, csPin);
// DFRobot_BMP390L_SPI sensor(&SPI, csPin);


/* If you do not need to eliminate the absolute difference of measurement, please comment the following line */
#define CALIBRATE_ABSOLUTE_DIFFERENCE

void setup(void)
{
  Serial.begin(115200);

  int rslt;
  while( ERR_OK != (rslt = sensor.begin()) ){
    if(ERR_DATA_BUS == rslt){
      Serial.println("Data bus error!!!");
    }else if(ERR_IC_VERSION == rslt){
      Serial.println("Chip versions do not match!!!");
    }
    delay(3000);
  }
  Serial.println("Begin ok!");

  while( !sensor.setSamplingMode(sensor.eUltraPrecision) ){
    Serial.println("Set samping mode fail, retrying....");
    delay(3000);
  }

  delay(100);
  #ifdef CALIBRATE_ABSOLUTE_DIFFERENCE

  if( sensor.calibratedAbsoluteDifference(540.0) ){
    Serial.println("Absolute difference base value set successfully!");
  }
  #endif

  float sampingPeriodus = sensor.getSamplingPeriodUS();
  Serial.print("samping period : ");
  Serial.print(sampingPeriodus);
  Serial.println(" us");

  float sampingFrequencyHz = 1000000 / sampingPeriodus;
  Serial.print("samping frequency : ");
  Serial.print(sampingFrequencyHz);
  Serial.println(" Hz");

  Serial.println();
  delay(1000);
}

void loop()
{

  float temperature = sensor.readTempC();
  Serial.print("temperature : ");
  Serial.print(temperature);
  Serial.println(" C");

  float Pressure = sensor.readPressPa();
  Serial.print("Pressure : ");
  Serial.print(Pressure);
  Serial.println(" Pa");

  float altitude = sensor.readAltitudeM();
  Serial.print("Altitude : ");
  Serial.print(altitude);
  Serial.println(" m");

  Serial.println();
  delay(1000);
}

结果

  1. 下载及安装软件。下载地址:https://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
  2. 切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程
  3. “扩展”中选择“主控板”中的“Arduino Uno”。 “扩展”“传感器”中搜索选择“BMP388模块”,详细教程:Mind+基础wiki教程-加载扩展库流程
  4. 进行编程,程序如下图:
  5. 菜单“连接设备”,“上传到设备”
  6. 程序上传完毕后,打开串口即可看到数据输出。详细教程:Mind+基础wiki教程-串口打印

注:Mind+中的BMP388默认地址是0x77,此传感器默认地址是0x76,需要先将此传感器的SDO引脚接到3V3上地址才是0x77.

常见问题

还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。

更多

DFshopping_car1.png [DFRobot商城购买链接]