Crates.io | pm1006 |
lib.rs | pm1006 |
version | 0.0.2 |
source | src |
created_at | 2023-12-30 11:41:51.249492 |
updated_at | 2023-12-30 11:43:02.093819 |
description | Platform-agnostic Rust driver for the pm1006 particulate matter sensor. |
homepage | https://github.com/vojty/pm1006-rs |
repository | https://github.com/vojty/pm1006-rs |
max_upload_size | |
id | 1084133 |
size | 8,755 |
A platform-agnostic Rust driver for the pm1006
particulate matter sensor. Based on embedded-io
traits.
This sensor is located in IKEA VINDRIKTNING
air quality sensor.
Example usage with ESP32:
use pm1006::Pm1006;
use esp_idf_svc::hal::gpio::Gpio0;
use esp_idf_svc::hal::gpio::Gpio1;
use esp_idf_svc::hal::uart::UartConfig;
use esp_idf_svc::hal::uart::UartDriver;
use esp_idf_svc::hal::units::Hertz;
use log::*;
let config = UartConfig::new().baudrate(Hertz(9_600));
let uart_driver = UartDriver::new(
uart1,
pins.gpio17,
pins.gpio16,
Option::<Gpio0>::None,
Option::<Gpio1>::None,
&config,
)
.unwrap();
let pm1006 = Pm1006::new(uart_driver);
let pm25 = pm1006.read_pm25().unwrap();
info!("PM2.5: {}ug/m3", pm25);
AQI Category | Index Values | PM2.5 (ug/m3, 24-hour average) |
---|---|---|
Good | 0 - 50 | 0.0 - 12.0 |
Moderate | 51 - 100 | 12.1 - 35.4 |
Unhealthy for Sensitive Groups | 101 – 150 | 35.5 – 55.4 |
Unhealthy | 151 – 200 | 55.5 – 150.4 |
Very Unhealthy | 201 – 300 | 150.5 – 250.4 |
Hazardous | 301 – 400 | 250.5 – 350.4 |
Hazardous | 401 – 500 | 350.5 – 500 |
Source https://aqicn.org/faq/2013-09-09/revised-pm25-aqi-breakpoints/