Maddening i2c problem with the Adafruit ccs811

The Adafruit ccs811 Gas Censor, ready for header installation

I’m trying to write a python script to use my and it WON’T respond. I’m sure my python code is good, but I keep getting this horrible error. It’s like the ccs811 isn’t even attached! I mean, look at this:

Traceback (most recent call last):
File "", line 54, in
File "/usr/local/lib/python3.7/dist-packages/", line 162, in tvoc
File "/usr/local/lib/python3.7/dist-packages/", line 147, in _update_data
if self.data_ready:
File "/usr/local/lib/python3.7/dist-packages/adafruit_register/", line 60, in <strong>get</strong>
i2c.write_then_readinto(self.buffer, self.buffer, out_end=1, in_start=1)
File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/", line 156, in write_then_readinto
File "/usr/local/lib/python3.7/dist-packages/", line 118, in writeto_then_readfrom
File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/", line 85, in writeto_then_readfrom
address, buffer_out[out_start:out_end], in_end - in_start
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/", line 273, in read_i2c_block_data
ioctl(self._device.fileno(), I2C_RDWR, request)
OSError: [Errno 121] Remote I/O error

What the hell?!?!

I do a little research and realize that the module has issues when it runs at full speed. The trick to getting the Adafruit Gas Sensor to respond is to slow down the i2c bus speed. This is simple to do.

Edit /boot/config.txt and add a couple of lines to the end:


Reboot and run your script again! After a couple of minutes, the heater comes to operating temp and you start getting good readings! w00t!

I’m working on getting this Adafruit Gas Sensor installed above my 3D printer to watch for high fume levels coming from the printing process.

Author: John

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.