MH-Z14A NDIR Co2 Sensor Arduino Code | Infrared Carbon Dioxide Sensor
Table of Contents
- 1 MH-Z14A NDIR Co2 Sensor Arduino Code | Infrared Carbon Dioxide Sensor
- 1.1 Where to Buy?
- 1.2 About MH-Z14A
- 1.3 Applications of MH-Z14A NDIR Co2 sensor
- 1.4 Features of NDIR Co2 sensor
- 1.5 MH-Z14A Datasheet
- 1.6 MH-Z14A Arduino Circuit PWM
- 1.7 MH-Z14A Arduino Code PWM Mode
- 1.8 MH-Z14A Arduino Code UART Mode
- 1.9 MH-Z14A Raspberry Pi Code using UART Mode
- 1.10 Further Reading
Where to Buy?
The sensor can be purchased in 3 ranges: a range of 2000 ppm, 5000 ppm and 10000 ppm. This sensor is available in many Chinese online websites. MH-Z14A price varies, but you can get it for approximately $18 in most Websites.
Check Price on Aliexpress | Amazon
My personal favrate for this product is Aliexpress Low Price + Wolrdwide Delivery
MH-Z14A is an Infrared Carbon Dioxide Sensor for accurate NDIR (nondispersive infrared) Co2 measurement using Arduino, STM32, Raspberry Pi. This NDIR Co2 sensor is a small size, common type sensor, NDIR principle to sense the presence of CO2 gas in the air. This NDIR Co2 sensor provides good selectivity, long life and non-oxygen dependent.
This MH-Z14A NDIR Co2 sensor module comes with built-in temperature compensation. MH-Z14A is a most advanced CO2 sensor that transmits a calibrated output valuein following format,
- Digital output, [Serial Port (UART, TTL level)]
- Analog Voltage output, (0.4 – 2V)
- PWM output.
This Infrared Carbon Dioxide Sensor makes it easy to measure atmospheric Co2 percentage measurement posible using Arduino code. MH-Z14A is an infrared gas sensor is developed by the deep integration of infrared absorbing gas sensing technology with the precision optical circuit.
Applications of MH-Z14A NDIR Co2 sensor
- Industrial apparatuses
- HVAC refrigeration equipment
- Air quality monitoring equipment
- Fresh air system
- Air purification equipment
- Smart home
Features of NDIR Co2 sensor
- Built-in temperature compensation
- High sensitivity, Low power consumption
- long life
- Gold-plated chamber, waterproof & anti-corrosion treatment
- Non-oxygen dependent
- Digital output + analogOutput + PWM Output
- Excellent linear output
|Detection range||10000ppm (optional)|
|Resolution ratio||5ppm (0 ~ 2000ppm)|
|10ppm (2000 ~ 5,000ppm)|
|20ppm (5000 ~ 10000ppm)|
|Accuracy||± 50ppm ± 3% reading value|
|Response Time time||T90 < 120s|
|Warm uu/pre heat time||3min|
|Working temprature||0 ~ 50C|
|Working humidity||0% ~ 90% RH (No condensation)|
|Storage temprature||-20 ~ 60C|
|Working voltage||4.5 V ~ 5.5V DC|
|Interface voltage||3.3 V(5V compatible)|
|Working current||Max current <150mA ( Average current <60mA)|
Download datasheet, it provide details specification, features, dimensions, mounting guidelines etc.
Due to the limited resolution of the analog ports (only 1023 values between 0 and 5 volts), the analog output of the sensor (0 to 2.4 V) is not very usable.
The digital output communicates via PWM or UART. The signal (off and for UART also on) runs at 3.3 volts. This means that you have to change your reference signal on your Arduino to 3.3 volts – or you have to increase the signal to 5 volts by hardware.
To do this job the below circuit diagram is used,
|MH-Z14 pin:||Arduino pin:||External power supply:|
|Pin 16 – GND||GND||GND|
|Pin 17- VCC (4.5 V ~ 5.5V DC)||VCC (4.5 V ~ 5.5V DC)|
|Pin 6- PWM||Digital Pin 2|
For this sensor arduino library is not requred.
Some other repository on github.