Quantcast
Channel: Pi cannot communicate with I2C sensor - Raspberry Pi Stack Exchange
Viewing all articles
Browse latest Browse all 3

Pi cannot communicate with I2C sensor

$
0
0

I apologize my last post did not upload properly so I am creating a new question.

I am using the CCS811 Gas Sensor with a Pi 3 Model b. I followed the steps on this page https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor/raspberry-pi-wiring-and-test and it ran without issue during the burn in period. Now I am getting the error below.

I know the sensor works because I tested it with my Arduino Uno and I can get the readings. On my Pi it shows the correct address of the sensor when I run sudo i2cdetect -y 1.

I have wiped the SD card 3 times now and started over on a clean slate all to end up with this error each time. Any help will be greatly appreciated!

Here is the code that I am using to read the data from the sensor:

ccs = Adafruit_CCS811()while not ccs.available():        passtemp = ccs.calculateTemperature()ccs.tempOffset = temp - 25.0while(1):         if ccs.available():             temp = ccs.calculateTemperature()             if not ccs.readData():               print "CO2: ", ccs.geteCO2(), "ppm, TVOC: ", ccs.getTVOC(), "temp: ", tempelse:  print "ERROR!"  while(1):    passsleep(2)

Here is the error:

pi@raspberrypi:~/Adafruit_CCS811_python/examples$ sudo python CCS811_example.pyTraceback (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.

Image of project


Viewing all articles
Browse latest Browse all 3

Trending Articles