(SKU:SEN0251)Gravity: BMP388 Barometric Pressure Sensors 气压温度传感器
来自DFRobot Product Wiki
目录 |
简介
DFRobot新推BMP388气压传感器,具有温度检测和大气压检测双重功能。支持Arduino代码控制,相对于旧版的BMP180,BMP280,BMP388拥有更低的功耗,更高的分辨率以及更高的采样频率。
气压传感器通常用于大气压检测和温度检测,并且由于气压和海拔高度之间的关系,人们通常可以利用气压来检测海拔高度和相对的楼层高度。在导航方面,气压计也可以用来增强GPS定位效果或者配合IMU传感器,实现三维(3D)室内导航。
BMP388基于博世成熟的压电式压力传感器技术,具有高EMC稳健性,高精度,低功耗等特点。精度约为±8Pa,相当于高度误差为±0.5 m,支持0~65℃温度检测。
注意:由于传感器对环境条件非常敏感,请勿用手指触摸。
应用领域
- 温度检测
- 大气压强检测
- 海拔高度检测
- 室内导航(楼层检测、电梯检测)
- 户外导航、休闲和运动的应用程序
- 医疗保健应用程序(如肺活量测定法)
- 垂直速度指示(如上升/下沉速度)
技术规格
- 工作电压:3.3V-5.5V
- 工作电流:0.5mA
- 测量范围:300-1250 hPa
- 相对气压测量精度:±0.08 hPa(等价±0.66m @700-900hPa,25℃-40℃)
- 绝对气压测量精度:±0.5 hPa(0℃-65℃@300-1100hPa)
- 温度漂移系数:±0.75 Pa/K(-20℃-65℃@700-1100hPa)
- 绝对温度测量精度:±0.5℃(@0℃-65℃)
- 工作温度:-40℃~80℃(在0℃-65℃测量更精确)
- 外形尺寸:22mm x 30mm
- 安装孔位置:15mm
- 安装孔尺寸:内径3mm/外径6mm
- 接口:Gravity-IIC 4Pin或者SPI(SPI仅在3.3V电压下使用)
引脚说明
丝印 | 功能描述 |
SDA | IIC数据 |
SCL | IIC时钟 |
INT | 中断输出引脚 |
SCK | SPI-CLK |
SDI | SPI-MOSI |
CSB | SPI-CS |
SDO | SPI-MISO/IIC地址选择 |
GND | 电源负极 |
VCC | 电源正极 |
使用教程
- 目标:测出当前环境下的大气压强和温度值,计算出模块当前所在环境的海拔高度
准备
- 硬件
- 1 x Arduino UNO控制板
- 1 x Gravity I2C BMP388 温度&气压计
- 若干 杜邦线
- 软件
- Arduino IDE 点击下载Arduino IDE
接线图
连接模块与UNO主板(通过I2C接口),按照如下图的方式连接。
样例代码
/*! * 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); } |
结果
- 在串口查看读取到的值
Mind+(基于Scratch3.0)图形化编程
1、下载及安装软件。下载地址:http://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
2、切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程
3、“扩展”中选择“主控板”中的“Arduino Uno”。 “扩展”“传感器”中搜索选择“BMP388模块”,详细教程:Mind+基础wiki教程-加载扩展库流程
4、进行编程,程序如下图:
5、菜单“连接设备”,“上传到设备”
6、程序上传完毕后,打开串口即可看到数据输出。详细教程:Mind+基础wiki教程-串口打印
常见问题
还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!
更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。