Sensirion I2C SEN5x Driver
A platform-agnostic no_std Rust driver for the Sensirion SEN5x series (SEN50/SEN54/SEN55), built on embedded-hal traits. Based on embedded-i2c-sen5x and sgpc3-rs.
Sensirion SEN5x
The SEN5x is an all-in-one sensor solution platform for the accurate measurement of various environmental parameters, such as particulate matter, volatile organic compounds (VOCs), oxidizing gases, such as nitrogen oxide compounds (NOx), as well as humidity & temperature.
- SEN50: Particulate matter only
- SEN54: PM + VOC + humidity + temperature
- SEN55: PM + VOC + NOx + humidity + temperature
Further information: Datasheet Environmental Node SEN5x
Features
- Full SEN5x command set (measurement control, fan cleaning, device info, status)
- Temperature compensation parameters (offset, slope, time constant)
- VOC/NOx algorithm tuning and state backup/restore
- Fan auto cleaning interval configuration
- RH/T acceleration mode
- Async support via the
embedded-hal-asyncfeature - Optional
defmtsupport for embedded logging - Optional
thiserrorintegration forstdenvironments
Usage
Add to your Cargo.toml:
[]
= "0.1"
# For async support:
# sen5x = { version = "0.1", features = ["embedded-hal-async"] }
Blocking Example
use Sen5x;
let mut sensor = new;
sensor.device_reset?;
delay.delay_ms;
let serial = sensor.serial_number?;
let version = sensor.version?;
sensor.start_measurement?;
loop
Async Example
use Sen5xAsync;
let mut sensor = new;
sensor.start_measurement.await?;
loop
Full Examples
- Linux / Raspberry Pi — blocking driver with
linux-embedded-hal - ESP32-C3 Embassy — async driver with
esp-haland Embassy
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
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.