About CM AQI
Real-time air quality monitoring for Chiang Mai, Thailand
The Chiang Mai Burn Season
Every year from approximately February through April, northern Thailand experiences what locals call the "burning season." Agricultural burning, forest fires, and cross-border haze combine to create some of the worst air quality in the world.
During peak burn season, Chiang Mai's PM2.5 levels regularly exceed 200-300+ µg/m³ — far above the WHO guideline of 15 µg/m³ for 24-hour exposure. At these levels, the air quality is classified as "Very Unhealthy" or "Hazardous" and poses serious health risks.
This project was built to help residents and visitors stay informed about current air quality conditions and receive timely notifications when conditions change significantly.
Understanding the AQI Scale
The US EPA Air Quality Index (AQI) converts raw pollutant concentrations into a standardized 0-500 scale:
How It Works
- Data Collection — Every 10 minutes, we poll the OpenAQ API for PM2.5 and PM10 readings from monitoring stations in Chiang Mai.
- AQI Calculation — Raw concentrations are converted to US EPA AQI values using the official breakpoint formula.
- Real-time Dashboard — This website updates automatically via WebSocket (Phoenix LiveView) — no page refresh needed.
- LINE Notifications — Subscribe with your LINE account to receive push notifications when the AQI crosses your chosen threshold.
Fire Detection Data
During burn season, knowing where active fires are burning is just as important as knowing the AQI. Our map overlay shows real-time fire detections across northern Thailand so you can see what's contributing to the haze.
Data Source
Fire locations come from NASA FIRMS (Fire Information for Resource Management System). Specifically, we use the VIIRS (Visible Infrared Imaging Radiometer Suite) instrument aboard the Suomi NPP satellite, which detects thermal hotspots from orbit.
How We Collect It
Every 30 minutes, we poll the FIRMS API for near-real-time fire detections within a bounding box covering northern Thailand. The API returns CSV data including each fire's latitude, longitude, thermal brightness (in Kelvin), and detection confidence. We keep the most recent 2 days of detections.
How We Store It
Unlike AQI sensor readings, fire data is ephemeral — it's held in memory only and is not persisted to the database. Fires are transient by nature; detections from days ago aren't actionable. When the application restarts, fresh data is fetched from NASA within the first polling cycle.
How It Reaches Your Map
To keep things efficient, fire data is loaded lazily. When you open the map or pan to a new area, your browser tells the server what area is visible. The server filters the fire detections to only those within your viewport and pushes them over the WebSocket — so you only download what you can actually see. When new detections arrive from NASA, they're broadcast to all connected users in real time via PubSub.
Built With
Licensed under MIT. Contributions welcome!