气压传感器

来自Labplus盛思维基百科
Xiaoshan讨论 | 贡献2020年6月30日 (二) 16:03的版本 使用教程
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
blue:bit-气压传感器

概述

用于检测量大气压强的I2C通讯类的传感器

技术参数

  • 工作电压:VCC 3.3-5V
  • I2C数字信号输出
  • 气强范围 : 0~700 KPa
  • 解析度: 0.1
  • 精度: 2%
  • 模块尺寸:46x72x7.5mm

引脚定义/接口说明

VCC 电源
SDA I2C数据
SCL I2C时钟
GND
  • 拨动开关,可选择模块的I2C地址,用于避免与其他I2C设备地址冲突。注意,重新选择I2C地址后,需要重新上电才能生效!

使用教程

1、在程序编程中需要注意拨动开关地址和程序中的地址一致!

2、气压传感器测量对象为与气管导通的气体的气压,当气管不外接任何装置时测量对象为当前大气压。

掌控板

图形化编程

气压.png

代码编程

from mpython import *                   # 导入mpython
import bluebit                          # 导入bluebit 模块

meter=bluebit.DelveBit(0x60)            # 实例模块,根据实际I2C地址修改

while True:
    value = meter.common_measure()      # 测量
    print("measure: %f" %value)
    sleep_ms(200)

Arduino

#include <Wire.h>
int reading = 0;
void GetSensorValue(char address)
{
    Wire.requestFrom(address, 2); 
    if (2 <= Wire.available())
    {
       reading = Wire.read();  // receive high byte (overwrites previous reading)
       reading = reading << 8;    // shift high byte to be high 8 bits
       reading |= Wire.read(); // receive low byte as lower 8 bits
       Serial.println(reading);   // print the reading
    } 
}

void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop()
{
   GetSensorValue(0x63);
}

microbit

应用案例

FAQ

版本历史记录

Version Date 新增/删除/修复