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 http://uwesterr.de
11-27-2020

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?

µController

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

Speaker

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

Battery

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

Screws

I used screws for plastic from SCREWERK

M3

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

M2

STP320200050E

Schematic

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



SW

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 https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/mac.md

And comes down to set those commands in a terminal

mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 --depth 1 && \
cd esp32 && \
git submodule update --init --recursive --depth 1 && \
cd tools && \
python get.py 

Libraries

The following libraries are needed

TTGO library

https://github.com/Xinyuan-LilyGO/TTGO-T-Display Copy TFT_eSPI to the <C:User Name> directory

MH Z14 sensor library

https://github.com/tobiasschuerg/MH-Z-CO2-Sensors

BME libraray

https://github.com/finitespace/BME280

SoftwareSerial

https://github.com/PaulStoffregen/SoftwareSerial

uip library

https://github.com/fernandomalmeida/protothreads-arduino

interrupt library

https://github.com/vancegroup-mirrors/avr-libc/blob/master/avr-libc/include/avr/interrupt.h

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

Citation

For attribution, please cite this work as

Sterr (2020, Nov. 27). Uwe's Blog: DIY CO2 meter with elefant. Retrieved from http://uwesterr.de/posts/2020-11-26-diy-co2-meter-with-elfant/

BibTeX citation

@misc{sterr2020diy,
  author = {Sterr, Uwe},
  title = {Uwe's Blog: DIY CO2 meter with elefant},
  url = {http://uwesterr.de/posts/2020-11-26-diy-co2-meter-with-elfant/},
  year = {2020}
}