Particulate Matter Sensor PMS5003T with ESP32 and ESPHome

3. April 2026

Measure and visualize air quality in Home Assistant

Air Quality Sensor ESP32 Header

Monitoring air quality in our living spaces is becoming increasingly important, especially in times when environmental awareness and health play a central role. In this blog post, we will take a look at integrating a PMS5003T fine dust sensor with an ESP32 microcontroller. We will use the ESPHome framework for programming and the Home Assistant platform for displaying and monitoring the data. Additionally, a custom-designed enclosure will be used, which was designed with FreeCAD and manufactured using a 3D printer.

Step 1: Hardware Assembly

Before we dive into the technical details, let's take a look at what hardware we need:

  • PMS5003T Particulate Matter Sensor
  • ESP32 microcontroller
  • Display for indication, such as OLED or TFT
  • (Optional) Housing

Step 2: Set up ESPHome Framework

ESPHome significantly simplifies the development of IoT applications by offering a simple YAML-based configuration language. In the ESPHome configuration file, we define the sensors and actuators, define the communication protocols, and integrate them into Home Assistant. For example, the configuration of a fine dust sensor could look like this:

# PM Sensor port
# -----------------
# |       -----   |
# |    8  | o |   |
# |    7  | o |   |
# |    6  | o |   |
# |    5  | o |   |   5 - TX
# |    4  | o |   |   4 - RX
# |    3  | o |   |
# |    2  | o |   |   2 - GND
# |    1  | o |   |   1 - VCC
# |       -----   |
# |               |
# |               |
# |               |
# |               |
# |               |
# |               |
# |               |
# |               |
# |               |
# |               |
# -----------------
 
esphome:
  name: esp32-pm-sensor-01
  friendly_name: esp32-PM-Sensor-01
 
esp32:
  board: esp32dev
  framework:
    type: arduino
 
# Enable logging
logger:
 
# Enable Home Assistant API
api:
  encryption:
    key: "xxx"
 
ota:
  password: "xxx"
 
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Pm-Sensor-02"
    password: "ztsQxEKlkaUj"
 
captive_portal:
 
i2c:
  sda: 19
  scl: 18
 
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x32"
    update_interval: 10s
    lambda: |-
        it.printf(0, 0, id(font_robo),  "PM1.0   : %.0f", id(pms_pm_1).state),
        it.printf(0, 11, id(font_robo), "PM2.5   : %.0f", id(pms_pm_25).state),
        it.printf(0, 22, id(font_robo), "PM10.0 : %.0f", id(pms_pm_10).state),
        it.line(64, 10, 128, 10),
        it.line(64, 0, 64, 32),
        it.printf(67, 11, id(font_robo), "T : %3.1f°C", id(pms_temperature).state),
        it.printf(67, 22, id(font_robo), "H : %3.1f%%", id(pms_humidity).state),
        it.printf(67, 0, id(font_robo_sm), "WiFi : %2.f dBm", id(wifi_signal_sensor).state);
 
font:
  - file: "gfonts://Roboto"
    id: font_robo_sm
    size: 9
  - file: "gfonts://Roboto"
    id: font_robo
    size: 10
 
uart:
  rx_pin: GPIO17
  tx_pin: GPIO16
  baud_rate: 9600
 
sensor:
  # -----------------------------------------------
  # sensor wifi_signal
  # -----------------------------------------------
  - platform: wifi_signal
    name: WiFi Signal
    id: wifi_signal_sensor
    update_interval: 60s
 
  - platform: pmsx003
    type: PMS5003T
    id: pm_sensor
    pm_1_0:
      id: pms_pm_1
      name: "Particulate Matter <1.0µm Concentration"
      accuracy_decimals: 1
    pm_2_5:
      id: pms_pm_25
      name: "Particulate Matter <2.5µm Concentration"
      accuracy_decimals: 1
    pm_10_0:
      id: pms_pm_10
      name: "Particulate Matter <10.0µm Concentration"
      accuracy_decimals: 1
    temperature:
      id: pms_temperature
      name: "Environment temperature in °C"
    humidity:
      id: pms_humidity
      name: "Environment humidity in %"
    update_interval: 120s

Step 3: Home Assistant Integration

The ESP32 is configured in Home Assistant by adding a new entity. This allows the particulate matter sensor data to be displayed and monitored in the Home Assistant interface.

Step 4: Enclosure design with FreeCAD

For the safe storage and protection of components from external influences, we are developing an enclosure using FreeCAD.

PM_Sensor_Case_alpha
PM Sensor Housing

Freecad Project File

Download (7.2 MB) FCSTD
Filename: pmSensor_Case_bigLCD.FCStd

Conclusion

The combination of the PMS5003T fine dust sensor with the ESP32 and the ESPHome framework enables effective air quality monitoring. Integration into Home Assistant allows for convenient data monitoring and the automation of actions based on the measured values. Thanks to the custom-designed enclosure, not only functionality but also design is optimized, providing a comprehensive solution for air quality monitoring.

Share:


Post your comment

Required for comment verification