PM2.5 & CO2 Sensors
Relevant source files
The following files were used as context for generating this wiki page:
The PM2.5 and CO2 sensors are primary components of the Awair Element hardware, integrated into the OpenAwair framework to provide high-fidelity air quality monitoring. These sensors—the Honeywell HPMA115S0 for particulate matter and the Telaire T6703 for carbon dioxide—are interfaced via dedicated TypeScript drivers on the host side and managed through a unified scheduling system.
These sensors distinguish the Awair Element from the Awair Glow C, as the Glow C primarily relies on estimated eCO2 from the SGP30 sensor rather than NDIR-based CO2 measurement. In the OpenAwair architecture, these drivers implement the standard SensorDriver interface, ensuring that their data can be consolidated into the global DeviceMetrics for MQTT or REST distribution.
Sources: CLAUDE.md:14-23, host/src/shared/telemetry.ts:1-20
Sensor Architecture and Integration
The sensors follow a modular architecture where each physical component is represented by a specific driver class. These drivers are orchestrated by the SensorScheduler, which handles the timing and collection of asynchronous data.
Driver Specifications
| Sensor Model | Metric | Interface Type | Sampling Interval | Features |
|---|---|---|---|---|
| HPMA115S0 | PM2.5 | UART | 30,000ms | Laser-based NDIR; requires fan spin-up |
| T6703 | CO2 | UART/I2C | 30,000ms | NDIR technology; 2s internal output rate |
Sources: CLAUDE.md:19-21, CLAUDE.md:65-66, host/src/firmware/sensors/hpma115s0.ts:5-6, host/src/firmware/sensors/t6703.ts:5-6
Implementation Logic
The following diagram illustrates how the PM2.5 and CO2 sensors fit into the overall data collection flow.
The diagram shows the SensorScheduler polling individual drivers to produce a unified metrics object.
Sources: host/src/firmware/sensors/scheduler.ts:1-16, host/src/firmware/sensors/sensor.ts
Honeywell HPMA115S0 (PM2.5)
The HPMA115S0 driver is responsible for measuring particulate matter (PM2.5) concentrations in µg/m³. In the physical hardware, this sensor utilizes a fan to draw air across a laser sensing chamber.
- Initialization: Requires a warm-up period for the fan to stabilize before accurate readings can be taken.
- Measurement: Outputs data in micrograms per cubic meter (
pm25UgM3). - Driver Class:
Hpma115s0Sensorimplements theread()method, which returns aSensorReadingcontaining the PM2.5 value.
export class Hpma115s0Sensor implements SensorDriver {
public readonly name = 'HPMA115S0';
public readonly sampleIntervalMs = 30000;
public async read(): Promise<SensorReading> {
return {
timestamp: new Date(),
pm25UgM3: 8.4 // Representative value
};
}
}
Sources: host/src/firmware/sensors/hpma115s0.ts:4-13, CLAUDE.md:20, CLAUDE.md:67
Telaire T6703 (CO2)
The T6703 sensor provides dedicated Carbon Dioxide (CO2) monitoring using Non-Dispersive Infrared (NDIR) technology. Unlike the estimated CO2 provided by VOC sensors, this provides a direct ppm (parts per million) measurement.
- Communication: The sensor supports both UART and I2C interfaces on the STM32F412 MCU.
- Update Frequency: Although the host driver samples every 30 seconds, the hardware sensor internally updates every 2 seconds.
- Driver Class:
T6703Sensorintegrates with theSensorReadinginterface to provide theco2Ppmproperty.
Sources: host/src/firmware/sensors/t6703.ts:4-13, CLAUDE.md:21, CLAUDE.md:66
Data Modeling
Sensor data from both devices is typed in the shared telemetry module to ensure consistency across MQTT payloads and REST responses.
| Field | Type | Unit | Sensor |
|---|---|---|---|
pm25UgM3 | ParticulateMatter (number) | µg/m³ | HPMA115S0 |
co2Ppm | CarbonDioxide (number) | ppm | T6703 |
timestamp | Date | N/A | Both |
Sources: host/src/shared/telemetry.ts:4-14
Sequence of Measurement
The following sequence diagram represents the interaction between the system and the sensors during a sampling cycle.
The diagram depicts the asynchronous polling of PM2.5 and CO2 data during a standard 30-second interval.
Sources: host/src/firmware/sensors/scheduler.ts:12-15, host/src/firmware/sensors/hpma115s0.ts:7-12, host/src/firmware/sensors/t6703.ts:7-12
Summary
The PM2.5 and CO2 sensors are critical for the Awair Element's functionality within the OpenAwair project. By utilizing dedicated drivers for the HPMA115S0 and T6703, the system achieves precise air quality metrics. These drivers are standardized through the SensorDriver interface, allowing the SensorScheduler to manage their different hardware requirements—such as the HPMA115S0's fan spin-up—while providing a unified data stream for integration with platforms like Home Assistant.
Sources: CLAUDE.md:20-21, host/src/firmware/sensors/scheduler.ts:1-16