Experiment of MH-Z19C NDIR Carbon Dioxide Sensor Accuracy Outside of Datasheet Power Supply Range

by N0VAT0R in Circuits > Sensors

411 Views, 1 Favorites, 0 Comments

Experiment of MH-Z19C NDIR Carbon Dioxide Sensor Accuracy Outside of Datasheet Power Supply Range

3.jpeg
2.jpeg

Fresh air and proper CO2 concentration are vital for a healthy and focused living environment. I'm a firm believer in simplicity, so I designed my own CO2 sensor using the Espressif ESP8266, Winsen CO2 sensor MH-Z19C, and ESPEasy firmware. What makes my device unique is its ability to indicate CO2 levels through easy-to-understand color-coded statuses, all while allowing users to adjust the threshold values via a convenient web interface. In this project, I'll share my journey of creating a CO2 sensor with standard USB power supply, and how I overcame the challenge of voltage variations to ensure accurate measurements.

Supplies

  1. Espressif ESP8266 (or compatible board)
  2. Winsen CO2 sensor MH-Z19C
  3. RIDEN RK6006 power supply (for experiment)
  4. Sealed jar for maintaining constant CO2 concentration during experiments
  5. Python code for voltage manipulation
  6. ESPEasy firmware

Formulation of a Hypothesis

MH-Z19 working voltage (winsen datasheets).jpg
MH-Z19B vs MH-Z19C comparison.jpg

The MH-Z19C datasheet specifies a working voltage of 5.0±0.1V. However, using a standard USB power supply can lead to a voltage drop due to cable resistance, causing the sensor's supply voltage to fall below the recommended range. This situation raised concerns about the accuracy of CO2 measurements while keeping the setup simple without involving a step-up converter.

During my research, I discovered that the MH-Z19B sensor has a wider working voltage range of 5.0±0.5V, making it suitable for this purpose.

Winsen recommends to use modern MH-Z19C instead of MH-Z19B, both sensors are similar and I assumed that MH-Z19C might work well with extended voltage range as well. To gain clarity on the accuracy of MH-Z19C with extended working voltage, I devised an experiment.


https://shop.winsen-sensor.com/blogs/news/what-is-the-difference-between-mh-z19b-and-mh-z19c

Datasheets:

https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf

https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19c-pins-type-co2-manual-ver1_0.pdf

Write Python Code for Power Supply

I wrote a Python code using GitHub library https://github.com/Baldanos/rd6006/

This library also supports RIDEN RK6006 power supply module

import serial.tools.list_ports
ports = list(serial.tools.list_ports.comports())
for p in ports:
    if "VID:PID=1A86:7523" in p[2]:
      print(p)
      r = RD6006(p[0])
      break
else:
    raise Exception("Port not found")
r.status()
voltage=[5,4.9,4.8,4.7,4.6,4.5,4.4,4.5,4.6,4.7,4.8,4.9,5,5.1,5.2,5]
for i in range(len(voltage)):
    print("U =",voltage[i],"V")
    r.voltage=voltage[i]
    r.enable=True
    time.sleep(1800)
    r.enable=False
    time.sleep(5)

Experimenting

1.jpeg
Chart.jpg

Experiment Setup:

  1. I connected the RIDEN RK6006 power supply to my PC via USB inrerface.
  2. A Python code was written to change the voltage from 5V to 4.4V in increments of 0.1V.
  3. The CO2 sensor was placed inside a sealed jar to maintain a consistent CO2 concentration throughout the experiment.
  4. The program powered off the sensor, adjusted the voltage, and left it for 30 minutes to stabilize before taking measurements.
  5. ESP8266 with ESPEasy firmware measured CO2 concentration and power supply voltage and sent data using IFTTT web hook to Google Sheet.

Experiment Results:

The results of the experiment were quite remarkable. Despite Winsen stating a working voltage of 5.0±0.1V for the MH-Z19C, I found that the accuracy of CO2 measurements remained within 5% for the working voltage range from 4.4V to 5.2V. This range falls well within the detection accuracy of the sensor, which is specified as ± (50ppm + 5% of reading value).

Conclusion:

My DIY CO2 sensor project based on the Espressif ESP8266, Winsen CO2 sensor MH-Z19C, and ESPEasy firmware has proven to be a reliable and user-friendly solution. With the ability to indicate CO2 levels through simple color-coded statuses and adjustable threshold values, it caters to both health-conscious individuals and those who appreciate a clutter-free design.

While the MH-Z19C's datasheet suggests a limited working voltage range, my experiments demonstrated that it could tolerate variations in supply voltage without compromising measurement accuracy significantly. Thus, by using a standard USB power supply, you can confidently build your own CO2 sensor, ensuring a healthier and more pleasant living environment.

Remember, fresh air is essential for your well-being, so try out this project and make your home a place of rejuvenation and focus! Happy making!