raspberry-pi - BMP280 报告奇数输出 RPi
问题描述
连接到我的 RPi0W 的 BMP280 报告一致的 133.90 摄氏度(应该在 25 度左右......)同样报告超过 500 万帕斯卡压力(应该在 100,000 左右。)
温度 = 133.90 *C 压力 = 5611578.00 Pa 高度 = -50829.45 m 海平面压力 = 5611578.00 Pa
我正在使用 Adafruit Python 测试程序(只有 6 行代码......没有错误指示)我所做的唯一更改是引用 I2C 地址 0x76 而不是默认的 0x77,因为我没有使用 Adafruit 品牌 BMP280 .
#!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Can enable debug output by uncommenting:
#import logging
#logging.basicConfig(level=logging.DEBUG)
import Adafruit_BMP.BMP085 as BMP085
# Default constructor will pick a default I2C bus.
#
# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header and the library will figure out the bus number based
# on the Pi's revision.
#
# For the Beaglebone Black the library will assume bus 1 by default, which is
# exposed with SCL = P9_19 and SDA = P9_20.
sensor = BMP085.BMP085(address=0x76)
# Optionally you can override the bus number:
#sensor = BMP085.BMP085(busnum=2)
# You can also optionally change the BMP085 mode to one of BMP085_ULTRALOWPOWER,
# BMP085_STANDARD, BMP085_HIGHRES, or BMP085_ULTRAHIGHRES. See the BMP085
# datasheet for more details on the meanings of each mode (accuracy and power
# consumption are primarily the differences). The default mode is STANDARD.
#sensor = BMP085.BMP085(mode=BMP085.BMP085_ULTRAHIGHRES)
print(sensor.read_temperature())
print('Temp = {0:0.2f} *C'.format(sensor.read_temperature()))
print('Pressure = {0:0.2f} Pa'.format(sensor.read_pressure()))
print('Altitude = {0:0.2f} m'.format(sensor.read_altitude()))
print('Sealevel Pressure = {0:0.2f} Pa'.format(sensor.read_sealevel_pressure()))
Adafruit 检测器确实可以正确检测到 I2C 地址 0x76。
连接到同一块板上的 DHT11 报告的温度大致准确为 84 华氏度(它位于我笔记本电脑的排气流中……哈哈)
我应该检查什么?
解决方案
设备品牌是“gybmep”。经过一些额外的搜索,我发现我可能使用了错误的 Adafruit 库。我发现了另一种方法
看来我应该一直在使用 Adafruit BME280 库。从那个库示例代码中,我得到了合理的结果。
推荐阅读
- laravel - 在 laravel 中插入数据后重定向并显示成功消息
- python - 地理编码:模块没有属性“google”
- windows - 从 Windows 中的备用寄存器粘贴
- java - gradle 刷新失败:没有方法签名
- android - ExoPlayer:控制前进和后退按钮的跳过间隔
- android - ACTION_SEND 附件未显示在 Instagram 中
- javascript - 如何解决在快速框架NodeJS中发送后无法设置标头?
- javascript - .then 在 promise 解决之前触发 - $.getJSON
- python - Python中给定数字的阶乘的单行输出
- ruby - 使用 SSL、cookie、标头在站点上进行身份验证 - 不起作用