BMP280报告奇数输出RPi

问题描述 投票:0回答:1

我连接到RPi0W的BMP280报告的摄氏温度恒定为133.90摄氏度(应为25度左右。。。。同样,报告的压力超过500万帕斯卡(应为100,000。)]

温度= 133.90 * C压力= 5611578.00 Pa海拔= -50829.45 m海平面压力= 5611578.00 Pa

我正在使用Adafruit Python测试程序(仅6行代码。...没有错误指示)我所做的唯一更改是引用0x76的I2C地址而不是默认的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度(它正坐在我笔记本电脑的排气流中……大声笑)

我应该检查什么?

raspberry-pi i2c
1个回答
0
投票

设备的品牌是“ gybmep”。经过一些额外的搜索后,我发现我可能使用了错误的Adafruit库。我在[]找到了另一种方法

"USING THE BMP280 TEMP/PRESS SENSOR ON THE RASPBERRY PI "


0
投票

可能是这个古老的错误吗?

© www.soinside.com 2019 - 2024. All rights reserved.