
room-occupancy-co2
One CO₂ sensor. Detecting occupancy without a camera, microphone or anything else.
The problem
Room occupancy solutions that actually work (cameras, PIR sensors, people counters) cost hundreds of euros per room and generate sensitive data. How much can you do with a single €20 CO₂ sensor? That question has a physical limit: CO₂ measures gas concentration, not people. The challenge is knowing exactly where that limit is and extracting everything possible from it.
The data
Dataset from a real meeting room with CO₂, temperature and humidity sensor at 1-minute resolution. Occupancy labels (0/1) collected independently from the CO₂ signal. The dataset covers different usage patterns: short meetings, long sessions, occasional ventilation.
Approach
- Reframed as a latent state problem: occupancy is not directly observed, CO₂ is a noisy proxy with inertia — that is an HMM, not a direct classifier
- Viterbi algorithm on the HMM: finds the most likely sequence of states (occupied/free) given the sequence of CO₂ observations
- Explicit inertia modelling: CO₂ takes 5 to 15 minutes to reflect an occupancy change — the model knows this and does not react to every spike
- Hysteresis on transition thresholds to avoid oscillating states from sensor noise
- Comparison with direct threshold classification: the HMM wins on transitions, loses on reaction speed — both options are documented
Tools
Result
Reliable binary occupancy detection with a single low-cost sensor. The most valuable result is not the accuracy: it is the explicit analysis of the physical limit. Trying to predict how many people are in a room from a CO₂ sensor is a category error — the gas does not carry that information. The project proves it with data.
Next steps
The direct extension is adding a second sensor (temperature or VOC) to improve detection speed on transitions — CO₂ alone is slow. There is also room to explore whether the model generalises to other rooms without retraining, or whether it needs per-room calibration due to ventilation and volume differences.