This project is a comprehensive solution for ingesting, processing, and visualizing data from AirGradient sensors. It uses Cloudflare Workers for serverless deployment and provides a real-time dashboard for monitoring air quality metrics.
AirGradient provides high-quality, open-source air quality monitors for indoor and outdoor use. The AirGradient ONE (Model I-9PSL) is an indoor air quality monitor that measures:
- PM1, PM2.5, and PM10 (particulate matter)
- CO2 (carbon dioxide)
- TVOCs (Total Volatile Organic Compounds)
- NOx (nitrogen oxides)
- Temperature
- Humidity
Key features of AirGradient sensors include:
- High-quality sensor modules from industry leaders like SenseAir, Sensirion, and Plantower
- Multi-step testing and calibration process for high accuracy
- NDIR technology for CO2 measurements with automatic baseline calibration
- Laser scattering technology for particulate matter measurements
- Factory-calibrated sensors
- Built-in OLED display and programmable RGB LEDs
- WiFi connectivity for data transmission
- Open-source design allowing for customization and extensions
- Data ingestion from AirGradient sensors
- Real-time data processing and storage using Cloudflare Workers and Analytics Engine
- Interactive dashboard for visualizing air quality metrics
- Weather prediction based on sensor data
- Responsive design for both desktop and mobile devices
- Support for Home Assistant integration
- Backend: Cloudflare Workers (JavaScript)
- Frontend: React.js
- Data Visualization: D3.js
- Build Tool: Rollup.js
- API: Hono framework
- Data Validation: Zod
airgradient/
: Main project directorysrc/
: Source codeworker.mjs
: Main worker script (backend)client.jsx
: React components for the dashboardclient.html
: HTML template for the dashboarddb-init.sql
: SQL script for initializing the database
dist/
: Compiled and minified code (generated on build)wrangler.toml
: Configuration file for Cloudflare Workerspackage.json
: Node.js dependencies and scriptsrollup.config.js
: Rollup configuration for building the project
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Deploy to Cloudflare Workers:
npm run deploy
-
For local development:
npm run start
POST /sensors/:id/measures
: Ingest sensor dataGET /sensors/:id
: Retrieve sensor data for a specific time rangeGET /sensors/:id/chart
: Render the dashboard for a specific sensor
The dashboard provides real-time visualization of various air quality metrics:
- Temperature
- Felt Temperature
- Humidity
- Pressure
- CO2 levels
- PM2.5 levels
- TVOC Index
- Air Quality Index
It also includes a weather prediction feature based on the collected data.
AirGradient is committed to open-source principles:
- All code, schematics, and 3D files are published under CC-BY-SA 4.0 license
- Users own their data and have full flexibility in monitoring and using it
- Partnership with openAQ for open air quality data
- Active community engagement and support for educational and research projects
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-source and available under the MIT License.