Skip to main content

Sensirion SCD30 CO² Sensor I2C driver for MicroPython

Sensirion SCD30 is a CO², Humidity and Temperature sensor on a module. This is a I2C driver written in Python 3 for MicroPython.

Getting Started

Prerequisites

  • Sensirion SCD30 Sensor Module
  • MicroPython board with I2C interface

Wiring

Wire the I2C bus to the I2C bus on your MicroPython board. This is an example using the Pyboard D:

Pyboard SCD30
X15 (3V3) VDD
X14 (GND) GND
X9 TX/SCL
X10 RX/SDA

Usage

This example reads the measurements in a continous loop:

import time
from machine import I2C, Pin
from scd30 import SCD30

i2cbus = I2C(1)
scd30 = SCD30(i2c, 0x61)

while True:
    # Wait for sensor data to be ready to read (by default every 2 seconds)
    while scd30.get_status_ready() != 1:
        time.sleep_ms(200)
    scd30.read_measurement()

Note that the CO² sensor needs some time to stabilize. Therefor the sensor should be kept powered to achieve a reasonable measurement interval (e.g. <5 minutes). To save power the sensors measurement inverval can be tweaked. See also the Low Power Mode for SCD30 application note.

Calibration

The CO² sensor has two modes of calibration: FRC (Forced Recalibration) or ASC (Automatic Self-Calibration). This only describes the former.

Essentially the sensor is already calibrated at factory. However, when setting a new measurement interval recalibration might be necessary. The process is to bring the sensor into a controlled environment (e.g. outside) and set the known value at that environment (e.g. 400ppm). From what I understand ASC does essentially the same, just assumes that the lowest values over a certain periode are "outside values"...

Also note that the temperature sensor suffers from heating effects on the PCB. When the sensor operates in 2 second interval the heating is about 3°C. I usually run the sensor at 30 seconds interval and observed a heating of 2°C. The offset is subtracted from the measured temperature! To set a new offset, take the old offset into account!

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details

Metadata

Release files for micropython-scd30 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micropython-scd30 0.2.0
File Size Uploaded Provenance Actions
micropython-scd30-0.2.0.tar.gz 4.5 kB Without provenance Details for micropython-scd30-0.2.0.tar.gz

Release files / micropython-scd30-0.2.0.tar.gz

Download URL micropython-scd30-0.2.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3aba91cac53b98f65c39d61f1d3cf3687a161d334d691c7db1447d1636859eb6
BLAKE2b-256 checksum
How to use checksums
3b78f4b0659a50555a53fa06b6435912ebc747793e94fe2ed40bc8db4382ba2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

Security for micropython-scd30 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page