Crates.io | embedded-ccs811 |
lib.rs | embedded-ccs811 |
version | 0.2.0 |
source | src |
created_at | 2020-01-27 22:06:21.529578 |
updated_at | 2020-09-10 18:22:23.950353 |
description | Platform-agnostic Rust driver for the CCS811 ultra-low power digital gas sensor for monitoring indoor air quality. |
homepage | https://github.com/eldruin/embedded-ccs811-rs |
repository | https://github.com/eldruin/embedded-ccs811-rs |
max_upload_size | |
id | 202521 |
size | 104,982 |
This is a platform agnostic Rust driver for the CCS811 ultra-low power
digital VOC sensor for monitoring indoor air quality (IAQ) using
the embedded-hal
traits.
This driver allows you to:
set_mode()
.has_data_ready()
.data()
.raw_data()
.baseline()
.set_baseline()
.set_environment()
.set_interrupt_mode()
.set_eco2_thresholds()
.start_application()
.update_application()
.erase_application()
.verify_application()
.download_application()
.firmware_mode()
.has_valid_app()
.hardware_id()
.hardware_version()
.firmware_bootloader_version()
.firmware_application_version()
.software_reset()
.The CCS811 is an ultra-low power digital gas sensor solution which integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.
CCS811 is based on ams unique micro-hotplate technology which enables a highly reliable solution for gas sensors, very fast cycle times and a significant reduction in average power consumption.
The integrated MCU manages the sensor driver modes and measurements. The I²C digital interface significantly simplifies the hardware and software design, enabling a faster time to market.
CCS811 supports intelligent algorithms to process raw sensor measurements to output equivalent total VOC (eTVOC) and equivalent CO2 (eCO2) values, where the main cause of VOCs is from humans.
CCS811 supports multiple measurement modes that have been optimized for low-power consumption during an active sensor measurement and idle mode extending battery life in portable applications.
Documentation:
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
Please find additional examples using hardware in this repository: driver-examples
extern crate linux_embedded_hal as hal;
use embedded_ccs811::{prelude::*, Ccs811, MeasurementMode, SlaveAddr};
use nb::block;
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let nwake = hal::Pin::new(17);
let delay = hal::Delay {};
let address = SlaveAddr::default();
let sensor = Ccs811::new(dev, address, nwake, delay);
let mut sensor = sensor.start_application().ok().unwrap();
sensor.set_mode(MeasurementMode::ConstantPower1s).unwrap();
loop {
let data = block!(sensor.data()).unwrap();
println!("eCO2: {}, eTVOC: {}", data.eco2, data.etvoc);
}
}
For questions, issues, feature requests, and other changes, please file an issue in the github project.
Licensed under either of
at your option.
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.