DIY CO2 meter with elefant

CO2 measurement TTGO ESP32 3D-print

Build a CO2 meter 3D-printed with sound alarm and colored display to indicate ranges. All information is given so you can build your own CO2 meter.

Uwe Sterr

The idea

Since in winter of 2020 one way to fight the corona virus is to keep the air fresh in closed rooms. One indicator of freshness of air is the CO2 concentration which should be kept below 1000ppm and should definitely be less than 2000ppm.

So the idea of Mark and myself was to build a CO2 meter which can be used in kindergarten and schools.

The CO2 concentration is therefore measured and displayed by a colored ring meter so it is easy to understand what needs to be done.

Also the temperature and humidity are measured and displayed. The parameter which is prominently shown as a ring meter can be toggled with the lower button.

An alarm sound is triggered when the CO2 concentration crosses the threshold of 2000ppm. The CO2 meter has a battery so it can be carried around to wherever it is needed, since the TTGO has also WiFi and BLE one could stream the values to a central control device.

Build it yourself

In this blog we give all what is needed to build a CO2 meter yourself

The software is available at GitHub

3D printing

We printed the housing with an Artillery Genius which as 330€ on Amazon and about 220€ on Banggood.

You can find the .stl files so you can print the housing and the design elements yourself at Thingiverse.

Design of housing

The housing was designed using Fusion 360. This was my first experience with a CAD tool and it took about two weeks to get a housing I was happy with.

To learn how to use Fusion 360 I watched a fair amount of videos, the following list might help when you want to find your way into Fusion 360.

Parts list

CO2 sensor

NDIR CO2 Sensor MH-Z14A PWM NDIR Infrared Carbon Dioxide Sensor Module
Where to buy?

Temperature and humidity sensor

GY-BME280 Barometric Sensor Parent
Where to buy?


TTGO T-Display ESP32 CP2104 WiFi bluetooth Module 1.14 Inch LCD
Where to buy?


KEPO KPMB-G2212L-K6406 Miniatur Summer
Where to buy?


3.7V 820mAh 1S LiPo Battery or bigger
Where to buy?


I used screws for plastic from SCREWERK


Black steel screw are nicer if the housing is printed with black filament.




Using the PWM signal of the CO2 sensor the following schematics works provided that the inputs of the TTGO are defined accordingly. The UART output can be used as well but is not needed with the SW we are using


The software for the TTGO was developed by Mark and it is written in C. We are working to make the SW publicly available TBD, once it is available the blog will be updated.

TTGO and Arduino IDE

The TTGO can be programmed using the Arduino IDE. The tutorial Installing the ESP32 Board in Arduino IDE shows what needs to be done to use the Arduino IDE to program the ESP32 for - Windows - Linux - Mac OS X

Note, the above solution did not work on MacBook Pro with Catalina , what worked is described in

And comes down to set those commands in a terminal

mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone esp32 --depth 1 && \
cd esp32 && \
git submodule update --init --recursive --depth 1 && \
cd tools && \


The following libraries are needed

TTGO library Copy TFT_eSPI to the <C:User Name> directory

MH Z14 sensor library

BME libraray


uip library

interrupt library

ESP32 not showing serial port after Mac installation

As reported on GitHub there is a problem when using a Mac, I had the same issue and could fix it by installing CP210x USB to UART Bridge VCP Drivers


For attribution, please cite this work as

Sterr (2020, Nov. 27). Uwe's Blog: DIY CO2 meter with elefant. Retrieved from

BibTeX citation

  author = {Sterr, Uwe},
  title = {Uwe's Blog: DIY CO2 meter with elefant},
  url = {},
  year = {2020}