MH-Z19 CO2 Sensor~
This feature is included only in tasmota-sensors
and tasmota32
binaries
When compiling your build add the following to user_config_override.h
:
#ifndef USE_MHZ19
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
#endif
The MH-Z19 sensor is manufactured by Winsen Lt., China and the measurement method used is based on the non-dispersive infrared (NDIR) principle to detect the existence of CO2 in the air.
Key features according to the manufacturer are:
- good sensitivity
- non-oxygen dependent
- long life
- built-in temperature compensation
- UART serial interface and Pulse Width Modulation (PWM) output
Principle of operation:
The main components of an NDIR sensor are an infrared source (lamp), a sample chamber or light tube, a light filter and an infrared detector. The IR light is directed through the sample chamber towards the detector. In parallel there is another chamber with an enclosed reference gas, typically nitrogen. The gas in the sample chamber causes absorption of specific wavelengths according to the BeerñLambert law, and the attenuation of these wavelengths is measured by the detector to determine the gas concentration. The detector has an optical filter in front of it that eliminates all light except the wavelength that the selected gas molecules can absorb.
Wiring~
ESP | MH-Z19 |
---|---|
VCC +5V | Vin |
GND | GND |
TX | Rx |
RX | Tx |
In some situations if you only get 0 ppm
displayed it may be necessary to set "TX GPIO1" to "MHZ Rx" and "RX GPIO3" to "MHZ Tx" and correspondingly reverse the cabling for RX/TX. See here for more details.
Tasmota Settings~
In the Configuration -> Configure Module page assign:
- RX to
MHZ Tx
- TX to
MHZ Rx
After a reboot the driver will detect MH-Z19 automatically and display measurements.
Measure range can be selected with command:
sensor15 1000
for 1000 ppm rangesensor15 2000
for 2000 ppm rangesensor15 3000
for 3000 ppm rangesensor15 5000
for 5000 ppm range
Full commands list for the sensor
Model Comparison~
Product model | MH-Z19B | MH-Z19C | MH-Z19D |
---|---|---|---|
Power supply voltage | 4.5~ 5.5 V DC | DC (5.0 ± 0.1) V | DC (5.0 ± 0.1) V |
Average current | < 60mA(@5V) | <40mA (@5V power supply) | <40mA (@5V power supply) |
Peak current | 150 mA (@5V supply) | 125mA (@5V power supply) | 125 mA (@5V power supply) |
Measuring range | 0~5000ppm, 0~10000ppm | 4005000ppm(optional) 40010000ppm range could be customized | 400~10000ppm(optional) |
Warm-up time | 3min | 2.5min | 1min |
Response time | T90<120s | T90< 120s | T90 <120s |
Working temperature | 0 ~ 50 ℃ | -10℃ ~ 50℃ | -10℃ ~ 50℃ |
Working humidity | 0~ 90% RH (No condensation) | 0~ 90% RH (No condensation) | 0~ 90% RH (No condensation) |
Storage temperature | -20℃~60℃ | -20℃~60℃ | |
Source | link | link | link |
Available from AliExpress