[英]Raspberry Pi stopped communicating with i2c sensor
我正在使用帶有 Pi 3 型號 b 的 CCS811 氣體傳感器。 我按照此頁面上的步驟https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor/raspberry-pi-wiring-and-test 進行了操作,並且在刻錄期間運行沒有問題。 現在我收到以下錯誤。
我知道傳感器可以工作,因為我用我的 Arduino Uno 對其進行了測試,我可以獲得讀數。 在我的 Pi 上,當我運行 sudo i2cdetect -y 1 時,它顯示了傳感器的正確地址。
我現在已經擦了 3 次 SD 卡,然后從頭開始,每次都以這個錯誤告終。 任何幫助將不勝感激!
這是我用來從傳感器讀取數據的代碼:
ccs = Adafruit_CCS811()
while not ccs.available():
pass
temp = ccs.calculateTemperature()
ccs.tempOffset = temp - 25.0
while(1):
if ccs.available():
temp = ccs.calculateTemperature()
if not ccs.readData():
print "CO2: ", ccs.geteCO2(), "ppm, TVOC: ", ccs.getTVOC(), "temp: ", temp
else:
print "ERROR!"
while(1):
pass
sleep(2)
這是我得到的錯誤
pi@raspberrypi:~/Adafruit_CCS811_python/examples$ sudo python CCS811_example.py
Traceback (most recent call last):
File "CCS811_example.py", line 6, in <module>
ccs = Adafruit_CCS811()
File "/usr/local/lib/python2.7/dist-packages/Adafruit_CCS811/Adafruit_CCS811.py", line 84, in __init__
raise Exception("Device ID returned is not correct! Please check your wiring.")
Exception: Device ID returned is not correct! Please check your wiring.
Raspberry Pi 不支持此傳感器。 這是因為它使用了 I2C 時鍾擴展,而 Pi 在不大幅降低 I2C 速度的情況下無法做到這一點。 支持 CircuitPython 和 Arduino。
引自:
https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor/overview
AMS 建議您在第一次收到傳感器時運行 48 小時以“燒入”,然后在每次使用傳感器時在所需模式下運行 20 分鍾。 這是因為傳感器的靈敏度水平會在早期使用過程中發生變化。
引自:
https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor/overview
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.