1.简介
KEYES BMP280模块主要用到了BMP280传感器,它是温度与气压传感器,它是一种专为移动应用设计的绝对气压传感器。该传感器模块采用极其紧凑的封装,具有小尺寸和低功耗特性。它采用成熟的压阻式压力传感器技术,具有高精确度和线性度,以及长期稳定性和很高的 EMC 稳健性。多种设备工作选择带来了最高灵活性,我们可以在功耗、分辨率和滤波性能方面对设备进行优化。
模块同时之策I2C通信方式和SPI通信方式两种模式。使用时,客户可以根据自己需求任意选择通信方式。为此我们特别提供1个基于UNO R3单片机、I2C通信方式的测试示例。
2.技术参数
工作电压:DC 5V
工作电流:2.7uA @ 1Hz采样率
气压测量范围:300hPa~1100hPa (海拔+9000~-500m)
气压测量精度:0.16Pa(±1米)
温度测量范围:0℃~65℃
温度测量精度:0.01℃
工作温度:-40℃~+85℃
平均测量时间:5.5 ms
3.应用领域
温度检测
大气压强检测
海拔高度检测
室内导航(楼层检测、电梯检测)
户外导航、休闲和运动的应用程序
医疗保健应用程序(如肺量测定法)
垂直速度指示(如上升/下沉速度)
4.接线图
5.测试代码
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
//#define BMP_SCK 13
//#define BMP_MISO 12
//#define BMP_MOSI 11
//#define BMP_CS 10
Adafruit_BMP280 bme; // I2C
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
void setup() {
Serial.begin(9600);
Serial.println(F(“BMP280 test”));
if (!bme.begin()) {
Serial.println(“Could not find a valid BMP280 sensor, check wiring!”);
while (1);
}
}
void loop() {
Serial.print(“Temperature = “);
Serial.print(bme.readTemperature());
Serial.println(” *C”);
Serial.print(“Pressure = “);
Serial.print(bme.readPressure());
Serial.println(” Pa”);
// Serial.print(“Approx altitude = “);
// Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
// Serial.println(” m”);
Serial.println();
delay(2000);
}
测试结果
特别注意:测试代码用的是1.6.1版本的arduino IDE测试,
使用其他版本的IDE,不能测试成功。
按照前面方法接好线,上传测试代码,上电后,打开串口监视器,设置波特率为9600,监视器显示当前的温度和大气压强。
相关库文件链接