Close
0%
0%

Air Quality station

Air Quality monitoring (standalone & compatible with Home Assistant)

Similar projects worth following
This DIY air quality monitoring system integrates precision sensors with a connected processing platform and a low-power e-paper display. Can be integrated with Home Assistant and/or Thingspeak

Overview

This DIY air quality monitoring system integrates precision sensors with a connected processing platform and a low-power e paper display.

it monitors :

  • temperature
  • pressure
  • humidity
  • CO2 level
  • air quality (particules/dust)

System Architecture

  • Processing Unit (Core): The ESP32 S2 Lolin mini manages the sensors. It offers native Wi-Fi connectivity, ideal for sending data to dashboards (Home Assistant, InfluxDB, or MQTT). Its architecture enables efficient management of peripherals via SPI and I2C interfaces.
  • So for this project  you will have the choice between (non exclusive): 

    • a simple e-paper display without any connection to Wifi !
    • an IoT devoce connected to ThingSpeak
    • an IoT device conected to your HomeAssistant server

  • Display:
    • 3.7-inch E-Paper (240x416): Electronic ink technology allowing for static data display with zero power consumption between refreshes, ensuring a clear and readable interface.
  • Air Quality Sensors:
    • SCD40: Photoacoustic sensor for CO2 concentration, temperature, and relative humidity.
    • Plantower PMS5003: Laser scattering sensor for measuring fine particulate matter (PM1.0, PM2.5, PM10).
  • Complementary Environmental Sensors:
    • BME280: Precision measurement of barometric pressure, humidity, and temperature.
    • DS18B20: Digital temperature sensor using a 1-Wire interface, ideal for remote measurement or isolated thermal reference.


Schematics

it couldn't be simpler !

Implementation Considerations

  1. Power Management: The PMS5003 consumes significant current during startup (approx. 100mA). The 5V USB power source of the ESP32 can handle this peak load. The other sensors are directly powered at 3.3V witth the EPS32's power regulator. BME and DS18B20 are powered via an I/O pin of the ESP32
  2. Bus Sharing:
    • The BME280 and SCD40 typically use the I2C bus. (they don't have the same addresses so do not conflict)
    • The E-Paper uses an SPI interface, allowing it to function simultaneously with the I2C sensors without pin communication interference.
  3. Airflow: The PMS5003 requires constant airflow to function accurately. When designing the enclosure, the inlet and outlet are unobstructed and air circulates freely around the temperature and CO2 sensors.


PCB

The PCB can be bought at PCBWay 

As you can see corners are "rounded" in order to fit into the 3d printed enclosure. The PCB is delivered CNC milled with this exact shape. No screws are needed for the PCB to fit into the enclosure.

Soldering the PCB is easy. Sensors go on both sides:

Result is a clean and compact setup.

The PCB was kindly sponsored by PCBWay and is as usual of excellent quality.

You can order it here : PCBWay shared project. It's cheap, delivered very fast, and so professional looking!

and if you are new to PCBWay please use this affiliated link : https://pcbway.com/g/o35z4O


Enclosure

You can print the enclosure, the PCB will fit inside

All the sensors fit into the box, venting holes are preset to help air to circulate into the Plantower laser particules sensor and the CO2 sensor.

Here is the box once closed

Firmware

Source code for the ESP32-S2 is quite simple and is available on my github pages

main characteristics are : 

* ============================================================================
 * ESP32-S2 Environmental & Air Quality Monitoring Station
 * ============================================================================
 * 
 * Description:
 * A comprehensive environmental monitoring station utilizing an E-Paper display.
 * The firmware implements a non-blocking asynchronous state machine to manage 
 * sensor warm-up sequences, take stable multi-sample averages, and refresh the UI.
 * 
 * Integrated Hardware:
 * - SCD4x                     : CO2, Temperature & Humidity (I2C)
 * - BME280                    : Pressure, Temperature & Humidity (I2C)
 * - Plantower PMS5003         : PM1.0 & PM2.5 Particulate Matter (HardwareSerial)
 * - DS18B20                   : High-precision Temperature (OneWire)
...
Read more »

  • Home Assistant integration

    JP Gleyzes06/29/2026 at 17:33 0 comments

    MQTT

    So you have now your firmware ready to send data to a MQTT broker.

    But what is it ?

    MQTT stands for "Message Queuing for Telemetry Transport". 

    "MQTT is a Client Server publish/subscribe messaging transport protocol. It is lightweight, open,
    simple, and designed so as to be easy to implement.
    These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts."

    More precisely, MQTT embodies all the aspects of pub/sub:

    • MQTT decouples the publisher and subscriber spatially. To publish or receive messages, publishers and subscribers only need to know the hostname/IP and port of the broker
    • MQTT decouples by time. If desired, the broker can store messages for clients that are not online. 
    • MQTT works asynchronously. Because most client libraries work asynchronously and are based
    on callbacks or a similar model, tasks are not blocked while waiting for a message or publishing
    a message. 
    • MQTT is especially easy to use on the client-side. Most pub/sub systems have the logic on the brokerside.

    Although communication can be bidirectionnal, for our simple sensors, we will only use the client to broker publication (left side of the above picture)

    So we need now to host a MQTT broker into Home Assistant for the sensor to publish values

    And Home Assistant will have (internally) to subscribe to these messages to use these data (right side of the picture)


    Adding a MQTT broker in HA

    Follow this tutorial into Home Assistant

    • Add the Mosquitto broker : Settings >Apps > Install App and select Mosquitto broker and run it

    • Go to Settings > Devices & services.
    • In the bottom right corner, select the 

       Add Integration button.

    • From the list, select MQTT.
    • Follow the instructions on screen to complete the setup.

    For MQTT broker to be allowed to speak to Home Assistant it must be declared as a "user"

    So add a new user (MQTT_Broker) and enter its credentials (same as the ones you have choosen when compiling the firmware)

    Your broker is now ready to listen to messages. click on it and try to listen to "all messages" by typing "#" and start Listening

    if your AirQuality station is running then you should see the sensors coming every 5 minutes !

    But they are not yet integrated into your dashboards

    sensors integration

    The most easy way to select your new sensors is to go to Settings >Devices and services then select "devices",  and you should see your new AirQuality sensors. 

    You can then add the to any area you want (I have choosen "Mezzanine" which is at the first floor !)

    When added to an area then click on it, into the main screen, and you will see sensors attached to this area

     Going further

    You have now access at the full power of Home Assistant!

    You can create a new dashboard

    then add any view you want

    And finally get the "perfect dashboard" ! (don't look too closely at the pressure chart... I changed the "sea level" value around 3pm !)

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates