adafruit_scd30

Helper library for the SCD30 CO2 sensor

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_scd30.SCD30(i2c_bus, ambient_pressure=0, address=97)

CircuitPython helper class for using the SCD30 CO2 sensor

Parameters
  • i2c_bus (I2C) – The I2C bus the SCD30 is connected to.

  • ambient_pressure (int) – Ambient pressure compensation. Defaults to 0

  • address (int) – The I2C device address for the sensor. Default is 0x61

Quickstart: Importing and using the SCD30

Here is an example of using the SCD30 class. First you will need to import the libraries to use the sensor

import board
import adafruit_scd30

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()   # uses board.SCL and board.SDA
scd = adafruit_scd30.SCD30(i2c)

Now you have access to the CO2, temperature and humidity using the CO2, temperature and relative_humidity attributes

temperature = scd.temperature
relative_humidity = scd.relative_humidity
co2_ppm_level = scd.CO2
property CO2

Returns the CO2 concentration in PPM (parts per million)

Note

Between measurements, the most recent reading will be cached and returned.

property altitude

Specifies the altitude at the measurement location in meters above sea level. Setting this value adjusts the CO2 measurement calculations to account for the air pressure’s effect on readings.

Note

This value will be saved and will not be reset on boot or by calling reset.

property ambient_pressure

Specifies the ambient air pressure at the measurement location in mBar. Setting this value adjusts the CO2 measurement calculations to account for the air pressure’s effect on readings. Values must be in mBar, from 700 to 1400 mBar

property data_available

Check the sensor to see if new data is available

property forced_recalibration_reference

Specifies the concentration of a reference source of CO2 placed in close proximity to the sensor. The value must be from 400 to 2000 ppm.

Note

Specifying a forced recalibration reference will override any calibration values set by Automatic Self Calibration

property measurement_interval

Sets the interval between readings in seconds. The interval value must be from 2-1800

Note

This value will be saved and will not be reset on boot or by calling reset.

property relative_humidity

Returns the current relative humidity in %rH.

Note

Between measurements, the most recent reading will be cached and returned.

reset()

Perform a soft reset on the sensor, restoring default values

property self_calibration_enabled

Enables or disables automatic self calibration (ASC). To work correctly, the sensor must be on and active for 7 days after enabling ASC, and exposed to fresh air for at least 1 hour per day. Consult the manufacturer’s documentation for more information.

Note

Enabling self calibration will override any values set by specifying a forced_recalibration_reference

Note

This value will be saved and will not be reset on boot or by calling reset.

property temperature

Returns the current temperature in degrees Celsius

Note

Between measurements, the most recent reading will be cached and returned.

property temperature_offset

Specifies the offset to be added to the reported measurements to account for a bias in the measured signal. Value is in degrees Celsius with a resolution of 0.01 degrees and a maximum value of 655.35 C

Note

This value will be saved and will not be reset on boot or by calling reset.