MH Z19B - FengtianGu/Sonoff-Tasmota GitHub Wiki

MH-Z19B CO2 Sensor (Serial)

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.

See also the datasheet.

Buy example: AliExpress.com: MH-Z19B-Infrared-CO2-Sensor-for-CO2-Monitor-NDIR-Gas-Sensor-CO2-gas-sensor

Operating current < 18mA average

Connecting the MH-Z19B to a Wemos D1 mini

Wemos D1 Mini MH-Z19B
VCC +5V Vin
GND GND
TX Rx
RX Tx

Tasmota Configuration

In the Configuration -> Configure Module page, select the following for Wemos D1 mini:

  1. Module Type: 18 Generic
  2. TX GPIO1 Serial Out: 60 MHZ Tx
  3. RX GPIO3 Serial In: 61 MHZ Rx

For Sonoff Basic:

  1. Module Type: 01 Sonoff Basic
  2. GPIO01 60 MHZ Tx
  3. GPIO03 61 MHZ Rx

Tasmota Main

After reboot of the device the MHZ-19B measurements are shown.

Measure range can be selected with command:

  • sensor15 1000 for 1000 ppm range
  • sensor15 2000 for 2000 ppm range
  • sensor15 3000 for 3000 ppm range
  • sensor15 5000 for 5000 ppm range

Full commands list for the sensor

⚠️ **GitHub.com Fallback** ⚠️