Code Monkey home page Code Monkey logo

air-quality-iot's Introduction

๐Ÿ˜ท 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.

The Raspberry Pi Pico, along with the ENS160 + AHT20 sensor breakout board live neatly in a small 3D-printed enclosure: plugged in

How does this work?

You can easily move this source code 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)
  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.
  6. Wait for a predefined amount of time, specified in the settings.py file (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. 3d printed housing tray

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.