#embedded-hal-driver #sensirion #driver #scd41 #scd40

no-std bin+lib scd4x

Rust driver for the Sensirion SCD4x series. Carbon Dioxide / Temperature / Humidity sensors.

9 unstable releases

Uses new Rust 2024

0.5.0 Apr 1, 2026
0.4.1 Jul 6, 2025
0.4.0 Mar 8, 2025
0.3.0 Feb 18, 2024
0.1.0 Mar 21, 2021

#245 in Embedded development

Download history 26/week @ 2025-12-25 9/week @ 2026-01-01 8/week @ 2026-01-22 3/week @ 2026-01-29 10/week @ 2026-02-05 3/week @ 2026-02-12 26/week @ 2026-02-19 15/week @ 2026-02-26 12/week @ 2026-03-05 20/week @ 2026-03-12 13/week @ 2026-03-19 50/week @ 2026-03-26 11/week @ 2026-04-02 6/week @ 2026-04-09

83 downloads per month

MIT/Apache

52KB
924 lines

Sensirion I2C SCD4x Driver

crates.io docs.rs License no_std MSRV

A platform-agnostic no_std Rust driver for the Sensirion SCD4x CO2 sensor family (SCD40/SCD41), built on embedded-hal traits. Based on embedded-i2c-scd4x and sgpc3-rs.

Sensirion SCD4x

The SCD4x is a miniature CO2, temperature, and relative humidity sensor using photoacoustic NDIR sensing.

Further information: Datasheet SCD4x

Features

  • Full SCD4x command set (periodic & single-shot measurements, calibration, configuration)
  • SCD41-specific commands behind the scd41 feature flag (single-shot, power down/wake up)
  • Async support via the embedded-hal-async feature
  • Optional thiserror integration for std environments
  • Optional defmt support for embedded logging
  • Blocking and non-blocking measurement modes

Usage

Add to your Cargo.toml:

[dependencies]
scd4x = "0.5"

# For SCD41-specific features (single-shot, power management):
# scd4x = { version = "0.5", features = ["scd41"] }

# For async support:
# scd4x = { version = "0.5", features = ["embedded-hal-async"] }

Full Examples

CLI Utility

Run the built-in CLI to read serial number and measurements (Linux only):

cargo run --features="util"

License

Licensed under either of

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–10MB
~67K SLoC