ENVPRO Unit
ENV Pro Unit is an environmental sensor that utilizes the BME688 sensor solution, supporting the measurement of various environmental parameters such as volatile organic compounds (VOCs), indoor air quality (IAQ), temperature, humidity, and atmospheric pressure. It features a compact size, wide operating range, simple communication interface (I2C), excellent performance, and low power consumption, making it suitable for weather stations, indoor environmental monitoring, and air quality detection applications.
Support the following products:
Micropython Example:
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from hardware import * 9from unit import ENVPROUnit 10import time 11 12 13title0 = None 14label0 = None 15label1 = None 16label2 = None 17i2c0 = None 18envpro_0 = None 19co2_0 = None 20 21 22def setup(): 23 global title0, label0, label1, label2, i2c0, envpro_0, co2_0 24 25 M5.begin() 26 Widgets.fillScreen(0x222222) 27 title0 = Widgets.Title( 28 "ENVProUnit CoreS3 Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18 29 ) 30 label0 = Widgets.Label("label0", 0, 58, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 31 label1 = Widgets.Label("label1", 0, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 32 label2 = Widgets.Label("label2", 0, 160, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 33 34 i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) 35 envpro_0 = ENVPROUnit(i2c0) 36 37 38def loop(): 39 global title0, label0, label1, label2, i2c0, envpro_0, co2_0 40 M5.update() 41 label0.setText(str((str("Pressure:") + str((envpro_0.get_pressure()))))) 42 label1.setText(str((str("Humidity:") + str((envpro_0.get_humidity()))))) 43 label2.setText(str((str("Temperature:") + str((envpro_0.get_temperature()))))) 44 time.sleep(1) 45 46 47if __name__ == "__main__": 48 try: 49 setup() 50 while True: 51 loop() 52 except (Exception, KeyboardInterrupt) as e: 53 try: 54 from utility import print_error_msg 55 56 print_error_msg(e) 57 except ImportError: 58 print("please update to latest firmware")
UIFLOW2 Example:
class ENVPROUnit
Constructors
Methods
- ENVPROUnit.get_over_sampling_rate(env)
Retrieve the oversampling rate for the specified environment parameter.
- Parameters:
env – The environment parameter (TEMPERATURE, PRESSURE, HUMIDITY).
UIFLOW2:
- ENVPROUnit.set_over_sampling_rate(env, rate)
Set the oversampling rate for the specified environment parameter.
- Parameters:
env – The environment parameter (TEMPERATURE, PRESSURE, HUMIDITY).
rate – The oversampling rate to be set.
UIFLOW2:
- ENVPROUnit.get_iir_filter_coefficient()
Retrieve the IIR filter coefficient.
UIFLOW2:
- ENVPROUnit.set_iir_filter_coefficient(value)
Set the IIR filter coefficient.
- Parameters:
value – The IIR filter coefficient to be set.
UIFLOW2:
- ENVPROUnit.get_temperature()
Retrieve the measured temperature.
UIFLOW2:
- ENVPROUnit.get_humidity()
Retrieve the measured humidity.
UIFLOW2:
- ENVPROUnit.get_pressure()
Retrieve the measured pressure.
UIFLOW2:
- ENVPROUnit.get_gas_resistance()
Retrieve the measured gas resistance.
UIFLOW2:
- ENVPROUnit.get_altitude()
Retrieve the calculated altitude based on pressure readings.
Note
: Altitude is calculated based on the difference between barometric pressure and sea level pressureUIFLOW2: