Troubleshooting MH-Z14 CO2 Sensor Output Connected To Microcontroller - Sometimes readings go crazy

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Hey guys,
I have some MH-Z14 CO2 sensors connected up to a Particle Photon microcontroller. Its a relatively simple circuit consisting of a 12vdc wall wort as power input, a 5v voltage regulator (RECOM R-78E5.0-1.0), a couple sensors, and a 12VDC fan.

I have a bunch of these devices running in different environments (offices, greenhouses). Occasionally the CO2 sensor enters a state where its output begins to oscillate up and down. Sometime the oscillation frequency is quick (8 minutes peak to peak), and other times its less (couple hours from peak to peak). When it begins to oscillate, you can tell that its oscillating around the real value - this almost looks like noise doesn't it?

The MH-Z14 has multiple output options available (0 to 2.5v analog out, PWM out, UART). I am currently using the PWM option. I took some scope readings and I can see the PWM signal is pretty clean... meaning the MH-Z14 sensor is deliberately outputting these crazy values.

Can you guys offer any advice on what might be going on, or how I should go about troubleshooting this? Here are some of the things that come to mind, but I am not sure if it is legitimate?
* Are the MH-Z14 sensors simply defective?
* Do the MH-Z14 sensors have a design flaw, and either my power supply design, signal interface, or environment conditions are exploiting the sensors flaw causing it to behave like this?
* Did I integrate this sensor into my board incorrectly?
* Is there an environmental condition (such as interference) that is doing this?

Here are some images and video to show you what I am talking about.

I put 2 identical devices in the same room. The one on the left is working currently, and the one on the right is experiencing this problem:
CO2_problem1.jpg

Here is another example.. you can see that periodically this is getting good readings, then the problem starts and stops:
CO2_problem2.jpg

Sometimes the sensor goes for days and works perfectly before the oscillation begins. The oscillation can last several hours to several days, and then it can go away... seems pretty random.

Here is one more example of how the sensors output will be bad, turns clean for the majority of the day, then switches to bad again:
CO2_problem3.jpg

I cannot directly correlate this behavior to anything else happening in the room, it seems to be really random. I had to wait for days for it to start happening so I could take some oscilloscope readings.

Here is a 13 minute long video showing how the PWM signal is clean and deliberately oscillating between 14% and 28% PWM (roughly 700ppm to 1400ppm CO2 concentration). Take note of the "+Duty" value, this is indicating the PWM output.
https://goo.gl/photos/JeZRbcnQMQWYXqyG7


Here is the schematic of the power, how the CO2 sensor is wired up, and how the CO2 sensor is placed on the board:
CO2_problem4.jpg CO2_problem5.jpg CO2_problem6.jpg

Thanks for taking the time to check this out! If you couldn't tell, this problem has been plaguing me for a while and I can't figure it out. Hoping to get some advice and info from you guys, thanks again!
 
Top