Library for Unit ENV using M5UnitUnified.
M5UnitUnified is a library for unified handling of various M5 units products.
For information on legacy libraries, see below.
Unit CO2 is a digital air CO2 concentration detection unit, built-in with Sensirion's SCD40 sensor and power step-down circuit, using I2C communication.
Unit CO2L is a digital air CO2 concentration detection unit with a low power consumption mode for single measurements.
Unit ENV-III is an environmental sensor that integrates SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data.
Unit ENV-IV is an environmental sensor unit embedded with SHT40 and BMP280 sensors for measuring temperature, humidity, and atmospheric pressure data.
The Unit ENV-Pro sensor is a highly integrated environmental detection unit, equipped with the BME688 sensor solution.
The Unit Mini TVOC/eCO2 is a digital multi-pixel gas sensor unit with an integrated SGP30, primarily designed to measure various VOCs (Volatile Organic Compounds) and H2 in the air.
Unit Mini BPS is a barometer unit that uses the Bosch BMP280 pressure sensor for measuring atmospheric pressure and altitude estimation.
Unit Mini BPS v1.1 is a digital barometric pressure sensor unit that uses the QMP6988 barometric pressure sensor and utilizes an I2C communication interface.
Hat ENV-III is a multifunctional environmental sensor compatible with the M5StickC series. It integrates SHT30 and QMP6988 to detect temperature, humidity, and atmospheric pressure data.
Hat Yun is a cloud-shaped multifunctional environmental information collection base. It is equipped with a temperature and humidity sensor SHT20, a pressure sensor BMP280, a photoresistor, and 14 RGB LEDs.
- Unit CO2 - Document & Datasheet
- Unit CO2L - Document & Datasheet
- Unit ENVIII - Document & Datasheet
- Unit ENVIV - Document & Datasheet
- Unit ENVPro - Document & Datasheet
- UnitTVOC/eCO2 & Datasheet
- Unit BPS - Document & Datasheet
- Unit BPS(QMP6988) - Document & Datasheet
- Hat ENVIII - Document & Datasheet
- Hat Yun - Document & Datasheet
ENVPro (BME688) additionally needs the Bosch libraries:
- Bosch-BME68x-Library — raw temperature / pressure / humidity / gas (all targets)
- Bosch-BSEC2-Library — air-quality (IAQ) output, optional; the Bosch prebuilt exists only for ESP32 / ESP32-S2 / ESP32-S3 (excluded on ESP32-C6 [NanoC6 / NessoN1], ESP32-H2 [NanoH2], ESP32-P4 [Tab5])
On Arduino / PlatformIO these are installed as library dependencies (BSEC2 is skipped automatically on the excluded targets). On ESP-IDF native they are fetched at build time: BME68x always, BSEC2 only when you opt in for the ENVPro example (see For ESP-IDF settings).
See also examples/UnitUnified
The UnitENVIII example supports both Unit and Hat variants. Select the variant by uncommenting the appropriate #define at the top of the example sketch.
#if !defined(USING_UNIT_ENV3) && !defined(USING_HAT_ENV3)
// For Unit ENVIII (U001-C)
// #define USING_UNIT_ENV3
// For Hat ENVIII (U053-D)
// #define USING_HAT_ENV3
#endifNOTE: The library and examples target ESP-IDF 5.x (>=5.0).
M5Unified/M5GFXdo not yet support ESP-IDF 6.x; stay on the latest 5.x release until upstream support lands.
On ESP-IDF native builds (idf.py), options are selected via Kconfig (menuconfig) instead of editing the source #define.
UnitENVIII variant (Unit / Hat) — the example offers the same choice as the Arduino build through main/Kconfig.projbuild -> examples/UnitUnified/common/Kconfig.variant; variant.cmake maps the chosen CONFIG_EXAMPLE_USING_* to the source-level USING_* macro:
cd examples/UnitUnified/UnitENVIII/PlotToSerial
idf.py set-target esp32 # or esp32s3 / esp32c6 / esp32h2 / esp32p4
idf.py menuconfig
# -> M5Unit-ENV ENVIII example -> Target unit / board -> UnitENV3 / HatENV3
idf.py build flash monitorUnitENVPro BSEC2 (BME688 IAQ) — ENVPro can additionally output Bosch BSEC2 air-quality (IAQ) values on top of the raw temperature/pressure/humidity/gas readings. BSEC2 is opt-in and is only offered on the targets Bosch ships the prebuilt library for: esp32 / esp32-s2 / esp32-s3 (on M5Stack hardware these are Core = esp32 and CoreS3 = esp32-s3):
cd examples/UnitUnified/UnitENVPro/PlotToSerial
idf.py set-target esp32 # esp32 / esp32s2 / esp32s3
idf.py menuconfig
# -> M5Unit-ENV BSEC2 (BME688 IAQ) -> [*] Enable BSEC2 (IAQ) for BME688
idf.py build flash monitor- The
M5Unit-ENV BSEC2 (BME688 IAQ)menu item appears only on esp32 / esp32-s2 / esp32-s3. On esp32-c6 / esp32-h2 / esp32-p4 (NanoC6 / NessoN1 / NanoH2 / Tab5) the Bosch prebuilt does not exist, so the item is hidden and ENVPro reports raw measurements only. - Enabling it downloads the Bosch BSEC2 package at build time; enabling it constitutes acceptance of the Bosch BSEC license. No Bosch binaries are stored in this repository.
- Default is off (raw measurements only).
If you want to generate documents on your local machine, execute the following command
bash docs/doxy.sh
It will output it under docs/html
If you want to output Git commit hashes to html, do it for the git cloned folder.
The legacy library provides standalone sensor drivers that do not depend on M5UnitUnified. When using M5UnitUnified, do not use it at the same time as the legacy library.
Contains M5Stack-UNIT ENV & Hat ENV & UNIT BPS & UNIT CO2 series related case programs.
Unit ENV is an environmental sensor that integrates DHT12 and BMP280 internally to detect temperature, humidity, and atmospheric pressure data.
Unit ENV II integrates SHT30 and BMP280. Unit ENV III integrates SHT30 and QMP6988.
Unit Mini BPS uses the Bosch BMP280 pressure sensor. Unit Mini BPS v1.1 uses QMP6988 to measure atmospheric pressure and altitude estimation.
Hat ENV II and Hat ENV III are Hat form factor versions of ENV II and ENV III for M5StickC series.
Unit CO2 is a digital air CO2 concentration detection unit, built-in with Sensirion's SCD40 sensor.
#include <M5UnitENV.h>