CO2 meter with ESP8266

This article is quite old. Read the new article, with the updated tutorial to build the home CO2 meter here:

CO2 (Carbon Dioxide)

Sensor MH-Z19B

CO2 (Carbon Dioxide) is a gas dangerous to humans. In high concentrations it can produce dizziness, headache, high blood pressure, rapid heart rate, choking and loss of consciousness.

Caution should be exercised with it, especially in the places where there are many people and little ventilation, as we expel it in the breathing process.

Plants produce the reverse effect. Through the process of photosynthesis, they absorb CO2 and release oxygen..

Home CO2 meter with WiFi

I have been thinking for years about having Wifi CO2 sensors in the house, which would allow me to trigger alarms when levels are too high or perform other actions.

About a year ago, I installed a Netatmo weather station (which I didn't need, as I have a Davis Vantage PRO2) and one of the nice things about it is that it has an indoor CO2 sensor.

The interior module of the Netatmo station is installed in the living room (providing data on temperature, humidity, brightness, sound pressure and CO2) but I would like to be able to measuring CO2 in more places and, in particular, to take spot measurements to know if we are "at risk", e.g. measuring CO2 levels. in different bedrooms while we sleep.

Netatmo Smart weather station: WiFi, wireless, indoor and outdoor sensor, weather forecast, Amazon Alexa and Apple HomeKit, hygrometer, air quality, NWS01-EC, black
  • Real-time measurement of indoor and outdoor ambient temperature: temperature, humidity, indoor and outdoor air quality, indoor noise level, atmospheric pressure
  • Real-time alerts With our weather station, you can set up indoor and outdoor alerts, which you will then receive on your smartphone.
  • Analysis of measured values: You have access to measured values and can therefore better understand climate changes by analysing graphs.
  • Forecast for the future Check out the forecast for the next 7 days and adapt your clothing and activities to the weather ahead.
  • Troubleshooting tip Disconnect and reconnect the indoor module. Check that the LED flashes three times. If it does not flash, try another micro USB cable and another power adapter on the indoor module. Force it out and start the Netatmo New Weather app on your smartphone. It can take up to 10 minutes for the station to reconnect.

Until relatively recently, CO2 sensors were very expensive and needed a calibration which was not normally available to amateurs. This has changed considerably in recent months with the emergence of some economic sensors easy to use and pre-calibrated at the factory.

I recently started looking for information about the "state of the art"I was looking for a way to see if it was finally time to tackle the issue of sensors, and I came across a number of rather interesting sensors. Among the ones I came across was one that stood out from the rest, the MH-Z19.

CO2 detector features and design

I had already decided that I was going to build a CO2 meter, now I had to decide what functionalities it would have and make the design.

As features, the most important thing was that it had a wifi connection and that I could connect it to my home automation system, the rest didn't matter much to me.

However, I wanted it to be a cheap design, as I was planning to put several detectors in the house and I didn't want the budget to go through the roof.

Construction of the Wifi CO2 detector

The detector consists of an ESP8266 microcontroller module with integrated Wifi and a CO2 sensor.

Find the NEW tutorial to build the new version of the CO2 meter here:

4 thoughts on “Medidor de CO2 con ESP8266”

    • Hello Nacho.

      It needs to be connected to the power supply because it consumes quite a lot of power (relatively speaking). The problem is that the sensor has a warm-up time of three minutes (it has to be on for three minutes before giving valid readings) so you can't "turn it on and off" by software for a moment to read the sensor every, say, minute, and have it off for the rest of the time.

      Having said that, I sometimes leave it outside for a night, so that it self-calibrates, connected to a "power bank", one of those used to charge mobile phones, and it works perfectly.

  1. Dear, I bought 2 of these sensors, and one of them is giving me very low values, in the order of 50 to 70 ppm. It is either faulty or it needs to be on for longer. I left it on for 30 minutes and it does not go out of that range.

    • Hello Carlos.

      I do not quite understand the question.

      Did you buy two sensors like this one I'm talking about on this page (the MH-Z19, not B or C, a rather old model) and one of them gives you 50 to 70 ppm results, or gives you 50 to 70 ppm below what it should, or the other one, or...?

      Of course if you're getting 50 to 70 ppm output, something is seriously wrong. It doesn't seem to me to be a heating, stabilisation or calibration issue. I think it's more of a power supply or software issue, or that the sensor is faulty, directly...

      Give us more information about your project to see how we can help you. With the information you provide I can tell you that something is wrong (which you already know) but nothing more.


Leave a comment