LPS25H是ST生产的MEMS数字气压传感器。主要特性有:

  • 测量范围:260 ~ 1260 hPa绝对气压
  • 分辨率:均方根1 Pa
  • 工作电压:1.7 ~ 3.6 V
  • 功耗:4μA(低分辨率模式)~25μA(高分辨率模式)
  • 数据刷新频率:1 ~ 25 Hz可选择
  • 接口:I2C,三线制/四线制SPI
  • 内置温度补偿
  • 内置24位ADC
  • 内置先入先出(FIFO)存储器
  • 封装:2.5 x 2.5 x 1.0 mm HCLGA-10L

管脚定义

  • VDD:电源,1.7~3.6V
  • GND:地
  • VDD_IO:IO口供电脚,电压小于等于VDD
  • GND_IO:IO口接地脚,需与GND相连
  • Reserved:与GND相连
  • CS:I2C接口(CS=1)选择,或SPI接口片选脚(CS=0)
  • SCL/SPC:I2C接口或SPI接口的时钟线,通过CS脚选择
  • SDA/SDI/SDIO:I2C接口或SPI接口的数据线
  • SA0/SDO:I2C接口地址选择脚,或者SPI接口的数据线
  • INT1:中断输出脚,可编程其触发条件,参见CTRL_REG4寄存器设置

与Arduino的连接

因为传感器IC大多工作在3.3V附近,因此干脆用工作于3.3V/8MHz版本的Arduino Pro Mini进行调试,避免了用UNO时接口电平转换的麻烦。采用I2C接口进行通讯。未利用INT1和FIFO的功能。

LPS25H  Pro Mini 3.3V/8MHz

VDD <------> 3.3V

GND <------> GND

SCL <------>  A5 (SCL)

SDA <------> A4 (SDA)

测试代码

 /*
Barometer based on LPS25H sensor and Arduino Pro Mini(3.3V)
*/ #include <Wire.h> #define ADDRESS_LPS25H 0x5D
#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define PRESS_OUT_XL 0x28 byte buffer[]; boolean ready = false;
int tempOut;
long presOut;
float tempVal;
float presVal; void setup()
{
Wire.begin();
Serial.begin(); //power down the device (clean start)
Wire.beginTransmission(ADDRESS_LPS25H);
Wire.write(CTRL_REG1);
Wire.write(0x00);
Wire.endTransmission(); //turn on the sensor, set the one-shot mode, and set the BDU bit
Wire.beginTransmission(ADDRESS_LPS25H);
Wire.write(CTRL_REG1);
Wire.write(0x84);
Wire.endTransmission();
} void loop()
{
//run one-shot measurement
Wire.beginTransmission(ADDRESS_LPS25H);
Wire.write(CTRL_REG2);
Wire.write(0x01);
Wire.endTransmission(); //wait until the measurement is completed
while (ready == false)
{
delay(); //conversion time: ~37ms
Wire.beginTransmission(ADDRESS_LPS25H);
Wire.write(CTRL_REG2);
Wire.endTransmission();
Wire.requestFrom(ADDRESS_LPS25H, );
if (Wire.read() == 0x00)
{
ready = true;
}
// Serial.println("waiting...");
} //read the result
Wire.beginTransmission(ADDRESS_LPS25H);
Wire.write(PRESS_OUT_XL | 0x80); //read multiple bytes
Wire.endTransmission(); Wire.requestFrom(ADDRESS_LPS25H, );
if (Wire.available() >= )
{
for (int i = ; i < ; i++)
{
buffer[i] = Wire.read();
}
}
ready = false; //calculation
presOut = (long(buffer[]) << ) | (long(buffer[]) << ) | long(buffer[]);
presOut = (presOut << ) >> ; //PRESS_OUT_H/_L/_XL and is represented as 2’s complement
presVal = presOut/4096.0; tempOut = (buffer[] << ) | buffer[];
tempVal = 42.5 + tempOut/480.0; Serial.print(presVal); Serial.print(" hPa\t");
Serial.print(tempVal); Serial.println(" `C"); delay();
}

MCU每隔两秒测量一次气压和温度数据,并通过串口打印结果。

参考资料

LPS25H - STMicroelectronics

Arduino I2C + 气压传感器LPS25H的更多相关文章

  1. Arduino I2C + 三轴加速度计LIS3DH

    LIS3DH是ST公司生产的MEMS三轴加速度计芯片,实现运动传感的功能.主要特性有: 宽工作电压范围:1.71 ~ 3.6V 功耗:低功耗模式2μA:正常工作模式.ODR = 50Hz时功耗11μA ...

  2. Arduino I2C + 温湿度传感器Si7021

      Si7021是Silicon Labs生产的温湿度传感器芯片.其主要特性: 湿度精度:误差典型值+/-2%RH,最大值+/-3%RH(0~80%RH),出厂已校正 温度精度:误差典型值+/-0.3 ...

  3. Arduino I2C + 温湿度传感器AM2321

    (2015.5.17:本日志的内容有所更新,参见<使用Arduino Wire Library读取温湿度传感器AM2321>.) AM2321是广州奥松电子生产的数字式温湿度传感器.虽是国 ...

  4. Arduino I2C + 三轴加速度计ADXL345

    ADXL345是ADI公司生产的三轴数字加速度计芯片,与ST的LIS3DH功能接近.主要特性有: 工作电压:2.0 ~ 3.6V 功耗:待机功耗0.1μA:工作时与数据输出频率(ODR)有关,如ODR ...

  5. Arduino I2C + 温湿度传感器HTS221

    主要特性 HTS221是意法半导体(STMicroelectronics)生产的小体积.数字式温湿度传感器IC.该IC目前在官网仍处在“评估”状态.其主要特性: 工作电压:1.7~3.6V 数据输出频 ...

  6. Arduino I2C + AC24C32 EEPROM

    主要特性 AC24C32是Atmel的两线制串行EEPROM芯片,根据工作电压的不同,有-2.7.-1.8两种类型.主要特性有: 工作范围:-2.7类型范围4.5~5.5V,-1.8类型1.8~5.5 ...

  7. Arduino I2C + DS1307实时时钟

    主要特性 DS1307是Maxim的串行.I2C实时时钟芯片.主要特性有: 工作电压:主电源电压4.5~5.5V,电池电压2.0~3.5V 功耗:电池供电.备份模式时<500nA 接口:I2C, ...

  8. Arduino I2C + 数字式环境光传感器BH1750FVI

    BH1750FVI是日本罗姆(ROHM)半导体生产的数字式环境光传感IC.其主要特性有: I2C数字接口,支持速率最大400Kbps 输出量为光照度(Illuminance) 测量范围1~65535 ...

  9. Arduino通过I2C(SSD1306)驱动0.96寸12864OLED

    I2C驱动的128x64 OLED I2C (Inter-Integrated Circuit) 集成电路总线是I2CBus的简称, 是一种串行通信总线, 使用多主从架构. 飞利浦公司在1980年代为 ...

随机推荐

  1. C#内存流示例----->用内存流来读取图片

    背景:一个窗体.一个pictureBox.一个lable[没有选择图片,lable的text为"图片未选择"],在pictureBox1的Click事件中添加如下代码: priva ...

  2. 在C#中控制ListBox某一行的字体颜色

    例1 private void Form1_Load(object sender, EventArgs e) { listBox1.Items.Add("红色"); listBox ...

  3. LNK2026: 模块对于 SAFESEH 映像是不安全的<转>

    转自VC错误:http://www.vcerror.com/?p=162 错误描述: 在使用VS2012编译工程时,提示错误:" error LNK2026: 模块对于 SAFESEH 映像 ...

  4. Python的输入输出

    一:Python2.x版本下的输入输出 Python2.x 下的输入 1)raw_input 格式:result = raw_input("提示信息")功能:1)会等待用户输入内容 ...

  5. A Bug's Life(加权并查集)

    Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs ...

  6. [iOS]swift版内购

    //内购Demo,看代码说话吧 class IAPTestViewController: UIViewController ,SKProductsRequestDelegate, SKPaymentT ...

  7. 团队作业4Alpha冲刺

    仓库地址:https://gitee.com/ILoveFunGame/game_strategy_network.git 第一天 2018/6/13 1.1 今日完成任务情况以及遇到的问题. 1.1 ...

  8. Asp.net 使用Neatupload 第三方控件上传大文件,在IIS7上无法正常工作解决

    使用环境:Window Server2008 + IIS7 更改web.config配置 1.在<configSections></configSections>节内加入: & ...

  9. sql设置字段默认值

    alter table 表名 modify 字段名 default 默认值;

  10. Linux Virtualization with Xen

    Xen is the new virtualization kid on the block. It's gaining visibility and importance at a speed on ...