Uncategorized

CCS811 Module Testing Notes

Asked 
Active today
Viewed 39 times
0

I’ve got a CJMCU-8128 board with CCS811 + HDC1080 + BMP280 sensors.

enter image description here

There is an explanation how to wire it here: https://www.strawdogs.co/2018/07/Using-the-CJMCU-8128-Breakout-Environment-Sensor-Board/

And a repo with different python modules here: https://github.com/OdinsHat/cjmcu-8128-sensor-breakout

My problem is, that only the HDC1000 sensor works for me.

i2cdetect detects devices at 405a and 76 just like in the blog post. Running testHDC1000.py gives me (probably correct) temperature and humidity values.

But when I run ccs811.py I get on the first run:

Traceback (most recent call last):
  File "ccs811.py", line 40, in <module>
    ccs811example()
  File "ccs811.py", line 13, in ccs811example
    c02, tvoc, temp = getdata()
  File "ccs811.py", line 20, in getdata
    temp = ccs.calculateTemperature()
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_CCS811/Adafruit_CCS811.py", line 185, in calculateTemperature
    rntc = (float(vrntc) * float(CCS811_REF_RESISTOR) / float(vref) )
ZeroDivisionError: float division by zero

and on any further run:

Traceback (most recent call last):
  File "ccs811.py", line 40, in <module>
    ccs811example()
  File "ccs811.py", line 13, in ccs811example
    c02, tvoc, temp = getdata()
  File "ccs811.py", line 19, in getdata
    ccs = Adafruit_CCS811()
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_CCS811/Adafruit_CCS811.py", line 92, in __init__
    raise Exception("Device returned an Error! Try removing and reapplying power to the device and running the code again.")
Exception: Device returned an Error! Try removing and reapplying power to the device and running the code again.

until I disconnect and reconnect the sensor. Then I get the division by zero error on the first run again.

Running bme280.py I get this error:

Traceback (most recent call last):
  File "bme280.py", line 44, in <module>
    bme280example()
  File "bme280.py", line 11, in bme280example
    (temp, pressure, humidity) = getdata()
  File "bme280.py", line 27, in getdata
    degrees = sensor.read_temperature()
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_BME280.py", line 215, in read_temperature
    UT = float(self.read_raw_temp())
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_BME280.py", line 194, in read_raw_temp
    self.BME280Data = self._device.readList(BME280_REGISTER_DATA, 8)
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_GPIO/I2C.py", line 136, in readList
    results = self._bus.read_i2c_block_data(self._address, register, length)
  File "/home/pi/.local/lib/python2.7/site-packages/Adafruit_PureIO/smbus.py", line 216, in read_i2c_block_data
    cmdstring[i] = val
TypeError: one character string expected

I’ve read some (german) blogpost that says I should replace the line with cmdstring[i] = str(val), but this does not help either.

share  edit  follow  close   flag
  • 1
    Your I2C communication might not be reliable, especially if you from time to time gets the “I/O Error #121”. So Both CCS811 and BME280 are making trouble. You might like to lower I2C speed (only if you are using Rpi4B) to 50kHz for a more reliable performance. There are other tricks such as removing all other I2C devices, AND removing all pull up resistors of every I2C modules. You might like to read App A of my answer to the following more troubleshooting suggestions: “Rpi BMP180 problem”: stackoverflow.com/questions/60274562/…. Cheers. – tlfong01 2 days ago
  • 1
    I already lowered the speed to 10000 baud according to this Adafruit howto for the CCS811. I am using a Pi 3B and this combined module is the only sensor that is connected to the pi. Things I could try: 1) lower the baud rate even more (I am not sure if this should work) 2) Use 5V power instead of 3,3. – allo 2 days ago
  • 1
    thank you for your clarification. Your 3 in 1 module is a bit completed. Let me read the datasheet and user guide to get a better, and then come back you. It might take me a couple of days. But first some quick comments. (1) If i2cdetect -y 1 can detect all 3 devices’s addresses, then it is 90% sure that I2C hardware wiring and software setup are more or less OK. It is 90% unlikely that the problem will disappear even if you improve I/O performance by lowering speed, shift 3V3 signal to 5V, shorter wiring, removing other devices, removing module pull ups. – tlfong01 2 days ago
  • 1
    (2) I think the problem is in software: (a) AdaFruit software might be out of date and not compatible for newer Rpi hardware and/or software (not an uncommon thing), (b) especially you are using their Ciccuit Python, which I know if not very Rpi compatible. – tlfong01 2 days ago
  • 1
    The three devices in the 3 in 1 module are common things. Perhaps we can try NOT to use AdaFruit software, but other open hardware vendor’s tutorials and see there is any luck. Let me draft something as the research part of a tentative answers. As I said, might take a couple of days. – tlfong01 2 days ago
  • Now let me summarize (1) SwitchDocLab’s HDC100 program runs OK, (2) No luck on AdaFruit’s ccs811.py and bm280.py. I would suggest to first troubleshoot BM280.py. – tlfong01 2 days ago
  • Thank you for your comprehensive analysis so far. There really seem to be different libraries and test programs and I do not have a good overview which ones may be better than other ones, yet. I will debug these things a bit later when I have more time, but your post looks very helpful. – allo yesterday
  • When it helps can I test using a NodeMCU (ESP8266) board (there seemt to be Arduino libraries for some of the sensors as well), but I eventually want to run the application using a pi, so I can process the data on the same device. – allo yesterday
  • Yes, I agree. ESP8266-12 is too small, though you can use ESP32 which is much more powerful, but still small comparing with Rpi4B. I once tried ESP8266-12 but found NodeMCU LUA is very hard to use, while microPython is is too weak. Also ESP8266 IDE is not mature at atl. So I spent some 100 hours playing with it and then gave up. – tlfong01 51 mins ago
  • Rpi python is very good in prototyping. Just now I read my old post on programming HTC1080 and found it not to hard, of course because the chip itself is simple. I ordered CCS811 module a day ago and it arrives today. So I will skip BME280 and start playing with CCS811 now. – tlfong01 48 mins ago
  • Please read Appendix J of my answer for the bad news that AdaFruit CCS811 Library has deprecated. The new AdaFruit library is for Circuit Python which I know is not compatible to Rpi. I am now googling to find another library, hopefully from Piromori. – tlfong01 24 mins ago
  • Just now I casually googled and found a couple of CCS811 python libraries. The one that impresses me most is from SparkFun. I have appended the References 31~33 in the reference list of my answer. I plan to try it tomorrow. Cheers. – tlfong01 just now   Edit
1

Question

The OP is using Rpi3B to read the CJMCU-8128 module with 3 in 1 sensors CCS811 + HDC1080 + BMP280.

$ i2cdetect -y 1 command can read the sensor device addresses 0x40, 0x5A and 0x76 without any problems

So far HDC1080 seems to work, more or less. But AdaFruit test programs for CCS811 and BMP280 return the following errors:

(1) ccs811.py – floating division error

(2) ccs811.py – error when trying to get data

(3) bme280.py – character error in cmdstring[i]

CJMCU-8128

/ to continue, …


Answer

/ to continue, …


Discussion

(1) Since i2cdetect -y 1 can detect all 3 sensors, I2C hardware wiring, and software driver setup should be more or less OK.

(2) Though I2C I/O performance can be improved by (a) lowering speed (may not be possible for Rpi3 though), (b) shifting signal level from 3V3 to 5V, (c) removing other I2C devices on the same bus, (d) removing pullups on modules. But I think it is unlikely to solve the problem. I think it is very likely that the AdaFruit software is out of date, or not compatible with Rpi3 and stretch?

(3) So I am going to read the references the OP mentioned.

(a) Strawdogs' user manual and [AdaFruit] python programs Refs 3, 4 look good.

(4) I read the German blog referred by the OP but found it, as the OP says, not helpful at all.

SandWuhrGucker using the AD converter ADS1115 with Arduino + PI Posted on May 6, 2020 by chef

(5) And when I tried to read the OP’s bme280.py, I found the web link is for the 8128 library, not to any particular bme280.py. So I need to search the library for the BME280 programs, but not sure if that is the exact version of the program that the OP has found error messages.

/ to continue, …


References

(1) AliEXpress CJMCU-8128 CCS811 carbon dioxide CO2 cov temperature and humidity pressure three-in-one sensor – US$22

(2) AliEXpress CJMCU-8128, CCS811 + SI7021 + BMP280, carbon monoxide, temperature and humidity, height, 3 in 1 – US$32

(3) Using the CJMCU 8128 Breakout Environment Sensor Board – Strawdogs, 2018-07-28/2019-07-28

(4) OdinsHat/cjmcu-8128-sensor-breakout [AdaFruit] Programs – GitHub

(5) OdinsHat cjmcu-8128-sensor-breakout/examples/

(6) Adafruit CCS811 Python Library

(7) Adafruit BMP280 Python Library

(8) SwitchDoc Labs Rpi HDC1000 Library v1.1 2017jan

(9) Adafruit_2014 BMP085/BMP180 Python Library (Depreciated, No Longer Supported

(10) BMP085 Datashet v2.5- Bosch 2009

(11) BMP180 Datasheet – Bosch 2009

(12) BMP280 Digital Pressure Sensor Datasheet v1.14 Bosch 2015

(13) BME280 Combined Humidity and Pressure Sensor Datasheet v.16 – Bosch 2018sep

(14) What’s the difference between the BMP280 and the BME280 atmospheric sensors – 20,565 views 2017mar02

(15) UM10204 I2C-bus specification and user manual (referred in BMP180 Datasheet Section 5, Max clock = 3.4MHz) – 2014 NXP

(16) Adafruit BMP280 I2C or SPI Barometric Pressure & Altitude Sensor – US$10

(17) BMP280 Temperature, Pressure, & Altitude Sensor Python Library – Pimoroni 2019nov08

(18) BMP280 Pip Install – PyPi

(19) Pimoroni BMP280 Temperature, Pressure, Altitude Sensor Breakout – £8.40

(20) pimoroni/bmp280-python Library GitHub

(21) pimoroni/bmp280-python Tests GitHub

(22) AdaFruit BMP280 Schematic

(23) Rpi3 BMP180 Barometer Sensor Interface Problem – StackOver Q&A 2020feb18

(24) CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality – AMS

(25) CJMCU-811 CCS811 CO2 eCO2 TVOC Air Quality Gas Sensor ¥36

(26) How Can Rpi3B+ read MQ9 Gas Sensor?

(27) HDC1080 Humidity and Temperature Sensor Study Notes – tlfong01 rpi.org

(28) HDC1080 Humidity and Temperature Sensor Python Programming Notes – tlfong01 rpi.org

(29) CCS811 Python Library – jiemde/CCS811.py LGAQS HT11 (CCS811 + Si7021) for pycom

(30) Python CCS811 Sensor tutorial/software – itbrainpower.net

(31) Sparkfun Qwiic CCS811 Py

(32) SparkFun Qwiic CCS811 PY Docs

(33) SparkFun Qwiic CCS811 PY 0.0.9 User Guide 2019jun15

(34) Raspberry CO2 (eCO2) meter (CJMCU-8118, CCS811, Raspberry Pi, Python) – 2017jul18, 19,191 views

/ to continue, …


Appendices

Appendix A – CJHMCU8128 Product Sheet Summary

AliEXpress CJMCU-8128 CCS811 carbon dioxide CO2 cov temperature and humidity pressure three-in-one sensor – US$22

CJMCU-8128 = CCS811 + HDC1080 (SI7021) + BMP280

Carbon monoxide CO cov temperature and humidity gas barometric pressure height pressure sensor

Three in one sensor

Module Size: 18mm * 21mm

Power supply: 3.3V

CJMCU-8128 is a gas-on-chip (SSoC) + temperature and humidity sensor that uses low-power sensor technology to detect volatile organic compounds (cov) inside.

CCS811 is not a simple gas-on-chip (SSoC) sensor.

It also integrates an MCU inside, so that this sensor has integrated processing capacities, which can be provided without host intervention effective level of carbon dioxide or total volatile organic compound (covt) indicator.

HDC1080 low power high precision digital humidity sensor with temperature sensor

HDC1080 is a digital humidity sensor with built-in temperature sensor, which can provide excellent measurement accuracy with ultra-low power consumption.

HDC1080 supports a wide range of operating supply voltage, and compared to competing solutions, the device can provide benefits at low cost and low power consumption for various common applications. The humidity and temperature sensors are calibrated at the factory.

Relative humidity accuracy is ± 2% (typical value) Temperature accuracy is ± 0.2 ° C (typical) Excellent stability at high humidity 14-bit measurement resolution Current 100nA in standby mode

BMP280 is an absolute barometric pressure sensor designed for mobile applications.

The sensor module is located in a very compact housing. Its small size and low energy consumption allow the production of devices such as cell phones with batteries, GPS modules or watches.

BMP280 is based on proven piezoresistive pressure sensor technology from Bosch with high accuracy, linearity, long term stability and high electromagnetic compatibility. Numerous device operating options provide the greatest flexibility, optimized device power consumption, resolution and filter performance. A sample test is used if the default setting is for the developer to make the design as simple as possible.

Applications

Improvements in GPS navigation (such as improving time progress, calculating the dead, detecting slopes)

Inland navigation (ground detection, elevator detection)

Outdoor navigation, leisure and sports

Weather forecast

Healthcare applications (eg spirometry)

Vertical speed indication (such as ascent or descent speed)


Appendix B – BMP280 pip3 install record

bmp280 pip3 install


Appendix C – Piromori BMP280 Python Driver Listing

# pi@raspberrypi:/usr/local/lib/python3.7/dist-packages/bmp280 $ cat __init__.py
# """BMP280 Driver."""

from i2cdevice import Device, Register, BitField, _int_to_bytes
from i2cdevice.adapter import LookupAdapter, Adapter
import struct

__version__ = '0.0.3'

CHIP_ID = 0x58
I2C_ADDRESS_GND = 0x76
I2C_ADDRESS_VCC = 0x77

class S16Adapter(Adapter):
    """Convert unsigned 16bit integer to signed."""

    def _decode(self, value):
        return struct.unpack('<h', _int_to_bytes(value, 2))[0]

class U16Adapter(Adapter):
    """Convert from bytes to an unsigned 16bit integer."""

    def _decode(self, value):
        return struct.unpack('<H', _int_to_bytes(value, 2))[0]

class BMP280Calibration():
    def __init__(self):
        self.dig_t1 = 0
        self.dig_t2 = 0
        self.dig_t3 = 0

        self.dig_p1 = 0
        self.dig_p2 = 0
        self.dig_p3 = 0
        self.dig_p4 = 0
        self.dig_p5 = 0
        self.dig_p6 = 0
        self.dig_p7 = 0
        self.dig_p8 = 0
        self.dig_p9 = 0

        self.temperature_fine = 0

    def set_from_namedtuple(self, value):
        # Iterate through a tuple supplied by i2cdevice
        # and copy its values into the class attributes
        for key in self.__dict__.keys():
            try:
                setattr(self, key, getattr(value, key))
            except AttributeError:
                pass

    def compensate_temperature(self, raw_temperature):
        var1 = (raw_temperature / 16384.0 - self.dig_t1 / 1024.0) * self.dig_t2
        var2 = raw_temperature / 131072.0 - self.dig_t1 / 8192.0
        var2 = var2 * var2 * self.dig_t3
        self.temperature_fine = (var1 + var2)
        return self.temperature_fine / 5120.0

    def compensate_pressure(self, raw_pressure):
        var1 = self.temperature_fine / 2.0 - 64000.0
        var2 = var1 * var1 * self.dig_p6 / 32768.0
        var2 = var2 + var1 * self.dig_p5 * 2
        var2 = var2 / 4.0 + self.dig_p4 * 65536.0
        var1 = (self.dig_p3 * var1 * var1 / 524288.0 + self.dig_p2 * var1) / 524288.0
        var1 = (1.0 + var1 / 32768.0) * self.dig_p1
        pressure = 1048576.0 - raw_pressure
        pressure = (pressure - var2 / 4096.0) * 6250.0 / var1
        var1 = self.dig_p9 * pressure * pressure / 2147483648.0
        var2 = pressure * self.dig_p8 / 32768.0
        return pressure + (var1 + var2 + self.dig_p7) / 16.0

class BMP280:
    def __init__(self, i2c_addr=I2C_ADDRESS_GND, i2c_dev=None):
        self.calibration = BMP280Calibration()
        self._is_setup = False
        self._i2c_addr = i2c_addr
        self._i2c_dev = i2c_dev
        self._bmp280 = Device([I2C_ADDRESS_GND, I2C_ADDRESS_VCC], i2c_dev=self._i2c_dev, bit_width=8, registers=(
            Register('CHIP_ID', 0xD0, fields=(
                BitField('id', 0xFF),
            )),
            Register('RESET', 0xE0, fields=(
                BitField('reset', 0xFF),
            )),
            Register('STATUS', 0xF3, fields=(
                BitField('measuring', 0b00001000),  # 1 when conversion is running
                BitField('im_update', 0b00000001),  # 1 when NVM data is being copied
            )),
            Register('CTRL_MEAS', 0xF4, fields=(
                BitField('osrs_t', 0b11100000,   # Temperature oversampling
                         adapter=LookupAdapter({
                             1: 0b001,
                             2: 0b010,
                             4: 0b011,
                             8: 0b100,
                             16: 0b101
                         })),
                BitField('osrs_p', 0b00011100,   # Pressure oversampling
                         adapter=LookupAdapter({
                             1: 0b001,
                             2: 0b010,
                             4: 0b011,
                             8: 0b100,
                             16: 0b101})),
                BitField('mode', 0b00000011,     # Power mode
                         adapter=LookupAdapter({
                             'sleep': 0b00,
                             'forced': 0b10,
                             'normal': 0b11})),
            )),
            Register('CONFIG', 0xF5, fields=(
                BitField('t_sb', 0b11100000,     # Temp standby duration in normal mode
                         adapter=LookupAdapter({
                             0.5: 0b000,
                             62.5: 0b001,
                             125: 0b010,
                             250: 0b011,
                             500: 0b100,
                             1000: 0b101,
                             2000: 0b110,
                             4000: 0b111})),
                BitField('filter', 0b00011100),                   # Controls the time constant of the IIR filter
                BitField('spi3w_en', 0b0000001, read_only=True),  # Enable 3-wire SPI interface when set to 1. IE: Don't set this bit!
            )),
            Register('DATA', 0xF7, fields=(
                BitField('temperature', 0x000000FFFFF0),
                BitField('pressure', 0xFFFFF0000000),
            ), bit_width=48),
            Register('CALIBRATION', 0x88, fields=(
                BitField('dig_t1', 0xFFFF << 16 * 11, adapter=U16Adapter()),   # 0x88 0x89
                BitField('dig_t2', 0xFFFF << 16 * 10, adapter=S16Adapter()),   # 0x8A 0x8B
                BitField('dig_t3', 0xFFFF << 16 * 9, adapter=S16Adapter()),    # 0x8C 0x8D
                BitField('dig_p1', 0xFFFF << 16 * 8, adapter=U16Adapter()),    # 0x8E 0x8F
                BitField('dig_p2', 0xFFFF << 16 * 7, adapter=S16Adapter()),    # 0x90 0x91
                BitField('dig_p3', 0xFFFF << 16 * 6, adapter=S16Adapter()),    # 0x92 0x93
                BitField('dig_p4', 0xFFFF << 16 * 5, adapter=S16Adapter()),    # 0x94 0x95
                BitField('dig_p5', 0xFFFF << 16 * 4, adapter=S16Adapter()),    # 0x96 0x97
                BitField('dig_p6', 0xFFFF << 16 * 3, adapter=S16Adapter()),    # 0x98 0x99
                BitField('dig_p7', 0xFFFF << 16 * 2, adapter=S16Adapter()),    # 0x9A 0x9B
                BitField('dig_p8', 0xFFFF << 16 * 1, adapter=S16Adapter()),    # 0x9C 0x9D
                BitField('dig_p9', 0xFFFF << 16 * 0, adapter=S16Adapter()),    # 0x9E 0x9F
            ), bit_width=192)
        ))

    def setup(self):
        if self._is_setup:
            return
        self._is_setup = True

        self._bmp280.select_address(self._i2c_addr)

        try:
            chip = self._bmp280.get('CHIP_ID')
            if chip.id != CHIP_ID:
                raise RuntimeError("Unable to find bmp280 on 0x{:02x}, CHIP_ID returned {:02x}".format(self._i2c_addr, chip.id))
        except IOError:
            raise RuntimeError("Unable to find bmp280 on 0x{:02x}, IOError".format(self._i2c_addr))

        self._bmp280.set('CTRL_MEAS',
                         mode='normal',
                         osrs_t=16,
                         osrs_p=16)

        self._bmp280.set('CONFIG',
                         t_sb=500,
                         filter=2)

        self.calibration.set_from_namedtuple(self._bmp280.get('CALIBRATION'))

    def update_sensor(self):
        self.setup()

        raw = self._bmp280.get('DATA')

        self.temperature = self.calibration.compensate_temperature(raw.temperature)
        self.pressure = self.calibration.compensate_pressure(raw.pressure) / 100.0

    def get_temperature(self):
        self.update_sensor()
        return self.temperature

    def get_pressure(self):
        self.update_sensor()
        return self.pressure

    def get_altitude(self, qnh=1013.25):
        self.update_sensor()
        pressure = self.get_pressure()
        altitude = 44330.0 * (1.0 - pow(pressure / qnh, (1.0 / 5.255)))
        return altitude

# pi@raspberrypi:/usr/local/lib/python3.7/dist-packages/bmp280 $ 

Appendix D – AdaFruit BMP280 Schematic

bmp280 schematic


Appendix E – BMP280 Datasheet Summary

BMP280 Datasheet – Bosch

bmp280 summary


*Appendix F – Piromoni BMP280 Python Library

Piromoni BMP280 Python Library (bmp280 driver, i2cdevice, adapter) Listing


Appendix G – BMP280 Wiring Diagram

bmp280 wiring diagram


Appendix H – CCS811 Wiring Diagram

ccs811


Appendix I – HDC1080 Python Program

Now I am reading my old post to refresh my memory of how did I program the HTC1080. I remember that the device is simple, and so it took me only a couple of hours to debug the program. I summarize some design notes below:

HTC1080 Programming Design Notes 1/3 HTC1080 Programming Design Notes 2/3 HTC1080 Programming Design Notes 3/3

htc1080 1

htc1080 2

htc1080 3

htc1080 4

# hts01.1115 tlfong01 2018aug17hkt1458
# Reference Re: Relay Module KY-019 5V Fri Aug 17, 2018 8:37 am
# https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=77158&hilit=HDC1080&start=325#p1353100
# https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=77158&hilit=HDC1080&start=325#p1353105
# https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=77158&p=1353982&hilit=HDC1080#p1353982

def readTemperatureAndHumidity():
    print('\n    >>>> Begin Read Temperature and Humidity <<<<<<<<<<<<\n')
    print('      Time        =', getTimeNowStr(), '\n')

    # *** Config Device ***
    writeDvNumRegOneByte(dvNum, 'Config', configByteDict['0'])

    # *** Trigger Temperature Measurement ***
    writeDvNumSlaveOneByte(dvNum, regAddrByteDict['Temperature'])
    pauseMilliSeconds('TenMilliSeconds')

    # *** Read Raw Temperature Data ***
    tempWord = readDvNumSlaveOneWord(dvNum)
    tempMsByte = tempWord & 0x00ff
    tempLsByte = tempWord >> 8

    cTemp1 = (((tempMsByte * 256) + tempLsByte) / 65536.0) * 165.0 - 40
    print('      Temperature =', '%.2f' % cTemp1, 'degrees Centigrade.\n')

    # *** Trigger Humidity Measurement ***
    writeDvNumSlaveOneByte(dvNum, regAddrByteDict['Humidity'])
    pauseMilliSeconds('TenMilliSeconds')

    # *** Read Raw Humidity Data ***
    humidWord = readDvNumSlaveOneWord(dvNum)
    humidMsByte = humidWord & 0x00ff
    humidLsByte = humidWord >> 8
    percentHumid = (((humidMsByte * 256) + humidLsByte) / 65536.0) * 100.0
    print('      Humidity    =', '%.2f' % percentHumid, '%.')    

    print('\n    >>>> End  Read Temperature and Humidity <<<<<<<<<<<<')
    return

# *** Sample Output ***
'''
*** HDC1080 Test Functions ***
    0   Print/Change Device Number
    1   Read Temperature and Humidity
    2   Read Device Id
    3   Read Manufacturer Id
    4   Read Serial Id
    t   Test Temp
    x   Exit

    Test Number  = 1  Your selection = ? 0

    Device Num         = 0
    Device Name        = Thomas
    Device address     = 0x40

    Test Number  = 2  Your selection = ? 1

    >>>> Begin Read Temperature and Humidity <<<<<<<<<<<<

      Time        = 2018-08-17 16:14 

      Temperature = 28.96 degrees Centigrade.

      Humidity    = 82.81 %.

    >>>> End  Read Temperature and Humidity <<<<<<<<<<<<

    Test Number  = 3  Your selection = ? 2

    Device Id = 0x1050

    Test Number  = 4  Your selection = ? 3

    Manufacturer Id = 0x5449

    Test Number  = 5  Your selection = ? 4

    Serial Id = 0x00 0x8d 0xe4 0x80

'''

Appendix J – AdaFruit’s CCS811 Library Deprecated

Adafruit CCS811 Python Library DEPRECATED – 2018aug31

This library has been deprecated! We are now only using our CircuitPython sensor libraries for Python. We are leaving the code up for historical/research purposes but archiving the repository. Please use our Adafruit CircuitPython CSS811 library instead!

/ to continue, …


End of answer

share  edit   delete  flag
  • 1
    Do you think the two ccs811 errors are related because the first run tries to read a reference value that is not there yet and the second run get the reference value (e.g. from the previous run) and then fails during the next step? The division by zero error seems to be related to vref as reference value for the sensor output. – allo yesterday
  • Ah, I have not yet looked at your bmp280.py program. I need to first look at the big picture, starting with the library. I found Pimonori has a similar library:penzu.com/p/05db0200. I think perhaps I will try the Pimoron python library and run their examples. Pimoroni seems partnering with AdaFruit and so their libraries came from the same source. The bad thing about AdaFruit library is that they usually favour Circuit Python hardware, and Circuit Python is not very compatible with Rpi. – tlfong01 yesterday
  • ThePimoroni BMP280 library links are in Ref 19 ~ 21, and Installation and Listing in Appendix B and F. It is easy to install, just pip and that is it. Perhaps you might run this Piromonir version. I shall catch up later. If you find Pimoroni bmp280 library good, then I might google if they has any CCS811 library. – tlfong01 yesterday
.END

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: