MH Z19b - Running CO2 sensor on batteries

  • I'm trying to run the MH Z19b CO2 sensors interfaced by a PIC microcontroller, powered by 3.6V batteries.
    I would like to get the most out of the battery life. So, I have used a transistor and a GPIO pin from PIC to control the power supply to the CO2 sensor programmatically.

    Please find below, the pseudo code of the programming logic I had used to take CO2 measurements from the MH Z19b sensor. I would like to know if this logic will provide me valid measurements. I am trying to measure the CO2 concentration once in every 15 minutes.

    while(true) {
        PIC_sleep(120 seconds);
        /** Till 120 seconds, CO2 sensor was giving 400ppm and only after that I started getting realtime values **/
        PIC_sleep(900 seconds);

  • Plugin Developer

    These type of sensors often have a warm-up time, often measured in minutes. The datasheet will tell you. If you don't let it warm up you will get poor readings.

  • Hi @Siddharth-Velappan

    The warmup time of the MH Z19b is 3 minutes. So 2 is probably fine, but you could probably do 3 just in case. Although 2 would save your more battery time.

    Do you mind explaining your setup a bit more? I would love to do something similar but I do not know where to get started with the PIC microcontroller!

Suggested Topics

  • 8
  • 8
  • 10
  • 8
  • 37
  • 21
  • 3