Why Monitor Indoor Air Quality?
I spend most of my time indoors — whether working, relaxing, or sleeping — and like most people, I assumed the air inside my home was "good enough." But indoor air quality is often more polluted than outdoor air due to hidden factors like off-gassing furniture, cleaning agents, cooking fumes, and insufficient ventilation.
Poor indoor air quality isn’t always visible or noticeable, but its effects are real and sometimes severe. It can lead to:
- Respiratory problems, especially in children, the elderly, or those with asthma
- Sleep disturbances, as our bodies struggle with stale or dry air overnight
- Headaches and fatigue, often triggered by elevated CO₂, VOCs, or lack of fresh oxygen
- Mold growth, driven by prolonged high humidity — often unnoticed until damage is done
- Long-term health issues, including increased sensitivity to allergens or chemicals
One major factor in our household is our wood stove. While it provides cozy warmth during colder months, it also introduces fine particulates (PM2.5) and volatile organic compounds (VOCs) into the air — especially during lighting, or refueling. This made it even more important for me to understand how our heating choices impact indoor air quality.
What shocked me was how often these conditions go undetected. Even well-maintained homes can suffer from poor air quality, especially in closed-off rooms or during winter.
With growing concerns around pollution, climate resilience, and sustainable living, I wanted to go beyond guesswork. I built a system that provides a real-time overview of air quality in every major room of my home — not just as a personal tech experiment, but as a tool for awareness, health, and action.
Now, instead of reacting to problems after the fact, I can anticipate them: ventilate in time, avoid certain activities, or adjust humidity levels — all guided by live data.
The Tools I Used
To build my system, I relied on:
- IKEA Dirigera Hub and a series of Vindstyrka sensors to measure:
- Temperature
- Relative Humidity
- PM2.5 (fine particulate matter)
- VOC Index (gaseous pollutants)
- A custom Python script (
air.py) to: - Fetch live sensor data via the Dirigera API
- Append time-stamped readings to a
air.jsonfile - Upload this data via SFTP to a Raspberry Pi web server
- A dynamic HTML dashboard (
air.html) to visualize: - Current conditions per room
- Color-coded tables with tooltips for context
- Interactive graphs of temperature, humidity, PM2.5, and VOC trends over time
How It Works
Every hour on the hour, a Python script runs (scheduled using the schedule module). It:
- Connects to the Dirigera Hub
- Reads all air quality sensors
- Appends readings with a timestamp to
air.json - Uploads this growing file to the web server
The data format allows for long-term historical tracking. Over time, this builds a rich dataset for trend analysis.
What You See
The air.html file is a fully client-side visual dashboard. It:
- Loads
air.json - Finds the latest reading set
- Shows a color-coded table:
- Green for optimal temperatures (15–20 °C)
- Yellow for mild deviations
- Red for extreme values
- Displays the last update time
- Renders four line graphs:
- Temperature
- Humidity
- PM2.5 (fine dust)
- VOC Index (pollutants)
- Uses consistent room colors across all charts
- Offers contextual info below the charts about what each value means for your health and home
What I Learned
This project wasn’t just about building a dashboard — it became a deep dive into smart home integration, data architecture, and user-friendly design. Along the way, I picked up several unexpected lessons:
-
Reverse-engineering IKEA’s API was easier than expected. I discovered that their Dirigera hub exposes sensor data quite neatly — once you know where to look.
-
I was genuinely surprised to find out that the Dirigera API token remains valid for more than 10 years! In a world where most APIs require re-authentication every few hours or days, this is almost unheard of. It makes automation much easier, though I still built a token parser and expiration checker — just to be sure.
-
Low-cost sensors like the IKEA Vindriktning or Vindstyrka are impressive, but not perfect. Some omit certain metrics, others report sporadically, and a few default to “(unknown)” as their room — which required filtering logic and graceful fallbacks.
-
Designing a clean and timestamped data structure from the start proved critical. It allowed me to store historical readings, render interactive graphs, and display accurate “last updated” timestamps in the UI — without needing a full database backend.
-
I underestimated the importance of micro UX decisions. Seemingly small things — like highlighting temperatures with intuitive colors, sorting the latest readings to the top, or excluding unknown rooms — made a massive difference in clarity and usability.
-
And finally: the joy of seeing data come alive. It’s one thing to collect numbers; it’s another to visualize trends, spot spikes in PM2.5 when cooking or using the stove, and build a healthy habit of awareness.
This wasn’t just a tech project. It changed how I understand and interact with the air I breathe every day.
Future Plans
This project is already giving me a lot of insights — but there’s plenty of room to expand. Here’s what I’m considering next:
-
Adding CO₂ sensors, such as the SCD40 or MH-Z19B. While PM2.5 and VOCs are critical indicators, CO₂ is one of the clearest markers of stale, poorly ventilated air. It’s also a good proxy for occupancy and sleep quality.
-
Trigger-based alerts: I plan to implement real-time notifications (e.g. email alerts) for events like excessive PM2.5 during cooking, high VOCs from cleaning agents, or rising humidity levels that could lead to mold.
-
Automated response: I want to connect IKEA’s air purifiers (like STARKVIND) and automatically switch them on or change their fan speed based on live sensor readings. Eventually, the system should handle this without my intervention — silently optimizing air quality room by room.
-
Historical analysis: All data is already stored with timestamps, but I’d like to export it regularly to my SQL server. This would let me analyze long-term patterns, seasonal shifts, and the impact of specific actions like using the wood stove or opening windows.
-
Integration with Home Assistant or Matter: I’m exploring tighter smart home integration to build routines — for example, open a window when CO₂ exceeds a threshold, or increase air circulation when VOCs spike.
Ultimately, the goal is to evolve from passive monitoring to active air quality management — quietly, automatically, and with full transparency.
Why This Matters
This isn’t just a tech project — it’s a step toward sustainable, healthy living.
With accessible tools, a bit of code, and a clear goal, anyone can build their own air quality system. Mine cost under €300 total and runs on a Raspberry Pi.
The real value? Peace of mind. Knowing my kid sleeps in healthy air. Catching rising humidity before mold forms. Understanding how candles or cleaning products affect indoor pollution.
See It Live
Want to see the system in action? Visit:
https://f97.be/air.html