CO2 Meter TFT Color Display with TTGO T-Display Sensirion SCD30 - The CO2 Gadget

Last modified October 19, 2021

A high quality CO2 meter with color display and connection to your mobile phone via bluetooth that you can take everywhere thanks to its rechargeable battery (optional) and know, discreetly and at all times, the quality of the air you breathe.

Here I bring you the meter CO2 GADGET.

CO2 Gadget and Sensirion MyAmbience App

This tutorial is accompanied by a video, which you can find below, with everything explained step by step and in detail for the constriction of the CO2 Gadget.

In this tutorial you will see, in a very easy way, how to:

  1. Prepare Hardware: Learn How to connect the SCD30 sensor to TTGO T-Display board
  2. Flash the firmware into the TTGO T-Display board
  3. Monitor CO2 levels on the color TFT screen, your computer and on cell phone or tablet by using the Sensirion MyAmbience App
  4. Extras: Some tips, advice and additional information

Also shortly you will find something that I am sure you will love: My own expanded version of the CO2 Gadget firmware with cool new features:

  • More operating modes: Bluetooth, WIFI, and maybe ESP-Now
  • More sensors supported, both CO2 and temperature, humidity and pressure
  • Consumption optimizations for battery use
  • Support for more displays
  • Sending data by MQTT
  • Configuration via web page
  • Updates through a built in web page

Build it now and upgrade later!

This tutorial is a improved version, with color display and rechargeable battery, from another previously published project: CO2 meter on your mobile with ESP32 and Sensirion SCD30 sensor. If you haven't seen it yet, I suggest you watch it now as it contains basic information:

The built-in screen will allow you display the current CO2 concentration and its level in green, yellow / orange or red, depending on whether the CO2 level is good, bad or very bad.

This project is very new and, at the moment, very few people have built it. You can think of it as a "beta phase" project. If you build it please tell me how it went, if it is working well for you or you have found a problem. Your comments at this time are very important to improve it.

If you want to play it safe, with a well-tested CO2 meter with hundreds of user-assembled units, visit the following tutorial:

Needed parts

To complete this tutorial, and build your CO2 Gadget, You will need:

Later, in section "The shopping list" I give you some advice on the material to buy, as well as some useful links to sites where you can buy them at a good price and with guarantees.

Hardware Preparation

The hardware setup for the CO2 Gadget is a breeze.

I give you two options for mounting: a version in which the sensor and the board are connected by means of a few cables and a version super compact in which sensor and board are united as a single compact block.

Wired version

For the first version, carefully connect the TTGO T-Display board to the Sensirion SCD30 Sensor as I explain below. Pay attention to each wire to go from the correct pin on the sensor to the correct pin on the board.

You have to connect using a few cables:

  • The VIN pin of the SCD30 to the pin marked 3V of the TTGO board
  • The GND pin of the SCD30 to the pin marked G of the TTGO board
  • The SCL pin of the SCD30 to pin marked 22 of the TTGO board
  • The SDA pin of the SCD30 to pin marked 21 of the TTGO board
Image for illustrative purposes taken from Sensirion's tutorial on Github

Sandwich version

The objective of this assembly is to get a meter as compact as possible.

The sandwich version of the meter is attached by means of rigid pins or wires. In this way the TTGO T-Display board and the Sensirion SCD30 Sensor form a single block.

If you are mounting this version, be sure to flash the specific firmware for the "sandwich" model, since their pins are different and this version of the firmware is prepared for this change. You have more information about this a little further down.

Flashing the LILYGO® TTGO T-Display Board

"Extra-super-fast and easy" way (recommended)

Burning firmware onto the LILYGO® TTGO T-Display board is super easy. You don't have to download or install anything on your PC.

Press the "Install" button, select the port where you have your board connected and press "Connect". That simple, the flashing of the ESP32 of the board will be done in a moment without further complication.

Normal version (SDA to pin IO21 and SCL to pin IO22)

In preparation (You will have it here shortly).

Sandwich version (SDA to pin IO22 and SCL to pin IO21)

Your browser is not supported! You have to use Windows with Microsoft Edge or Google Chrome to see the button

Traditional option, using the Arduino IDE

With the Arduino IDE you can make the changes you want before flashing the firmware in the ESP32 and adapt it to your tastes, needs and preferences.

You can find the original source code in the repository of Sensirion on GitHub.

Keep in mind, if you are going to burn your own firmware, that in the compact version of the meter (in which the SCD30 sensor and the TTGO T-Display board are mounted together, like a sandwich, joined by a strip of pins), SDA and SCL pins are reversed regarding how they are defined in Arduino by default.

Normally in ESP32 the SDA of the I2C bus must be connected to pin IO21 and the SCL to pin IO22. On the sandwich, it's backwards: SDA to pin IO22 and SCL to IO21.

For it to work you will have to do two modifications:

1. You have to add, right at the beginning of the sketch, the following two lines:

2. You have to modify the initialization of the I2C bus, which is normally Wire.begin () by Wire.begin (I2C_SDA, I2C_SCL), as here:

Remember, If you use cables and connect SDA to pin IO21 and SCL to IO22 you don't have to make these modifications.

Using the CO2 Gadget Meter

The use of this meter is exactly the same as described in the original tutorial, This tutorial is a improved version, with color display and rechargeable battery, from another previously published project (CO2 meter on your mobile with ESP32 and Sensirion SCD30 sensor), with the difference that in this you can see the CO2 concentration on the color screen.

Maybe you are also interested in:  ESP Easy and deep sleep mode (ESP8266 low power)

CO2 concentration is displayed in different colors depending on their concentration:

  • Green up to 1000 ppm
  • Orange from 1000 to 1600 ppm
  • Red from 1600 ppm

These values, for my taste, are more or less correct (a little "generous") in normal times but now, in times of pandemic, they should be lower.

In the advanced version of the meter you can change these ranges to suit your needs and preferences.

If you want to have this basic version but with colors adjusted to this time of pandemic, leave me a comment in the main tutorial post. If there is enough demand I will compile a version with the modified ranges and leave it here for easy installation.

Sensirion SCD30 Sensor Calibration

The Sensirion SCD30 Sensor used in this tutorial must be calibrated, like all sensors.

You can wait seven days, taking it out into the fresh air for a while each day, for the sensor to self-calibrate or you can do a manual calibration (recommended) if you don't want to wait that long.

Automatic calibration

The Sensirion SCD30 CO2 sensor features an automatic calibration system, called by Sensirion Automatic Self-Calibration (ASC), and it works quite well.

Its operation is as follows:

Since the natural CO2 concentration in the atmosphere is approximately 400 ppm (actually slightly less than 420 ppm on average in 2021), when ASC is enabled, the sensor assumes that, over a period of approximately 7 days, the lowest CO2 concentration it finds will be equivalent to 400 ppm.

This means that in a well-ventilated room with clean air at some point in the seven-day period, 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 7-day period will be 400 ppm.

Yes, I have explained the same thing in three different ways but it is necessary to understand it well because that means that:

  • You cannot use automatic calibration if you are going to use the sensor in a greenhouse, for example, since the greenhouse air will never drop below 400 ppm.

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

The CO2 meter that I am showing you in this tutorial has the auto calibration enabled and running by default. Please note that when you build it, you will need to keep the sensor connected and working for seven days in a row (without turning it off) to calibrate (or do a manual calibration, as I indicate below).

Manual calibration

The Sensirion SCD30 CO2 sensor allows manual calibration so you do not have to wait those seven days for it to calibrate automatically but Sensirion has not implemented that possibility in its firmware.

I have prepared a special firmware that is easy to use and install in case you want to calibrate the sensor manually.

This firmware, which it is only used to calibrate the SCD30 sensor at 415 ppm, does the following:

  • When you turn it on, it will wait five minutes for the sensor to stabilize, during which the LED on the board (by default an LED connected to GPIO2) will be flashing every second.
  • After five minutes it will calibrate the sensor and, once calibrated, it will leave the LED on permanently.

Note: The TTGO T-Display does not have an LED, although you don't need it to do the calibration. Soon I will implement in the firmware on-screen calibration status messages.

Press the "Install" button, select the port where you have your board connected and press "Connect". That simple, the flashing of the ESP32 will be done in a moment without further complication.

Your browser is not supported! You have to use Windows with Microsoft Edge or Google Chrome to see the button

This program is extremely simple. If you want to modify it, or see how it works, you have the source code in the eMariete's GitHub.

An advice: The SCD30 is very sensitive to winds and breezes (all NDIR sensors to a greater or lesser extent) so it is important that when taking it outside to calibrate it do not give much air. If there is a certain wind where you are going to calibrate it, you can even put the meter in a transparent plastic bag, not airtight, and press the button through it). If it's already in its box, you shouldn't have a problem.

The shopping list

Here are some tips and links to internet sites where you can buy the materials.

By buying the components in these links you will make sure you have exactly the same components of the tutorial and that everything matches (not all boards, for example, even though they look almost the same and are called the same, have all the pins in the same place or are labeled in the same way).

Buy the Sensirion SCD30 sensor

Sensirion SCD30 Sensor

This is the same AliExpress store where I bought it and it arrived at my home in just 7 days.

Almost all eMariete users have purchased the sensor from this link and received it quickly.

I recommend you buy it here: Sensirion SCD30 Sensor

Buy the LILYGO® TTGO T-Display plate

TTGO T-Display board

This is the official store of LILYGO®, the manufacturer of the board, so you have a guarantee of seriousness and that the board is original.

I recommend you buy it here: TTGO T-Display board

You will see that there are several versions. I recommend that you buy the one that says "4MB CH340K Chip".

You also have the option to buy the board on amazon. It is more expensive but you will have it at home quickly.

ICQUANZX T-Display ESP32 WiFi and Bluetooth Module Development Board for Arduino 1.14 Inch LCD
  • Chipset: ESPRESSIF-ESP32 (Wi-Fi and Bluetooth) LX6 32-bit Xtensa 240MHz single-core / dual-core microprocessor
  • FLASH: QSPI flash 4MB / PSRAM 8MB
  • Screen: IPS ST7789V 1.14 inch, USB: Type-C
  • Working current: about 67MA, quiescent current: about 350uA
  • Modular interface: UART 、 SPI 、 SDIO 、 I2C 、 LED PWM 、 TV PWM 、 I2S 、 IRGPIO 、 ADC sensor capacitor touch sensor pre-amplifier DACLNA

Step-by-step video-tutorial

In the following video you have step-by-step instructions for the construction of this CO2 monitor so that it is very easy for you to assemble it.

Making these videos takes a lot of work. If you like the video, don't forget to "Like" it and subscribe to the channel. That It will motivate me to keep making more videos like these.

3D printed box

With the idea that the CO2 Gadget is a small and compact meter that you can take anywhere, here is one 3d printable box.

You can download the files to print it at Thingiverse.

The box has been designed in Autodesk Tinkercad which makes it very simple to modify so you can adapt it to your tastes and needs. You can find it in this Tinkercad page.

Please note that this box is a very compact design and due to the heat generated by the electronic components, the temperature and humidity data will be wrong,

Maybe you are also interested in:  CO2 monitor with ESP8266 (NodeMCU) and Senseair S8 sensor

Battery use

The first thing you have to keep in mind, to have the correct expectations, is that this it is not an ultra low consumption monitor, although you can power it with batteries to take it with you wherever you want easily.

The TTGO T-Display board has built-in battery charger and will charge the battery connected to about 300mA (by default, although it can be changed by substituting a resistor) when connected via USB.

The main use of this meter is connected to a power supply or charger and the battery is an extra to use it autonomously for a few hours from time to time. Of course, nothing prevents you from putting a battery as big as you want and getting much longer autonomies.

In the next photo you can see one of the 3D printed box prototypes with a 800mAh battery (or 1000mAh, the truth is that it is an old battery and I don't know exactly how much it is).

If you want to improve the autonomy, I suggest you load the expanded and improved version of the firmware (in preparation), in which I have included several consumption optimizations to improve autonomy. The firmware version on this page, which is the "official" version created by Sensirion, does not have any type of consumption optimization.

In the following image you can see the meter's consumption profile for 10 seconds:

Meter consumption profile without optimizations

As you can see, the meter consumes approximately 97mA, which we can round to 100mA.

This means that theoretically we would have an autonomy of approximately 10 hours of continuous operation with a 1000mAh battery, 20 hours with a 2000mAh battery and about 35 hours if we install a 3500mAh 18650 battery. In practice, this autonomy will be less because the hardware is not specially optimized and it will not be able to squeeze all the energy from the battery.

Being such a new design I have not had much time to do consumer tests yet, so I cannot give you real results. As soon as I have time I will do them and put the data here.

All I can tell you at the moment is that with the battery you've seen before, I've been using it several times for about five or six hours (I've never been in a hurry to check how long the battery lasted, I'll do it shortly and I will tell you).

I repeat, these consumptions are using the basic firmware written by Sensirion, without any type of optimization. It is too early to say exactly, but I hope, based on similar previous experiences, that the advanced version of the firmware will have a battery life of at least two to four times more with the same battery and bluetooth on.

You must bear in mind that, as in any battery-powered device, you must use a battery that has the appropriate protections. At a minimum the battery should have protection against short circuits, overcharging, overdischarging, and overcurrent.

Many batteries include these protections but if yours does not have them, you will have to put a protection plate like this:

Battery protection

👉 Battery protection plate on AliExpress

A gift

If you have come this far by reading the article, congratulations! You are interested in the CO2 Gadget and for that reason I am going to give you a gift:

The limited beta version of Advanced Meter.

This version does not differ much from the normal version above (it does not include any of the super cool and exciting things that I have promised you). but it has these three things that are very useful to me (Now with more: see below!):

  • Ranges of colors adapted to which I consider my references in Covid era: Green up to 700 ppm, orange up to 1000 ppm and red from 1000 ppm.
  • Easy calibration: Just press the top button (next to the USB-C port) for more than 3 seconds and the meter will do a forced manual calibration at 415 ppm (make sure to put the sensor outdoors until the reading stabilizes, I usually leave it about 5 minutes, and then press the button for more than three seconds).
  • Battery voltage display: Press the upper button more than 0.5 seconds and less than 3 seconds and you can see the battery voltage on the screen.

Gift news

I've decided to keep adding a few things to this limited beta so you can test them out while I release the full advanced firmware. Below you can see the new features and functionalities:

Gift changelog:

News 10/17/2021

Added on-screen menu to make various changes (only some are functional at the moment). A long press (more than 300ms) on the upper button to enter the menu and a long press on the lower button to exit the menu.

While in the menu, a short press on the button above to scroll up, a short press on the button below scroll down. A long press on the button above to to select, a long press on the button below to get out from the menu.

Functional: Now you can configure your custom color ranges so that the CO2 concentration is displayed in green / orange / red at the levels you want. Make sure that the range for the red color is higher than the range for the orange color, at the moment it is not verified that this is the case.
Functional: Turns automatic calibration on and off CO2 sensor
Functional: Sets the atmospheric pressure to which the sensor is located for automatic compensation.
Functional: Modify the battery reference value so that it more closely matches the actual voltage.

Bugs: It takes one minute for the battery voltage to be displayed after the meter is turned on.

Note: To avoid problems, while testing these options, none of the modified values are permanently stored in the meter. When you restart the meter, the values you have chosen will be lost and the default values will be loaded.

News 10/18/2021

Functional: Implemented the calibration from menu. Now you can calibrate both the fixed value of 400 ppm and any value you want between 400 and 2000 ppm (This option is for advanced use, do not use it if you do not know what you are doing. Its main use is to calibrate the meter using another reference meter).

Functional: Saving preferences in non-volatile memory. Now the following preferences are saved and reloaded at startup, in case of restart or loss of power: Custom calibration value, altitude meters, automatic calibration, orange range, red range.

Enhanced: Reading and displaying the battery. You no longer need to wait a minute to read the battery.

Beta advanced firmware sandwich version (SDA to pin IO22 and SCL to pin IO21):

Your browser is not supported! You have to use Windows with Microsoft Edge or Google Chrome to see the button

Stay tuned, maybe before publishing the article with the advanced firmware and releasing its source code I leave more betas here with more interesting things.

Any problems? Monitor's FAQ

Although the project is very simple, there is always the possibility that you may have a doubt or that some kind of problem may appear.

In the list that you will see below, you have answers to the most common questions and doubts.

Share this article

Thank you very much for collaborating with the most difficult thing: SHARE IT AND MAKE IT KNOWN. It is useless how much I can work on these tutorials if people don't get to know them. THANK YOU SO MUCH TO EVERYONE WHO SHARES!

Just below you have some buttons that will make it easy for you to share it on Facebook, Twitter, WhatsApp and Telegram.


3 thoughts on “Medidor de CO2 Display TFT Color con TTGO T-Display Sensirion SCD30 – El CO2 Gadget”

  1. Hello good.
    I am a first time and I have done this montage. With the firmware of the sandwich the screen was showing the Sensirion logo. The app always shows -45 degrees Celsuis, 0 RH and 0 ppm in C02.
    I have tried with the advanced version. Now the emariete logo appears and then the screen already shows 0ppm in green. The app also shows the same as before.
    I don't know if there is something I could have done wrong ... Ah, I had a hard time finding the right drivers, I think the ones that worked well were the ones on the link on the Chinese page.
    Thank you and congratulations on your work.

    • Hi P.

      It is most likely due to an error in the wiring. It would be convenient to see detailed photos of the assembly, where the connections are well appreciated, to be sure. It is also very important to load the appropriate version of the firmware (normal or sandwich version), depending on the mounting you have done.

      Otherwise, it is best to connect the meter to the computer through the USB port and with a serial monitor see the messages that the meter is getting through the USB port, which are many and indicate step by step what is happening.

      I recommend that you go through the Telegram chat group where it will be much easier to see it:

      We are sure to find the problem right away!

      A greeting.


Leave a Comment