Winsen MH-Z19C Infrared CO2 Sensor Module
Model: MH-Z19C
Document Type: User's Manual
Version: 1.2
Issue Date: 2021.05.14
Manufacturer: Zhengzhou Winsen Electronics Technology Co., Ltd
Website: www.winsen-sensor.com
Statement
This manual's copyright belongs to Zhengzhou Winsen Electronics Technology Co., LTD. Without written permission, any part of this manual shall not be copied, translated, stored in a database or retrieval system, nor spread through electronic, copying, or record ways.
Thank you for purchasing our product. To help customers use it better and reduce faults caused by misuse, please read the manual carefully and operate correctly according to the instructions. Zhengzhou Winsen Electronics Technology Co., LTD. shall not be responsible for losses if users disobey the terms or remove, disassemble, or change components inside the sensor.
Specifics such as color, appearance, and sizes are subject to change and will prevail in kind.
Zhengzhou Winsen Electronics Technology Co., LTD. is devoted to product development and technical innovation, reserving the right to improve products without notice. Please confirm you have the valid version before using this manual. User comments on optimized usage are welcome.
Please keep the manual properly for future reference.
Profile
The MH-Z19C NDIR infrared gas module is a common type, small-size sensor available in pins or terminal configurations. It utilizes the non-dispersive infrared (NDIR) principle to detect CO2 in the air, offering good selectivity, non-oxygen dependence, and a long lifespan. It features built-in temperature compensation and provides both UART and PWM outputs. The module is developed through the integration of mature infrared absorbing gas detection technology, precision optical circuit design, and superior circuit design.
Applications
- HVAC refrigeration
- Indoor air quality monitoring
- Ventilation system
- Air cleaner device
- Smart home
- School
Main Features
- Gold-plated chamber
- High sensitivity, low power consumption
- Good stability
- Temperature compensation, excellent linear output
- Multiple output modes: UART, PWM
- Long lifespan
- Anti-water vapor interference, anti-poisoning
Main Parameters
Parameter | Value |
---|---|
Model No. | MH-Z19C |
Detection Gas | CO2 |
Working voltage | 5.0 ± 0.1V DC |
Average current | < 40mA (@5V power supply) |
Peak current | 125mA (@5V power supply) |
Interface level | 3.3 V (Compatible with 5V) |
Detection Range | 400~10000ppm (optional) |
Output signal | Serial Port (UART) (TTL level 3.3V), PWM |
Preheat time | 1 min |
Response Time | T90 < 120 s |
Working temperature | -10 ~ 50 °C |
Working humidity | 0 ~ 95% RH (No condensation) |
Storage temperature | -20 ~ 60 °C |
Weight | 5 g |
Lifespan | > 10 years |
Detection Range and Accuracy
Detection Gas | Formula | Detection Range | Resolution | Accuracy |
---|---|---|---|---|
Carbon Dioxide | CO2 | 400~2000ppm | 1ppm | ± (50ppm + 5% reading value) |
400~5000ppm | ||||
400-10000ppm |
Dimensions (Pins Type)
Diagram showing the physical dimensions of the MH-Z19C module in pins type configuration. The diagram includes measurements for length, width, and height, as well as the spacing and arrangement of the pins. Key dimensions indicated are approximately 32.9x29.54x13.3 mm, with pin pitch of 2.54 mm.
Pins Connection Type:
Pin | Pin Definition |
---|---|
Vin | Positive pole of power (Vin) |
GND | Negative pole of power (GND) |
PWM | PWM signal output |
Hd | HD (zero point calibration, low level lasting for over 7s is effective) |
Rx | UART (RXD) TTL Level data input |
Tx | UART (TXD) TTL Level data output |
A diagram illustrates the pin layout from the bottom view, showing the arrangement of Vin, GND, PWM, Hd, Rx, and Tx pins.
Dimensions (Terminal Type)
Diagram showing the physical dimensions of the MH-Z19C module in terminal type configuration. The diagram includes measurements for length, width, and height, as well as the layout of the terminal connectors. Key dimensions indicated are approximately 38.8x26x10 mm.
Terminal Connection Type:
Pin | Terminal Pin Definition |
---|---|
Pin 4 | Vin power in |
Pin 3 | GND |
Pin 2 | Reserved |
Pin 7 | PWM |
Pin 1 | HD (zero point calibration, low level lasting for over 7s is effective) |
Pin 5 | UART (RXD) TTL Level data input |
Pin 6 | UART (TXD) TTL Level data output |
A diagram illustrates the terminal connection version, showing the numbering and arrangement of the terminals.
Output
PWM Output
The PWM output provides CO2 concentration data. For example, a CO2 output range of 400~2000ppm is shown.
Parameter | Value |
---|---|
CO2 output range | 400~2000ppm |
Cycle | 1004ms ± 5% |
Cycle start high level output | 2ms (theoretical value) |
The middle cycle | 1000ms ± 5% |
cycle end low level output | 2ms (theoretical value) |
The CO2 concentration (Cppm) can be calculated using the formula: Cppm = 2000 * (TH - 2ms) / (T - 4ms)
, where TH is the high level output time during the cycle and T is the total output time during the cycle (1004ms ± 5%).
A waveform diagram illustrates the PWM output timing for different CO2 concentrations: 400ppm (202ms high pulse), 1000ppm (502ms high pulse), 1500ppm (752ms high pulse), and 2000ppm (1002ms high pulse). Each cycle has a total duration of approximately 1004ms.
Serial Port Output (UART)
Hardware Connection: Connect the module's Vin-GND-RXD-TXD to the user's 5V-GND-TXD-RXD. Users must use TTL level; if RS232 level is used, it must be converted.
Software Setting: Set the serial port baud rate to 9600, data bit to 8 bytes, stop bit to 1 byte, and parity bit to null.
Commands:
Command | Description |
---|---|
0x86 |
Read CO2 concentration |
0x79 |
Turn on/off self-calibration function |
0x86 - Read CO2 concentration
Sending command:
Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
---|---|---|---|---|---|---|---|---|
Start Byte | Reserved | Comm and | - | - | - | - | - | Checksum |
0xFF |
0x01 |
0x86 |
0x00 |
0x00 |
0x00 |
0x00 |
0x00 |
0x79 |
Return value:
Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
---|---|---|---|---|---|---|---|---|
Start Byte | Command | Concentration (High 8 Byte) | Concentration (Low 8 Byte) | - | - | - | - | Checksum |
CO2 concentration calculation: CO2 concentration = HIGH * 256 + LOW. For example, to calculate concentration: convert hexadecimal 01 into decimal 1, hexadecimal F4 into decimal 244, then 1 * 256 + 244 = 500ppm.
0x79 - On/Off Self-calibration for Zero Point
Send command (No return value):
Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
---|---|---|---|---|---|---|---|---|
Start Byte | Reserved | Command | - | - | - | - | - | Checksum |
0xFF |
0x01 |
0x79 |
0xA0/0x00 |
0x00 |
0x00 |
0x00 |
0x00 |
Checksum |
Note: When byte3 is 0xA0
, the auto calibration function is on; when byte3 is 0x00
, the auto calibration function is turned off. The sensor factory defaults to the self-calibration function being on.
Checksum Calculation Method
Checksum = (Negative (Byte1 + Byte2 + Byte3 + Byte4 + Byte5 + Byte6 + Byte7)) + 1
For example:
Byte0 | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 | Byte7 | Byte8 |
---|---|---|---|---|---|---|---|---|
Start Byte | Reserved | Command | - | - | - | - | - | Checksum |
0xFF |
0x01 |
0x86 |
0x00 |
0x00 |
0x00 |
0x00 |
0x00 |
Checksum |
Calculating Checksum:
- Add Byte 1 to Byte 7:
0x01 + 0x86 + 0x00 + 0x00 + 0x00 + 0x00 + 0x00 = 0x87
- Negative:
0xFF - 0x87 = 0x78
- Then + 1:
0x78 + 0x01 = 0x79
C language function for checksum:
char getCheckSum(char *packet)
{
char i, checksum;
for( i = 1; i < 8; i++) {
checksum += packet[i];
}
checksum = 0xff – checksum;
return checksum;
}
Zero Point Calibration
This module offers two methods for zero point calibration: hand-operated method and self-calibration. The zero point is set at 400ppm CO2.
Hand-operated method:
Connect the module's HD pin to a low level (0V) for at least 7 seconds. Before calibrating the zero point, ensure the sensor has been stable for more than 20 minutes in a 400ppm ambient environment.
Self-calibration:
After the module works for some time, it can intelligently judge the zero point and perform zero calibration automatically. The calibration cycle occurs every 24 hours after the module is powered on. The zero point is 400ppm.
This method is suitable for office and home environments but not for agriculture greenhouses, farms, or refrigerators. If the module is used in such environments, please turn off this function.
Notes
- Please avoid applying pressure to the gilded plastic chamber from any direction during welding, installation, and use.
- When placed in a small space, ensure good ventilation, especially for the diffusion window.
- To ensure normal operation, the power supply must be within the 4.5V~5.5V DC range, and the power current must be not less than 150mA. Deviations from this range may result in sensor failure (e.g., low concentration output or sensor malfunction).
- Keep the module away from heat sources and avoid direct sunlight or other heat radiation.
- The module should be calibrated periodically; the suggested period is no longer than 6 months.
- Do not use the sensor in a high-dust environment for extended periods.
- During the zero-point calibration procedure (manual or command-based), the sensor must operate in a stable gas environment (400ppm) for over 30 minutes.
- Wave soldering is forbidden for this sensor.
- When soldering with a soldering iron, set the temperature to (350 ± 5) °C, and the soldering time must be within 3 seconds.
Contact Information
Zhengzhou Winsen Electronics Technology Co., Ltd
Address: No.299, Jinsuo Road, National Hi-Tech Zone, Zhengzhou 450001 China
Tel: +86-371-67169097/67169670
Fax: +86-371-60932988
Email: sales@winsensor.com
Website: www.winsen-sensor.com