Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

CCS811 math.log domain error
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CCS811 math.log domain error

by infinisean on Fri May 29, 2020 12:45 pm

I am trying to get the example code for the Adafruit CCS811 sensor to work and after following the guide step by step, I am getting this error at runtime:

pi@MushPi4:~ $ python ./Adafruit_CCS811_python/examples/CCS811_example.py
Traceback (most recent call last):
File "./Adafruit_CCS811_python/examples/CCS811_example.py", line 10, in <module>
temp = ccs.calculateTemperature()
File "/home/pi/Adafruit_CCS811_python/examples/Adafruit_CCS811.py", line 188, in calculateTemperature
ntc_temp = math.log(rntc / 10000.0)
ValueError: math domain error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


From a quick google search, it seems like this error comes from trying to perform a log function on a negative number but I am not really sure how a negative number could be passed to that function via the rntc variable or how to resolve the issue.

Any assistance or advice would be greatly appreciated.

Thanks!

-Sean

infinisean
 
Posts: 5
Joined: Thu May 28, 2020 9:18 pm

Re: CCS811 math.log domain error

by siddacious on Sat May 30, 2020 2:37 am

Adafruit_CCS811_python has been deprecated and is no longer supported or maintained.

Please try the newer Adafruit_CircuitPython_CCS811 library and see if that works better:

https://github.com/adafruit/Adafruit_Ci ... -from-pypi

siddacious
 
Posts: 271
Joined: Fri Apr 21, 2017 3:09 pm

Re: CCS811 math.log domain error

by infinisean on Sat May 30, 2020 2:55 am

Different error with that one...

root@MushPi4:/home/pi# python3 ./Downloads/Adafruit_CircuitPython_CCS811-master/examples/ccs811_simpletest.py
Traceback (most recent call last):
File "./Downloads/Adafruit_CircuitPython_CCS811-master/examples/ccs811_simpletest.py", line 6, in <module>
i2c = busio.I2C(board.SCL, board.SDA)
AttributeError: module 'board' has no attribute 'SCL'

infinisean
 
Posts: 5
Joined: Thu May 28, 2020 9:18 pm

Please be positive and constructive with your questions and comments.