koenvervloesem / M5Stack-Air-Quality-ESPHome

ESPHome configuration for M5Stack's PM2.5 Air Quality Kit with the PMSA003 particulate matter sensor and the SHT20 temperature and humidity sensor
https://koenvervloesem.github.io/M5Stack-Air-Quality-ESPHome/
MIT License
49 stars 9 forks source link
air-quality esp32 esp32-arduino esphome esphome-config home-assistant home-automation homeassistant ili9341 m5stack mqtt particulate-matter pm-sensor pm1 pm10 pm25 pmsa003 pmsx003 sensors sht20

ESPHome configuration for the M5Stack PM2.5 Air Quality Kit

Build status GitHub license

This ESPHome configuration builds firmware for M5Stack's PM2.5 Air Quality Kit (PMSA003 + SHT20). It shows:

ESPHome configuration for the M5Stack air quality kit

Note that ESPHome doesn't support the SHT20 sensor natively. This repository adds a custom component that's using the Arduino library uFire_SHT20 which supports the sensor.

Installation

On a web browser supporting Web Serial (which is a recent Chrome, Edge or Opera) you can install the latest version of the firmware on your M5Stack air quality kit from our installation page via USB, as well as setting up Wi-Fi and adding the device to Home Assistant.

You can also manually compile and upload the firmware to your M5Stack air quality kit with:

esphome run m5stack-air-quality-kit.yaml

Usage

The middle button is used to toggle the display's backlight on and off.

Remarks about the temperature and humidity readings

The SHT20 sensor shows a much too high temperature and much too low humidity. This doesn't seem to be a software problem: I tried a couple of other libraries for the SHT20 with the M5Stack air quality kit and they all have the same result.

According to Sensirion's data sheet of the SHT20, you shouldn't do more than two measurements per second at 12-bit accuracy, to prevent self-heating of the sensor. In my custom sensor component, I configured polling every second to stay on the safe side.

But even this doesn't solve the problem. I suspect M5Stack's hardware design is faulty and the sensor really reads the heat produced by the other components in the M5Stack Core case.

TODO

Learn more about ESPHome

If you want to learn more about ESPHome, read my book Getting Started with ESPHome: Develop your own custom home automation devices and the accompanying GitHub repository koenvervloesem/Getting-Started-with-ESPHome.

License

This project is provided by Koen Vervloesem as open source software with the MIT license. See the LICENSE file for more information.

The Roboto font is licensed under the Apache License, Version 2.0.

The uFire_SHT20 library is licensed under the MIT license.

The C++/runtime codebase of the ESPHome project (file extensions .c, .cpp, .h, .hpp, .tcc, .ino) are published under the GPLv3 license. The Python codebase and all other parts of the ESPHome codebase are published under the MIT license. See the ESPHome License for more information.