Site icon InnovatorsGuru

MH-Z14A Arduino Code | NDIR Co2 Sensor | Infrared Carbon Dioxide Sensor

mhz14a pwm circuit schematic

mhz14a pwm circuit schematic

MH-Z14A NDIR Co2 Sensor Arduino Code | Infrared Carbon Dioxide Sensor

MH-Z14A Arduino Code

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

About MH-Z14A

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
  • Schools.

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
Specifications Discriptions
Detection range 10000ppm (optional)
Resolution ratio 5ppm (0 ~ 2000ppm)
10ppm (2000 ~ 5,000ppm)
20ppm (5000 ~ 10000ppm)
Accuracy ± 50ppm ± 3%  reading value
Repeatability ± 30ppm
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)
Lifespan > 5year

MH-Z14A Datasheet

Download datasheet, it provide details specification, features, dimensions, mounting guidelines etc.

MH-Z14A Arduino Circuit PWM

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

MH-Z14A Arduino Code PWM Mode

For this sensor arduino library is not requred.

Copy to Clipboard

MH-Z14A Arduino Code UART Mode

For this sensor, the Arduino SoftwareSerial library is required. For details code visit www.14core.com.

Some other repository on github.

Copy to Clipboard

MH-Z14A Raspberry Pi Code using UART Mode

 check MHZ14-CO2-Logger

Exit mobile version