https://github.com/timhanewich/air-quality-iot
Indoor air quality sensor box IoT project with 3D-printed housing!
https://github.com/timhanewich/air-quality-iot
3d-printing air air-quality air-quality-data air-quality-monitor aqi co2 co2-sensor quality-sensor raspberry-pi raspberry-pi-pico rp2040 rpi
Last synced: 11 months ago
JSON representation
Indoor air quality sensor box IoT project with 3D-printed housing!
- Host: GitHub
- URL: https://github.com/timhanewich/air-quality-iot
- Owner: TimHanewich
- Created: 2023-08-16T21:08:56.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T18:55:49.000Z (about 2 years ago)
- Last Synced: 2025-05-14T00:08:54.593Z (about 1 year ago)
- Topics: 3d-printing, air, air-quality, air-quality-data, air-quality-monitor, aqi, co2, co2-sensor, quality-sensor, raspberry-pi, raspberry-pi-pico, rp2040, rpi
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 😷 Home Indoor Air Quality Sensor IoT Project 🫁
Welcome to my open-source Air Quality Sensor IoT Project! This project monitors your home's indoor air quality in real-time using IoT technology and feeds you data in JSON over a web server.
This project includes:
- A data sampling and upload script, written in MicroPython, running on a **Raspberry Pi Pico W**.
- An **ENS160 Digital Metal Oxide Multi-Gas Sensor**, used for monitoring **Carbon Dioxide (CO2)**, **Total Volatile Organic Compounds (TOVC)**, and the **Air Quality Index (AQI)** of your home via the I2C protocol.
- An **AHT21 Integrated Temperature and Humidity Sensor**, used for monitoring ambient **temperature** and **humidity** of your home via the I2C protocol.
- A 3D-printed housing box for the Raspberry Pi Pico W and sensors (optional).
I am using a single breakout board that contains both an ENS160 and AHT21 on one board, found [here](https://www.amazon.com/gp/product/B0BXGZCSWG/ref=ppx_yo_dt_b_asin_title_o03_s00).
The Raspberry Pi Pico, along with the ENS160 + AHT20 sensor breakout board live neatly in a small 3D-printed enclosure:

## How does this work?
You can easily move [this source code](./src/) to a Raspberry Pi Pico W, hook that Pico W up to an ENS160 & AHT21 sensor, and deploy. The source code will:
1. Validate and set up the ENS160 and AHT21 sensors.
2. Connect to your wifi network (using credentials you specify in the [settings.py file](./src/settings.py))
3. Take air quality and condition measurements from the ENS160 and AHT21 sensors.
4. If the air quality measurements were unsuccessful, restart these sensors and troubleshoot until they are operational.
5. Upload these readings via HTTP POST request to an endpoint you define in the [settings.py file](./src/settings.py).
6. Wait for a predefined amount of time, specified in the [settings.py file](./src/settings.py) (default is one minute).
7. Repeat steps 3-6 in an infinite loop, sampling and uploading data at a regular interval!
There is a watchdog timer implemented to ensure long-term functionality is preserved.
## 3D Printed Housing
I modeled a simple housing tray for the microcontroller and sensors required for this project. You can download the 3D Model (STL file) [here directly from this GitHub repo](https://github.com/TimHanewich/air-quality-box/releases/download/2/aqb_v1.stl).


## May 2024 Update
In May 2024, I changed the core functionality of how the Raspberry Pi Pico W performs: instead of being a server, responding to HTTP requests, it now instead samples data at a regular interval and uploads this via POST request to a defined endpoint.
All of the code and literature behind this old version can still be found by reverting to commit `3d04d5e89972443a98873347cb8421cb2e6d45a3`.