
MH-Z19C NDIR CO₂ sensor — 0–5000ppm, UART/PWM, self-calibrating
The MH-Z19C is a professional-grade Non-Dispersive Infrared (NDIR) CO₂ sensor module from Winsen Electronics. It uses a dual-beam infrared optical measurement principle to deliver accurate, stable, and long-life CO₂ concentration readings without the drift issues common in electrochemical sensors. With both UART and PWM output interfaces, it integrates easily with Arduino, ESP32, Raspberry Pi, and industrial controllers for indoor air quality monitoring, HVAC control, and greenhouse automation.
Key Specifications:
- Sensing principle: Non-Dispersive Infrared (NDIR)
- Target gas: CO₂ (carbon dioxide)
- Measurement range: 0 – 5000 ppm
- Accuracy: ±50 ppm ± 5% of reading
- Resolution: 1 ppm
- Response time: T90 < 120 seconds
- Output interfaces: UART (9600 baud, 3.3V TTL) and PWM
- Supply voltage: 4.5V – 5.5V DC
- Average current: <18mA (peak 150mA during measurement)
- Operating temperature: 0°C – 50°C
- Operating humidity: 0– 95% RH (non-condensing)
- Warm-up time: ~3 minutes
- Lifespan: >5 years
- Self-calibration (ABC logic): built-in, enabled by default
- Dimensions: 33mm × 20mm × 9mm
Pinout (7-pin connector):
- Vin: 5V power input
- GND: Ground
- Tx: UART transmit (3.3V TTL, connect to MCU Rx)
- Rx: UART receive (3.3V TTL, connect to MCU Tx)
- PWM: PWM output (CO₂ concentration as duty cycle)
- AOT: Analog output (not available on all variants)
- HD: Zero calibration pin (pull low for 7s to force zero calibration)
UART Command Example (Arduino):
- Send:
0xFF 0x01 0x86 0x00 0x00 0x00 0x00 0x00 0x79(read CO₂ command) - Response: 9 bytes — CO₂ = (byte[2] × 256) + byte[3] in ppm
- Compatible with MH-Z19 Arduino libraries (e.g. MHZ19 by Jonathan Dempsey)
Compatible With:
- Arduino Uno, Nano, Mega (via SoftwareSerial or HardwareSerial)
- ESP32 and ESP8266 (3.3V logic — use level shifter on Rx line)
- Raspberry Pi (via UART)
- STM32 and other 3.3V/5V MCUs
Applications:
- Indoor air quality (IAQ) monitors
- HVAC and ventilation control systems
- Greenhouse and grow room CO₂ monitoring
- Smart home air quality dashboards
- School and office CO₂ alert systems
- Industrial safety monitoring
Note: The MH-Z19C has Automatic Baseline Correction (ABC) enabled by default, which assumes the sensor is exposed to fresh air (400ppm) at least once every 24 hours. Disable ABC if used in continuously high-CO₂ environments (e.g. sealed rooms or industrial settings) by pulling the HD pin low for 7 seconds.



