Expand description
This crate provides a platform agnostic no_std driver for the SEN6X sensor modules.
The driver is compatible with the embedded-hal traits.
The data sheet of the sensor modules can be found here.
§Supported Features by Sensor Variant (Blocking & Async)
Both blocking and async modes are implemented for the following functionality.
| Functionality | SEN63C | SEN65 | SEN66 | SEN68 |
|---|---|---|---|---|
| Start/stop measurement | ✓ | ✓ | ✓ | ✓ |
| Get data ready status | ✓ | ✓ | ✓ | ✓ |
| Read measured values | ✓ | ✓ | ✓ | ✓ |
| Read raw measured values | ✓ | ✓ | ✓ | ✓ |
| Read number concentration values | ✓ | ✓ | ✓ | ✓ |
| Set temperature offset parameters | ✓ | ✓ | ✓ | ✓ |
| Set temperature acceleration | ✓ | ✓ | ✓ | ✓ |
| Get product name | ✓ | ✓ | ✓ | ✓ |
| Get serial number | ✓ | ✓ | ✓ | ✓ |
| Read/clear device status | ✓ | ✓ | ✓ | ✓ |
| Device reset | ✓ | ✓ | ✓ | ✓ |
| Fan cleaning | ✓ | ✓ | ✓ | ✓ |
| Activate SHT heater | ✓ | ✓ | ✓ | ✓ |
| VOC algorithm tuning parameters | ✗ | ✓ | ✓ | ✓ |
| VOC algorithm state | ✗ | ✓ | ✓ | ✓ |
| NOx algorithm tuning parameters | ✗ | ✓ | ✓ | ✓ |
| Forced CO2 recalibration | ✓ | ✗ | ✓ | ✗ |
| CO2 sensor auto calibration | ✓ | ✗ | ✓ | ✗ |
| Set/get ambient pressure | ✓ | ✗ | ✓ | ✗ |
| Set/get sensor altitude | ✓ | ✗ | ✓ | ✗ |
§Sensor Measurements by Variant
| Measurement | SEN63C | SEN65 | SEN66 | SEN68 |
|---|---|---|---|---|
| PM1.0 (µg/m³) | ✓ | ✓ | ✓ | ✓ |
| PM2.5 (µg/m³) | ✓ | ✓ | ✓ | ✓ |
| PM4.0 (µg/m³) | ✓ | ✓ | ✓ | ✓ |
| PM10 (µg/m³) | ✓ | ✓ | ✓ | ✓ |
| Humidity (%) | ✓ | ✓ | ✓ | ✓ |
| Temperature (°C) | ✓ | ✓ | ✓ | ✓ |
| CO2 (ppm) | ✓ | ✗ | ✓ | ✗ |
| VOC (index points) | ✗ | ✓ | ✓ | ✓ |
| NOx (index points) | ✗ | ✓ | ✓ | ✓ |
| HCHO (ppb) | ✗ | ✗ | ✗ | ✓ |
§Raw Measurements by Variant
| Raw Measurement | SEN63C | SEN65 | SEN66 | SEN68 |
|---|---|---|---|---|
| Raw humidity | ✓ | ✓ | ✓ | ✓ |
| Raw temperature | ✓ | ✓ | ✓ | ✓ |
| Raw VOC ticks | ✗ | ✓ | ✓ | ✓ |
| Raw NOx ticks | ✗ | ✓ | ✓ | ✓ |
| Raw CO2 | ✗ | ✗ | ✓ | ✗ |
§Supported sensor variants
- SEN63C (crate feature
sen63c) - SEN65 (crate feature
sen65) - SEN66 (crate feature
sen66, default) - SEN68 (crate feature
sen68)
The sensor variants are mutually exclusive. Only one sensor variant feature can be enabled at a time. To activate a sensor variant other than the default SEN66, disable the default feature and enable the desired sensor variant feature.
§Currently unsupported sensor variants
- SEN60 (substantially different command set)
§Rust Features
async(default): Enables async support portion of the driverdefmt: Enables thedefmt::Formattrait for thedefmtlogging framework (addsdefmtcrate as dependency)serde: Enablesserdesupport for the driver (addsserdecrate as dependency, with default features disabled forno-stdcompatibility)std: Enablesstdfunctionality of the driver (unlocksthiserrorerror macros)sen60/sen63/sen65/sen66(default) /sen68: Enables support for the respective sensor variant. Only one of these features can be enabled at a time. The variant enabled by default issen66.
§Usage
By default, the driver is in blocking mode. To access the async mode variant, enable the async feature.
The documentation and examples of both modes can be found in the respective modules blocking and async.
§Unit tests
To run the extensive unit tests, use the following command:
cargo xtask test-featuresModules§
- asynchronous
- Async API
- blocking
- Blocking API
Structs§
- Algorithm
Tuning Parameters - VOC/NOx algorithm tuning parameters
- Device
Status - Measured
Sample - Represents a measured sample from the sensor module.
- RawConcentration
Sample - Represents a concentration sample from the sensor module. (these are the same values as in the MeasuredSample struct, just not scaled to the correct values)
- RawMeasured
Sample - Represents a raw measured sample from the sensor module.
- Temp
Accel Pars - (Volatile) internal temperature acceleration parameters
- Temp
Offset Pars - (Volatile) internal temperature offset parameters
Enums§
- Sen6x
Error - Represents any error that may happen during communication.