Last modified 12 months

The MH-Z19B NDIR CO2 sensor is fantastic. A Inexpensive, accurate NDIR CO2 sensor (for the price it has) and very easy to use. Without a doubt, one of the most used sensors with Arduino, ESP8266, EPS32 and the like.

Discover all the secrets of the CO2 sensor MH-Z19B in one place. A cheap, accurate CO2 sensor (for the price it has) and very easy to use.

Also the CO2 sensor MH-Z19C (although a bit special) is a good sensor, as long as you know what there is to know about it and what makes it special.

It even has a low-consumption version, the Winsen CO2 NDIR sensor MH-Z1311A.

In this article you will find everything you want to know about these sensors (and if you can't find it, ask for it in the comments).

Maybe calling it a bible, at the moment, is a bit pretentious, but I give you my word that it will become one. Give it time...

This article is alive and it never stops growing. Subscribe to the Newsletter and don't miss a thing.

General data of the CO2 sensor MH-Z19B and MH-Z19C and MH-Z19D

CO₂ sensor MH-Z19B

The MH-Z19B Carbon Dioxide Gas Sensor is a small-sized, general-purpose smart sensor that uses the principle of non-scattered infrared (NDIR) to detect the presence of CO₂ in the air.

It has good selectivity, long service life, and other characteristics, such as built-in temperature compensation.

It has simultaneous serial, analog and PWM output and is easy to use.

It is a high-performance sensor that combines reliable infrared absorption gas detection technology with good design and an attractive price.

MH-Z19B sensor parameters

Gas detectedCarbon dioxide
Operating voltage4.5 ~ 5.5 V DC
Average current<60m A (@ 5V supply)
Peak current150 mA (supply @ 5V)
Interface level3.3 V (compatible with 5V)
Measuring range0 ~ 2000 ppm
0 ~ 5000 ppm
Output signalSerial (UART) - TTL level 3.3 V - PWM analog output
Preheating time3 minutes
Response timeT90<120s
Operating temperature0 ~ 50 ° C
Operating humidity0 to 90% RH (non-condensing)
Dimensions33mm × 20mm × 9mm (Length * Width * Height)
Weight5 grams
Lifetime> 5 years

MH-Z19B Features

Gold-plated gas chamber, waterproof and corrosion resistant
High sensitivity, low power consumption
Excellent stability
Temperature compensation, excellent linear output
Long duration

MH-Z19B Sensor Applications

HVAC Refrigeration Equipment
Surveillance and air quality equipment
Fresh air systems
Air purification equipment
Smart home
Schools and educational centers

The CO2 sensor MH-Z19C

The MH-Z19 sensorC it is very similar to the MH-Z19B although it has some things that make it a bit special ...

Its precision, on paper, is slightly worse than that of the MH-Z19B (50 ppm + 5% of the MH-Z19B measurement vs 50 ppm + 5% of the MH-Z19C.

In practice, and according to my experiments and observations, the MH-Z19C is a much more volatile sensor. Not that it's worse than the MH-Z19B, but I like it less.

Winsen MH-Z19C

The CO2 sensor MH-Z19D

The MH-Z19 sensorD is practically the same as the MH-Z19C. It is very recent (June 2021) so there is not much information about it yet.

This sensor is so new on the market that its manufacturer in English does not even appear on the web, it is necessary to look for it in the Chinese version to find some information (not too much).

Winsen MH-Z19D

I still have not found the official datasheet in English, here you can find the MH-Z19D datasheet in Chinese.

CO2 sensor MH-Z1311A by Winsen

Although I do not include it here, because it is not an MH-Z19x strictly speaking, I could not stop naming the energy saving sensor MH-Z1311A by Winsen.

Cousin 99% compatible with the MH-Z19 with a 99% energy saving.

A very new sensor to consider. We will have to wait for the tests.

Winsen MH-Z1311A CO2 Sensor

If you want to know him better, visit the following blog post:

What versions of the MH-Z19 sensor are there?

It is difficult to know exactly, since Chinese manufacturers are quite used to making changes to their products without communicating them and, sometimes, there is a parallel market for units marked with other names or references.

Rest assured, there are the following versions:

  1. The original 400 ~ 2000ppm range MH-Z19 model, with 50ppm + 5% precision accuracy of the measurement.
  2. The original 400 ~ 5000ppm range MH-Z19 model, with 50ppm + 5% precision accuracy of measurement.
  3. MH-Z19B model of 400 ~ 2000 ppm range, which is a more modern and improved version. This version has a precision of 50 ppm + 3% of the measurement.
  4. 400 ~ 5000 ppm range MH-Z19B model, which is a more modern and improved version. This version has a precision of 50 ppm + 3% of the measurement.
  5. 400 ~ 10000 ppm range MH-Z19B model, which is a more modern and improved version. This version has a precision of 50 ppm + 3% of the measurement.
  6. Model MH-Z19C with range 400 ~ 2000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.
  7. Model MH-Z19C with range 400 ~ 5000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.
  8. Model MH-Z19C with range 400 ~ 10000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.
  9. Model MH-Z19D with range 400 ~ 2000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.
  10. Model MH-Z19D with range 400 ~ 5000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.
  11. Model MH-Z19D with range 400 ~ 10000 ppm. This version has an accuracy of 50 ppm + 5% of the measurement.

IMPORTANT: MH-Z19B sensors with black printed circuit board, everything indicates that they are versions they are false.

If you want to know more about fake sensors, you can find all the information here: MH-Z19B FALSE CO2 Sensors

Zero Point Calibration

The MH-Z19B and MH-Z19C sensors they are already factory calibrated and, although under normal conditions manual calibration should not be necessary, I recommend that you calibrate it when you receive it and periodically.

Changes in environmental conditions, such as temperature and humidity, atmospheric pressure, storage and transport conditions and the aging of the sensor itself, cause that, over time, your measurements vary (as with all sensors of this type).

This zero point calibration refers to the method by which the sensor "Learn" at what concentration of CO2 corresponds to a concentration of 400 ppm, or zero point.

This sensor has two methods to perform the zero point calibration: manual calibration and self-calibration.

Manual zero point calibration of the MH-Z19, MH-Z19B and MH-Z19C sensors

VERY IMPORTANT: It is essential that, during the manual calibration process, the sensor is running beforehand for, at least 20 minutes, in a stable CO2 environment with a fresh air CO2 concentration of 400ppm (outdoors or by a window, for example).

Hardware calibration

If we have physical access to the sensor connections, we can easily initiate the zero point calibration procedure by connecting together terminals 5 (HD) and 7 (GND) for, at least, 7 seconds.

Software calibration

The sensor has a command, which will command it to perform the zero point calibration at that moment.

We only have to send the command 0xFF, 0x01,0x87,0x00,0x00,0x00,0x00,0x00,0x78

Calibration using ESP Easy

If we are using ESP Easy, among the available commands, we have the command mhzcalibratezero.

We can send the command, for example, by loading the page http: // xxxx / tools? Cmd = mhzcalibratezero (we will replace the xxxx with the IP address of ESP Easy).

Note: The command should be mhzCMDCalibrateZero, but for some reason it doesn't work (at least in the current version of ESP Easy, at the time of writing).

If ESP Easy does not recognize the command mhzcalibratezero, test mhzCMDCalibrateZero (You will know because ESPEasy responds with «Command unknown: mhzCMDCalibrateZero"Or"Command unknown: mhzcalibratezero«).

Self-calibration of the zero point of the MH-Z19, MH-Z19B and MH-Z19C sensors

To avoid the user having to perform a manual calibration periodically, the sensor incorporates in its firmware an autocalibration routine, called ABC, which works as follows:

Since the natural CO2 concentration in the atmosphere is approximately 400 ppm, when ABC is enabled, the sensor assumes that, over a 24 hour period, the minimum measurement taken will be equivalent to 400 ppm.

This means that in a well-ventilated room, with clean air at some point in the day, the lowest measurement will be around 400 ppm and the sensor will assume that concentration (whatever it is) as the zero point, or 400 ppm.

In other words, the sensor will assume that the lowest measurement in each 24 hour period will be 400 ppm.

This is a very convenient way to keep the sensor calibrated, using clean air as a reference value and automating the process.

In addition, we can easily activate and deactivate the ABC routine, so that we can adapt the way the sensor works to our particular needs.

Should I have the ABC active or inactive?

It depends on where you have it working.

The ABC works quite well, but for this the sensor has to be in a site that is ventilated at least once a day (up to those, about 400 ppm).

My advice is to activate ABC if the sensor is installed in places such as classrooms, offices, etc., that are not used during the weekend and allow time for the CO2 to drop to room level.

If the sensor is installed in places that are not usually ventilated (indoor rooms that are usually very busy, or greenhouses, for example) better disable ABC.

In a house, it depends ... in my office it does not have time to reach 400 ppm daily because I have it almost always closed (door and window) and I spend many hours in it a day. In the living room there is time because we usually ventilate every day and, although there are more people, it is larger and the door is usually open.

High point calibration (Span Point)

Just as we have a calibration of the lowest point that the sensor is going to measure (the approximately 400 ppm of CO2 found in “clean” outside air), we have the possibility to calibrate the high point of the measurement (for example, at 2000 ppm).

In my opinion this calibration not available to fans, since you have to achieve a stable and calibrated atmosphere with exactly 2000 ppm of CO2 and that is tremendously difficult without the adequate laboratory resources.

My recommendation is that don't even think about trying to calibrate the Span Point on your own. Logically, if you have access to the necessary laboratory, surely you have the necessary knowledge to do it, in which case, go ahead ...

If you decide to do so despite the warnings, the method is very similar to zero point calibration.

  1. Do the zero point calibration first, as explained above
  2. Put the sensor in a stable environment at 2000 ppm
  3. Allow the sensor to stabilize for a minimum of 20 minutes
  4. Send the Span Point Calibration command to the sensor

The command to send is 0x88 and you can find it in the datasheet that I have left you before with its parameters.

This command will not be able to send it directly from ESP Easy.

Are the temperature sensors on the MH-Z19, MH-Z19B and MH-Z19C reliable?

No, they are not at all.

Please note that the temperature sensor it's only for internal use of the sensor, to be able to do the temperature compensation. Its use is really undocumented by the manufacturer and we are using it based on reverse engineering of the possible commands and responses (come on, it's a hack).

Are there different models of the MH-Z19, MH-Z19B and MH-Z19C depending on the detection range?

The sensor looks like is exactly the sameregardless of the detection range. In fact, it is possible to change the detection range by software, sending a command to the sensor.

You can find information about the command to send in the datasheet.

The accuracy of the MH-Z19, MH-Z19B and MH-Z19C sensors up to 2000 ppm is surprisingly good. Above 2000 ppm the accuracy progressively deteriorates.

Where can I find more information about the MH-Z19, MH-Z19B and MH-Z19C sensors?

There are a number of sources of information, official and unofficial, very interesting, if you want to get more information about the sensor.

Official sources

The official source par excellence of any electronic component is its datasheet, or data sheet. It is the document in which the manufacturer includes all the information about its product.

Manufacturer data sheets:

Datasheet of the MH-Z19 (an earlier version than the MH-Z19B) in English from 03-03-2015

MH-Z19 DatasheetB in english from 23-09-2019

MH-Z19 DatasheetB in Chinese on 10-15-2020

MH-Z19 DatasheetC in english from 02-04-2020. This version is problematic with food (more information here).

MH-Z19D Datasheet in Chinese, 3-16-2021

Unofficial sources


On the blog of RevSpace you have two pages with a lot of information, especially technical, very useful and interesting about the MH-Z19 and about him MH-Z19B


You can find a lot of information, although scattered, in the ESP Easy official forum.

Source code

Although it is not easy to locate, because it is very scattered, I have learned a lot by studying the source code that I have been able to find to use the MH-Z19B.

GitHub is a great source of information, in this regard.

Sensor connection MH-Z19, MH-Z19B and MH-Z19C MH-Z19D

The basic connection of the MH-Z19, MH-Z19B and MH-Z19C sensors is very easy, it only requires four connections. Two for power and two for data transmission.


I recommend looking carefully at the power requirements for your specific sensor. Depending on the version, the acceptable operating voltage may vary.

According to the manufacturer's data sheets, the following operating voltages are accepted:

MH-Z19: 3.6 to 5.5 Volts DC

MH-Z19B: 4.5 to 5.5 Volts DC

MH-Z19C: 4.9 to 5.1 Volts DC

MH-Z19D: 4.9 to 5.1 Volts DC

Have watch out for the MH-Z19C (and MZ-Z19D). Getting a supply of between 4.9 volts and 5.1 volts (a very narrow range) from a USB port can be "delicate" And if you don't have a multimeter to measure that the voltage that reaches the MH-Z19C is within these ranges, I recommend avoiding it. In addition, it is important that this tension is well stabilized.

You have more information here.


It is important that you check your specific sensor pins, as some users have reported variations.

Anyway, don't worry, you can see in the serigraphy of the sensor which corresponds to each of the pins:

MH-Z19 pins

Old MH-Z19 pins (long gone).


MH-Z19B pins

Pins of the MH-Z19B. This sensor is still sold, but has been replaced by the MH-Z19C


MH-Z19C pins

Pins of the MH-Z19C. Latest version of sensor. Currently sold.


Connector version

There are versions of this sensor with connector, instead of pins.

Below, you can see the connection of the main pins.

You will see that I have only marked four wires, and that is because in the tests I have done with different versions of the MH-Z19 sensor (including the fake ones) only these four connections have matched in all. The rest may vary.

Connections MH-Z19B connector

I recommend that, if you have any questions, and Before connecting, make sure how your specific sensor is wired.

If you discover a sensor with different wiring, please let me know to include the information


The sensor is a delicate measuring instrument. You should take the following precautions when mounting:

  • The sensor is sensitive to static electricity - Avoid touching the pins with your fingers as much as possible.
  • Before touching the sensor, touch something with your hand, which is grounded, to discharge static electricity (a water or heating pipe, for example).
  • The case is not just a box. It is an active part of the sensor - Be careful not to force it.
  • The sensor is sensitive to high temperatures - Solder it with a low power electronic soldering iron (about 30w can be fine) and don't apply heat to the pins for too long. Let it cool between soldering one pin and the next.

Data provided by the sensor

The sensor provides three pieces of information with each measurement:

PPM: It is the CO2 concentration at that moment. Is the only data which must be used by the user.

T: It is the internal sensor temperature. This is a internal data which the sensor uses to adjust CO2 measurements as they are temperature dependent, and should not be used by the user. There are huge differences in the temperature reported from one sensor to another.

OR: Nobody knows what the U-value is for sure. What is known is that it is a internal parameter what has to do with him ABC (zero point autocalibration) and with the CO₂ concentrations that the sensor has detected in the last cycle of ABC, but nothing else. Some versions of the sensor always provide this value at 0.

Is it true that there are fake MH-Z19Bs?

Yes there are, unfortunately, so you have to be careful where you buy.

I have written a full article on that because it is affecting a lot of people. If you are going to buy one of these sensors, or you already have one, be sure to read it.

The MH-Z19B label

The MH-Z19B paper label, affixed to the side, shows the sensor model, the measuring range with which it left the factory (can be changed later with a command) and what It seems be a date (possibly of manufacture, calibration or quality control), and a QR code.

It is curious because in false sensors this date doesn't seem to make sense. In the photo sensor, what we assume is the "date" indicates December 25, 2020 (Christmas Day) and the seller sent it to me on December 25, 2020.

Precautions and things to keep in mind

There are a few basic things to watch out for, and while most are obvious, it doesn't hurt to put them together here under one point:

  • Avoid any pressure, in any direction, on the plastic casing during welding, installation and use.
  • When installed in a small space, the space must be well ventilated, especially your broadcast windows.
  • The module must be away from heat sources and its direct exposure to the sun or other sources of heat should be avoided.
  • The module must be periodically calibrated. The manufacturer suggests that it be done every six months. Logically this will depend on the use made of it and the environment in which it is used.
  • Do not use the sensor in an environment dusty for too much time.
  • Check the requirements of feeding of your specific model (see your specific version in the "MH-Z19B connection" section of this article). The source current should not be less than 150mA. Outside of this range, it will cause a sensor malfunction (it may indicate a CO2 concentration lower than actual, or the sensor may not function properly).
  • Prior to the manual zero point calibration procedure, the sensor must be operated in a stable gas environment (400ppm) for more than 20 minutes. Connect the HD pin low (0V) for more than 7 seconds.
  • Do not use wave solder or dip for the sensor.
  • When welding with a soldering iron, the temperature should be set at (350 ± 5) ° C, and the welding time should be 3 seconds maximum (solder it fast, Do not entertain).

MH-Z19C Sensor Review

Variation with supply voltage

As I have been saying for a long time, I don't recommend the MH-Z19C sensor at all, in a general way, and here I am going to document some of the conclusions that I have reached through some tests that I am going to describe.

This sensor has a major problem with eating, since the operating voltage range is very narrow (of 4.9V to 5.1V according to the manufacturer, although as we will see it is even narrower).

This very narrow supply voltage is very difficult to keep stable and many of the USB power supplies we use provide values above and below this voltage.

In addition, there is another added problem that, although it can be minimized with a good design, it is not easy for the average hobbyist: This type of sensors have a relatively high consumption, which causes drops in the power supply produced in the circuit cables themselves ( it is normal that these drops can be 0.2V ~ 0.4V and even higher), which makes it extremely difficult to have a stabilized supply voltage.

In this first test I have kept the sensor working for about 10 hours powered by a programmable laboratory power supply that modified the supply voltage every 60 seconds between 4.5V and 5.15V in steps of 0.5V. That is: it fed the sensor at 4.5V for 60 seconds, it switched to 4.55V for another 60 seconds, 4.6V for another 60 seconds and so on (when it reached 5.15V it switched to 4.95V for 5 minutes, to stabilize it, and restart the cycle at 4.5V.

In order to see the deviation in the CO2 concentration measurements provided as the supply voltage changed, I have compared to my reference sensor, a Senseair S8.

In the graph you can see how the CO2 measurement reported by the MH-Z19C (in green) was changing with the supply voltage (in blue) and its deviation with respect to the Senseair S8 reference sensor (in orange).

It may seem that the differences are not very important, but if we zoom in on a shorter period of time:

And if we go even more in detail we will clearly see the oscillations of the MH-Z19C sensor:

Notice how in the period of feeding with 4.95V for 5 minutes the MH-Z19C slowly stabilizes.

Factory calibration

In the graphs above, you may have noticed the large differences in CO2 concentration reported by both sensors.

The MH-Z19C was brand new, with its factory calibration and ABC disabled (disabled in its first minute of operation after connecting it for the first time to maintain its factory calibration).

The Senseair S8, although it has not been calibrated for a few weeks, is my reference sensor and does not usually show (taking 5-minute moving averages) more than 80 ppm deviation compared to my other sensors. reliable that I have running simultaneously in the same room (Winsen MH-Z19A, Cubic CM1106 and Senseair Sunrise).

As you can see, the calibration of the MH-Z19C sensor is quite far from the correct point. Most surprisingly, this sensor came with a Winsen calibration certificate. This type of certificate does not seem to be very reliable and it seems more like a marketing element by this Chinese manufacturer than anything else.

Essential: Stabilize the power supply of the MH-Z19C

Okay, the differences seen in the measurements from the previous test are very subtle, but now we will see that it's a lot worse than it looked, and no wonder some people did not see a problem in those measurements. It is not very difficult for me to know that something is wrong because I have done many, many tests with CO2 sensors and I have dedicated many, many hours to their analysis. So I've done another "real world" test to make what is going on more clearly:

In this graph you can see the measurements of the MH-Z19C (in green) put to the test together with my reference Senseair S8 LP sensor (yellow line) and the supply voltage of the MH-Z19C (blue line) for a period of ten days.

In the first part the sensor is powered through a USB charger multiple with a capacity of 2.5A per port. In the second, I have included in the diet a voltage stabilizer (a step up down), but how the MH-Z19C power supply is stabilized at 5.0V (Even if you see that it is on the 5.2V line, that is because I did not go to much trouble to calibrate the voltage divider and the small power "spikes" are due to the ADC noise of the ESP8266, which is not very good ).

In the first part you can see how the blue line fluctuates (remember, the supply voltage of the MH-Z19C) and with it the CO2 measurement, introducing noise, jumps and spikes nonexistent.

I recommend that you click on the image to see it larger and even zoom in on it. You will see that it has all kinds of problems: non-existent large peaks, slow measurements, saw teeth, etc.

In the second part, with the MH-Z19C power supply is stabilized at 5.0V, the CO2 measurement stays close to the Reference Sensor measurement all the time.

Conclusions with the MH-Z19C

Based on my tests, it seems clear that the MH-Z19C sensor is a good sensor and can be used without problems as long as the supply voltage stabilizes at 5.0V always.

If you feed it with a USB power supply / charger you have to put the stabilizer ALREADY. These devices do not provide the quality of voltage stabilization that the MH-Z19C needs,

I leave you here, in case it suits you, the link to voltage stabilizer in AliExpress. It is the same place where I bought it. For what it costs, it's very worth it.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 5

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

50 thoughts on “La biblia del sensor de CO2 MH-Z19B”

  1. Dear Mariete Team,

    I'm Summer from Winsen, which is the manufacturer of the MH-Z series CO2 sensor.

    So glad to to find such a professional and detailed blog introduction to our product.
    Thank you so much!
    We also have many other different types of gas sensors and other sensors. If you have any questions about our sensors of need some samples for your evaluation, please advise me freely. 😊
    My Email & Skype : [email protected]
    My Whatsapp: +86 17806246591
    Thank you again!

  2. Hi,
    I have read somewhere that querying the sensor over UART too often can result in a reduced lifespan. Can you say something to that? Is it safer to use PWM as there are no manual queries being made to the sensor?


  3. Hi,
    I have read somewhere that quering the sensor via serial (UART) too often will decrease it's life expectancy. However, this seems to be controversial since it seems to take a measurement on it's own every second when using PWM. Can you tell something about this?


  4. I've been using the MH-Z19B sensor for a while and I've noticed that the values fluctuate wildly. I have the meter outside and values shoot back and forth from 400 to over 1000 PPM. I am using a NodeMCU ESP8266 board with ESP_Easy and the calibration is on. I even used the web command for calibration mhzCMDCalibrateZero, but it doesn't seem to help. Could the sensor be broken or is it very common for those readings to shoot back and forth like that?

    • Hi Gudio.

      Most of the times issues with wrong readings and calibration problems come from problems with the sensor's power supply.
      It's very important to have a steady power for the sensor within the voltage range indicated by the manufacturer (4.5~5,5V for the MH-Z19B and 4.9~5,1V for the MH-Z19C.
      Take care of long or very thin wires for the power supply that can cause big voltage drops.
      Look also for bad connections that can cause all kind of issues. Check soldering.

  5. I have a B & C version, and both got somehow caught in an ABC cycle and are now reading ~400ppm lower than a reference sensor I have. It's bitter cold winter now where I live, and so the house is closed up tight - CO2 levels are consistently running 800-1200 without intervention (based on my desktop monitor -

    I have the Z19 wired to an ESP and some relays to control my HRV to bring in fresh air - I have tried putting the unit in the fresh air stream for an hour and then connecting the HD pin to ground for 10 seconds (> 7) but it does not seem to bring the zero point back down to a reasonable level.

    Has anyone had success getting these to recalibrate to a lower baseline (ie: back to 400ppm == 400ppm?)

    • Hi Al.

      Most of the times issues with low readings and calibration problems come from problems with the sensor's power supply.
      It's very important to have a steady power for the sensor within the voltage range indicated by the manufacturer (4.5~5,5V for the MH-Z19B and 4.9~5,1V for the MH-Z19C.
      Take care of long or very thin wires for the power supply that can cause big voltage drops.
      Calibration by shorting the HD pin to GND for > 7 secs. works very well and is something that should give no problems at all.

  6. Hi I need help with a mhz19b sensor project with my WeMos d1 mini pro board,
    I summarize you, my sensor does not work even with the arduino example code, it always gives the value 0, I have tried to change the pin jumpers and everything but I can't get it to work.

    I need to have it working by Monday, if there was a WhatsApp group or something for which I could pass photos, I would appreciate it very much

    • Hello Juan Antonio.

      WhatsApp group I do not know if there will be any but you have the Telegram group of eMariete:

      I would recommend that, as a first step, you continue the CO2 Easy project with your plate. By starting with something that you positively know works and is well documented, you will know for sure that the hardware is fine and, when you are sure, you can focus on that Arduino code you are using.

      A greeting.

    • Hi Ger.

      I usually glue it with hot glue (what they usually call glue or hot glue) but I suppose you can glue it with most normal glues such as cyanoacrylate (Superglue, for example) or epoxy.

      A greeting.

  7. Hello, I just received my MH-Z19B sensor, my question is about the range, the sensor says it has a range of 0-5000, I want to use it for a greenhouse, where values less than 400ppm can be recorded. My question is, can those values lower than 400ppm be registered by this sensor? In this case, will it be necessary to remove the automatic calibration? Since the lower value will not correspond to 400ppm, I hope to be understood, greetings.

    • Hi Carlos.

      If you look at the manufacturer's datasheet you will see that it says that the sensor can measure below 400ppm (from 0, according to the datasheet) and in fact refers to its use in greenhouses.
      Indeed, you will have to disable the automatic calibration and calibrate it manually from time to time.

      A greeting.

  8. Hello in the design microcontroller and sensor can both be powered with 5V? Will the Usart of the sensor not be burned by the 5v levels of the serial signal?

    • Hello Alvaro.

      If you look at the datasheet of the sensor you will see that the manufacturer itself indicates that the serial pins are 3.3V, compatible with 5V, so you will not have any problem.

      A greeting.

  9. Hello, excellent page! And I bring a query, I bought one that has a date of 9/3/2021, fresh out of the oven for the publication date, and when I consult the value of ppm with the 86 command, it responds one more byte to what the sheet says of data, I send you:
    FF 01 86 00 00 00 00 00 79
    And he responds:
    FF 86 01 96 39 00 01 00 A9
    FF: Home
    86: command responding
    01: Most significant byte of CO2 ppm
    96: Least significant byte of CO2 ppm
    39: ????, this I do not know what it is, I know that it goes up when the ppm goes up and goes down when the ppm goes down
    00: Ok that's 00, I think!
    01: ????, this value increases over time
    00: Ok make it 00
    A9: CRC, all good

    Anyone know what that additional data is? It is not noise because I am good at the checksum, which by the way gives me that it is the complement to 0, not the complement to 1 as the datashet says ... or I am doing something wrong that I am good at haha.

    For now I know that this value of 39 accompanies the ppm level, and the value that I have in 1 in the example, goes up over time, it would seem to be a timer.

    • Hi Cesar.

      From what I see in your message the answer "FF 86 01 96 39 00 01 00 A9" is correct and matches what the datasheet indicates. They are the 9 bytes that you should receive.

      The rest of the data is not documented by the manufacturer, but thanks to the work of some people it has been partially found out what it corresponds to. This is a quick summary, but you can find more information in the links included in the article.

      r [2..3], r [4], r [5], r [6], r [7]
      r [2..3] "final" CO2 level.
      r [4] - (temperature in C) + 40
      r [6] and r [7] - if ABC turned on - counter in «ticks» within a calibration cycle and the number of performed calibration cycles.

      A greeting.

    • Although it's been a long time since the message, as for the CRC it gives me 59. It is not for touching the noses hehe, is to check if you still returning the correct checksum or I'm wrong in the calculation hehe. Greetings.


Leave a Comment