API Reference
adafruit_stcc4
CircuitPython driver for the STCC4 and SHT41 - CO2, Temperature and Humidity Sensor
Author(s): Liz Clark
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- adafruit_stcc4.STATUS_DEBUG = 14
Debug flags mask.
- adafruit_stcc4.STATUS_MEMORY_ERROR = 96
Memory error flags mask.
- adafruit_stcc4.STATUS_SHT_NOT_CONNECTED = 16
SHT sensor not connected flag.
- adafruit_stcc4.STATUS_TESTING_MODE = 16384
Testing mode active flag.
- adafruit_stcc4.STATUS_VOLTAGE_ERROR = 1
Supply voltage error flag.
- class adafruit_stcc4.STCC4(i2c_bus: busio.I2C, address: int = _STCC4_DEFAULT_ADDR)
Driver for the STCC4 CO2 sensor with integrated SHT41.
- Parameters:
- property CO2: int
CO2 concentration in parts per million (ppm).
If continuous measurement is not active, a single-shot measurement is triggered automatically.
- Returns:
CO2 concentration in ppm.
- Return type:
- property continuous_measurement: bool
Enable or disable continuous measurement with a 1 s sampling interval.
- forced_recalibration(reference_co2: int) int
Perform forced recalibration (FRC) using a known CO2 reference.
- measure_single_shot() None
Trigger a single-shot measurement and wait for it to complete.
After calling this method, read
CO2,temperature, andrelative_humidityto retrieve the results.
- perform_conditioning() None
Run sensor conditioning to improve initial CO2 accuracy.
Warning
This blocks for approximately 22 seconds.
- pressure_compensation(pressure_hpa: int) None
Ambient pressure for CO2 compensation.
- Parameters:
pressure_hpa (int) – Ambient pressure in hPa (e.g. 1013 for sea level).
- property product_id: int
32-bit product identifier.
- Returns:
Product ID read from the sensor.
- Return type:
- property relative_humidity: float
Relative humidity as a percentage.
Note
Call
CO2first to trigger a fresh measurement, or usemeasure_single_shot()/continuous_measurement(). This property returns the value from the most recent reading.- Returns:
Relative humidity in %.
- Return type:
- rht_compensation(rht_value: int) None
External RH/T compensation value.
- Parameters:
rht_value (int) – 16-bit RH/T compensation value per datasheet.
- self_test() int
Run the built-in self-test.
- Returns:
Self-test result.
0indicates no errors detected.- Return type:
- property status: int
Raw status word from the most recent measurement.
Compare against the
STATUS_*constants to check for specific conditions.- Returns:
16-bit status word.
- Return type:
- property temperature: float
Temperature in degrees Celsius.
Note
Call
CO2first to trigger a fresh measurement, or usemeasure_single_shot()/continuous_measurement(). This property returns the value from the most recent reading.- Returns:
Temperature in °C.
- Return type: