#air-quality #embedded #particulate-matter

pm1006

Platform-agnostic Rust driver for the pm1006 particulate matter sensor

2 releases

0.0.2 Dec 30, 2023
0.0.1 Dec 30, 2023

#1030 in Hardware support

MIT license

9KB
145 lines

pm1006 Rust driver

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.

Usage

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);

Additional info

Air Quality Index (AQI) breakpoints for PM2.5

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/

Dependencies

~120KB