A high quality CO2 meter with colour screen and connection with your mobile phone via Bluetooth that you can take it everywhere with you thanks to its rechargeable battery (optional) and know, discreetly and at all timesthe quality of the air you breathe.
Here I bring you the meter CO2 GADGET.
- 1 Material required
- 2 Preparing the Hardware
- 3 Engraving the LILYGO® TTGO T-Display board
- 4 Use of the Gadget CO2 meter
- 5 Sensirion SCD30 Sensor Calibration
- 6 The shopping basket
- 7 Step-by-step video tutorial
- 8 3D printed box
- 9 Cellular Polypropylene (PP) Boxes
- 10 Use with battery
- 11 Advanced version of CO2 Gadget firmware
- 12 Having problems? Meter Frequently Asked Questions
This tutorial is accompanied by a video, which you can find below, with everything explained step by step and in detail for the construction of the CO2 Gadget.
In this tutorial you will see, in a very easy way, how to:
- Preparing the Hardware: Learn how to connect the SCD30 sensor to the TTGO T-Display Board
- Save the firmware in the TTGO T-Display Board
- Display CO2 levels on the TFT colour screen, your computer and on mobile or tablet with the Sensirion MyAmbience App
- Extras: Some tips, tricks and additional information
Below you'll find something I'm sure you'll love: My own extended and improved version of the CO2 Gadget firmware with new interesting features:
- More modes of operation: Bluetooth, WIFI, and maybe ESP-Now
- More sensors supported, including CO2, temperature, humidity and pressure sensors.
- Consumption optimisations for battery use
- Support for more screens
- Sending data via MQTT
- Configuration via website
- Updates via your website
This tutorial is a improved version, with colour display and rechargeable batteryfrom another previously published project: Mobile CO2 meter with ESP32 and Sensirion SCD30 sensor. If you haven't seen it yet, I suggest you watch it now, because it contains basic information:
The built-in display will allow you to display the current CO2 concentration and its level in green, yellow/orange or red colourdepending on whether the CO2 level is good, bad or very bad.
To complete this tutorial, and build your CO2 Gadgetyou will need:
- A TTGO T-Display Board with TFT colour display
- A Sensirion SCD30 Sensor
- A few wires to make the connections
- One rechargeable li-ion battery (optional)
- USB-C cable to connect the TTGO T-Display Board to your computer
Below, in the "Shopping basket" section, I will give you some examples of what you can buy. advice on equipment to buyas well as some useful links to places where you can buy them. at a good price and with guarantees.
Preparing the Hardware
The preparation of the CO2 Gadget hardware is very simple.
I give you two options for mounting: a version in which the sensor and the board are connected by means of small cables and a version in which the sensor and the board are connected by means of small cables and a version in which the sensor and the board are connected by means of small cables. super compact in which sensor and board are bonded together as a single compact block.
For the first version, carefully plug in the TTGO T-Display Board at Sensirion SCD30 Sensor as explained below. Pay attention to each wire so that it goes from the correct pin on the sensor to the correct pin on the board..
You have to connect by means of some wires:
- The VIN pin of the SCD30 to the pin marked 3V on the TTGO board.
- The GND pin of the SCD30 to the pin marked G on the TTGO board.
- SCL pin from SCD30 to pin marked 22 on the TTGO board
- The SDA pin of the SCD30 to the pin marked 21 on the TTGO board.
The aim of this set-up is to achieve a meter as compact as possible.
If you are mounting this version, be sure to save the specific firmware for the "sandwich" model.The pins are different and this firmware version is prepared for this change. You have more information about this below.
Engraving the LILYGO® TTGO T-Display board
Extra-super-fast and easy" form (recommended)
It is very easy to save the firmware on the LILYGO® TTGO T-Display board. You don't have to download or install anything on your PC..
Click the "Install" button, select the port where your board is connected and click "Connect". It's as simple as that, the recording of the ESP32 of the board will be done in a moment without any further complication.
Sandwich version (SDA to pin IO22 and SCL to pin IO21)
Traditional option, using the Arduino IDE
With the Arduino IDE you can make any changes you want before writing the firmware to the ESP32 and adapt it to your tastes, needs and preferences.
You can find the original source code in the repository at Sensirion on GitHub.
Please note, 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, connected by a strip of pins), the SDA and SCL pins are reversed compared to how they are defined in Arduino by default.
Normally on the ESP32 the SDA of the I2C bus should be connected to the IO21 pin and the SCL to the IO22 pin. In the sandwich, it is the other way around: SDA to pin IO22 and SCL to IO21.
For it to work you will need 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 initialisation 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 do not have to make these modifications..
Use of the Gadget CO2 meter
The use of this meter is exactly the same as described in the original tutorial. This tutorial is a improved version, with colour display and rechargeable batteryfrom another previously published project (Mobile CO2 meter with ESP32 and Sensirion SCD30 sensor), with the difference that you can see the CO2 concentration on the colour display.
The CO2 concentration is shown in different colours 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 bit "generous"). in normal times, but now, in times of pandemics, they should be lower.
In the advanced version of the meter you can change these ranges to suit your needs and preferences..
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 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.
The Sensirion SCD30 CO2 sensor is equipped with an automatic calibration system, called by Sensirion Automatic Self-Calibration (ASC), and it works quite well.
It works as follows:
Since the natural CO2 concentration in the atmosphere is about 400 ppm (actually just under 420 ppm on average in 2021), when the ASC is enabled, the sensor assumes that, over a period of approximately 7 days, the minimum CO2 concentration it encounters will be equivalent to 400 ppm..
This means that, in a well-ventilated room, which at some point during the seven-day period has clean air, 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 it implies that:
- You cannot use the automatic calibration if you are going to use the sensor in a greenhouse, for example, as the greenhouse air will never go 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'm showing you in this tutorial has the automatic calibration activated and running by default. Note that, when you build it, you will need to keep the sensor connected and running during seven days in a row (without switching off) to calibrate (or do a manual calibration, as described below).
The Sensirion SCD30 CO2 sensor allows manual calibration so you don't have to wait seven days for it to calibrate automatically, but Sensirion has not implemented this 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 only serves to calibrate the SCD30 sensor to 415 ppm.does the following:
- When you turn it on, it will wait five minutes for the sensor to stabilise, during which time 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, will leave the LED on permanently.
Note: The TTGO T-Display does not have LEDs, although you do not need it for calibration. In addition, in the advanced firmware I am preparing, calibration is done by means of its on-screen menu so you don't need any LEDs.
To install it, click the "Install" button, select the port where your board is connected and click "Connect". It's as simple as that, the recording of the ESP32 will be done in a moment without any further complication.
This programme is extremely simple. If you want to modify it, or see how it works, you have the source code in the eMariete's GitHub.
A word of advice: The SCD30 is very sensitive to draughts. (all NDIR sensors to a greater or lesser extent) so it is important that when taking it outside to calibrate it don't give it too much air. If it is windy where you are going to calibrate, you can even put the meter in a clear plastic bag, not airtight, and push the button through it. If it is already in its box you should have no problem.
The shopping basket
Here are a few tips and links to websites where you can find buy the materials.
Buying the components from these links will ensure that you get exactly the same components as in the tutorial and that everything matches (not all boards, for example, even if they look almost the same and have the same name, have all the pins in the same place or are labelled in the same way) and you will avoid possible fraud or counterfeiting.
Buy the Sensirion SCD30 sensor
You also have the option to buy the sensor on Amazon. It is more expensive, but you will have it at home quickly.
- Model: SCD30
- Name: air quality sensor
Buy the LILYGO® TTGO T-Display
This is the official shop of LILYGO®, the manufacturer of the board, so you have the 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 of buying the plate on Amazon. It is slightly more expensive, but you will have it at home quickly.
- Chipset: ESPRESSIF-ESP32 (Wi-Fi and Bluetooth) LX6 32-bit Xtensa 240MHz single core/dual core microprocessor
- FLASH: QSPI flash 4MB / PSRAM 8MB
- Display: IPS ST7789V 1.14 inch, USB: C-Type
- Working current: approx. 67MA, quiescent current: approx. 350uA
- Modular interface: UART 、 SPI 、 SDIO 、 I2C 、 LED PWM 、 TV PWM 、 I2S 、 IRGPIO 、 ADC capacitor touch sensor pre-amplifier DACLNA preamplifier
Step-by-step video tutorial
In the following video you have step by step instructions for the construction of this CO2 meter to make it very easy for you to assemble it.
Update from the video
If you want to to achieve an even cleaner assemblyThe power supply cable of the sensor can be positioned in this way:
Note that you will have to remove the plastic from the last pin of the strip in order to solder the positive from the inside (I recommend you do this formerly welding the sandwich, it will be much easier for you).
Making these videos takes a lot of work. If you like the video don't forget to like and subscribe to the channel. That will motivate me to keep making more videos like these.
3D printed box
With the idea of the CO2 Gadget being a small and compact meter, which you can take anywhere, ideally you should use a 3D printed box.
Here you have a collection of boxes, specifically designed for CO2 gadgets, to give your project an almost professional result:
Cellular Polypropylene (PP) Boxes
If you don't have access to a 3D printer, you can make a cellular polypropylene (PP) box very easily.
Here is the complete step-by-step tutorial:
Use with battery
The first thing you have to bear in mind, in order to have the right expectations, is that this is not a low power meter, although it can be powered by batteries. so you can easily take it with you wherever you go.
The TTGO T-Display board features built-in battery charger and charge the battery connected to about 300mA (default, but can be changed by replacing a resistor) when connected via USB.
The primary 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, there's nothing to stop you from adding as big a battery as you like and getting much longer battery life.
In the following picture you can see one of the 3D printed case prototypes with an 800mAh battery (or 1000mAh, actually it's an old battery and I don't know exactly how big it is).
If you want to improve autonomy, I suggest that you load the extended and improved version of the firmwarein which I have included several consumption optimisations to improve the autonomy.
In the following image you can see the consumption profile of the meter for 10 seconds:
As you can see, the meter consumes approximately 97mAwhich can be rounded up to 100mA.
This means that we would theoretically have an autonomy of approximately 10 hours of continuous operation with a 1000mAh batteryThe battery life is about 20 hours with a 2000mAh battery and about 35 hours with a 3500mAh 18650 battery. In practice, the battery life will be shorter because the hardware is not particularly optimised and will not be able to squeeze all the power out of the battery.
Please note that, as with any battery-powered device, you must use a battery that has the appropriate protections. At a minimum the battery should have short circuit, overcharge, over-discharge, and over-current protection.
Many batteries include these protections, but if yours does not, you will need to fit a protection plate like this one:
Advanced version of CO2 Gadget firmware
The improved and extended version of the firmware is now available. Be sure to visit the following post, where I introduce it and explain everything about it:
Having problems? Meter Frequently Asked Questions
Although the project is very straightforward, there is always the possibility that you may have a question or a problem.
In this list you will find answers to the most common questions and doubts.
Share this article
Thank you very much for collaborating with the most difficult thing: SHARING IT AND MAKING IT KNOWN. It's no use how hard I can work on these tutorials if people don't get to know them. THANK YOU TO EVERYONE WHO SHARES!
Just below you have buttons that make it easy to share it on Facebook, Twitter, WhatsApp and Telegram.