CO2 Gadget: Advanced CO2 Meter

Last modified November 26, 2021

CO2 Gadget is a firmware to create high quality CO2 meters, with optional sensors for metering suspended particles, temperature, humidity, atmospheric pressure and others that will allow you to analyze the quality of the air you breathe.

In this article I am going to introduce and teach you how to install and use the advanced version of CO2 Gadget, the CO2 meter with App for Android and iOS, via Bluetooth, based on the project of the Swedish sensor manufacturer Sensirion, but with several more turns of the screw.

CO2 Gadget is a CO2 meter (and much more) easy to build, easy to flash, and easy to use.

This meter is equal to or easier to build than CO2 Easy (the classical CO2 Meter tutorial that has been in this blog for long time). Perfect for users who just want a meter, without complications, even though they have never had any contact with electronic projects nor are they technically inclined.

Highlights of CO2 Gadget

Among the interesting functionalities implemented, you can find the following features:

  • Real-time display in display, web page and serial port
  • Management and configuration through a convenient on-screen menu
  • Three communication modes: WIFI, ESP-Now (*) and Bluetooth
  • Many popular compatible CO2 sensors: Sensirion SCD30, Sensirion SCD40, Sensirion SCD41, Senseair S8 LP, MH-Z19, Cubic CM1106
  • Support for color TFT LED display
  • Support of OLED display(*)
  • Sending data by MQTT
  • Compatible with the air quality App Sensirion MyAmbiance for iOS and Android with real-time visualization, graphs and access to historical data
  • Sending data to home automation systems, and others, through MQTT
  • Receiving remote commands using MQTT
  • Configuration via web page (*)
  • Updates through its website (*)
  • Local data logger (data logger) charged to the phone by BLE (Bluetooth Low Energy)

(*) indicates a feature soon available

Who is CO2 Gadget for?

The CO2 Gadget meter is aimed at everyone, although if you force me to make distinctions, I will tell you that it is aimed at two types of public:

  • Users who want a quality meter, hassle-free and at a good price
  • Users with technical concerns who want to start from a good base to adapt the operation of the CO2 meter to your liking and your needs.

If you are one of the first, here below you will find all the information you need. If you are a technical user, I anticipate that I am writing a post with information so that you can start playing around but, if you have a certain level, you will not even need it: you have everything you need in the repository of CO2 Gadget on GitHub (you know, technical users only!). CO2 Gadget is Open Source.

What do I need to build the CO2 Gadget meter?

Basically you need three things: a board with the ESP32 chip, a CO2 sensor, and the firmware (the program that makes it work).

You can build your CO2 Gadget using many different sensors and boards, so the choice is huge.

This article is dedicated just to the firmware, so I recommend that you follow one of the tutorials that I have written and that you can find in this blog for building the meter. For instance:

This is a CO2 meter that you can build in less than an hour with only two components and four welds. I can say, without fear of being wrong, that it is the easiest to assemble CO2 meter you will find.

The CO2 Gadget firmware is an easy-to-use firmware, ready to write to an ESP32 board with a single click.

Being a Open Source project, you have at your disposal all its source code so that you can analyze it, modify it, learn from it or do whatever you want with it.

Something very nice you can do is contribute your improvements to the CO2 Gadget code so that other users can benefit from them. Did you design a new display screen because the ones it came with weren't convincing? Share it!

Using the CO2 Gadget Meter

Using the meter couldn't be easier. You just have to turn it on, open the Sensirion MyAmbience App on your mobile and see the values. As simple as that.

Maybe you are also interested in:  The Sensirion SCD41 CO2 sensor (and the SCD40)

If you have mounted one of the versions with a screen, as soon as you turn it on you will be able to see the measurements on the screen, without having to do anything else.

When you turn on the CO2 Gadget for the first time, it will have a default configuration that will consist of:

OPTIONDEFAULT VALUE
BLE (Bluetooth Low Power)ON
WifiOFF
MQTTOFF
Green colorUp to 700 ppm
OrangeUp to 1000 ppm
Red colorFrom 1000 ppm

This means that as soon as you turn on the meter for the first time CO2 Gadget will be ready to display the data on your mobile or tablet without you having to do anything else.

All these default values can be easily changed through the on-screen menu (or via USB) to adapt them to your tastes, preferences or needs. Soon you will also be able to change them through a web page.

CO2 Gadget has many features and options that you can use (if you want) and then I'm going to talk about each of them.

MBluetooth operation ear

The bluetooth operation mode is the meter's default mode.

In this mode, the meter sends its measurements via bluetooth to your mobile (Android or iOS) where an installed App allows you to view the values of these measurements in real time, and consult historical data.

The App also allows you export the historical data, in case you want to use them in some way (load them in Excel, for example).

This is a very interesting option if you want to have a easy-to-use CO2 meter no need to send data to Internet or from integration with other systems.

You just have to install the Sensirion MyAmbience App from the official Google or Apple stores, depending on your device.

MWiF operating modei

This mode allows you to access the meter through a web browser to view measurements in real time.

When the WiFi mode is active it is possible to access two web pages generated by the meter.

The first, at http: // ip_del_metidor, shows a web page with the measurements taken by the meter in real time with some graphs representing these measurements.

CO2 Gadget website

The second, in http: // ip_del_meidor / simple shows a simple table in which we can see the measurements.

On both pages the data is updated in real time without the need to reload the page.

For the integration of the meter with other systems we have three urls (API end points) in which we have access to the measurements in text format:

Last CO2 concentration measurement:

http: // meter_ip / readCO2

Current temperature value:

http: // meter_ip / readTemperature

Current value of relative humidity:

http: // meter_ip / readHumidity  

You should replace "meter_ip" with the meter's IP address on your network. As you will see below, the easiest way to see this address is in the "Information" menu of CO2 Gadget. For instance:

http://192.168.1.201

In order not to have to know the IP and to be able to access by name, CO2 Gadget implements mDNS (also known as Multicast-DNS). In this way you will be able to access the meter by typing its name Host in the address bar of your browser followed by the extension .local, for instance:

http: //CO2-Gadget.local

You can see the Host name on the WiFi setup screen (and also via USB at boot time).

MDNS (Multicast-DNS) support is not available on all computers, it depends on your operating system and its version. If you use Windows and your version does not support mDNS, the quickest and easiest way to make it support it is by installing the Bonjour Printing Services for Windows from Apple.

At the moment the pages shown are very simple but we will be working on them to improve them. If you know HTML and CSS you can help improve them and I will be very grateful (and many more users, I assure you).

In the future you will also be able to see the historical data and configure the meter.

(*) At this time you cannot use the web pages if you have activated the BLE (Bluetooth Low Energy). I hope that soon the web pages will always be available, whether or not you have the BLE activated.

Sending data by MQTT

The support of the MQTT protocol opens a wide horizon of possibilities when it comes to sending the data generated by the meter to other systems, such as, for example, home automation system, store them in a database or view them.

I use it with a Mosquitto and Nodered broker, which allows me to process them, store them in an InfluxDB database and easily visualize and analyze them in Grafana, getting graphs like these:

As you can imagine the MQTT functionality needs a WiFi connection to work.

In addition to sending data using MQTT, CO2 Gadget is also capable of receiving data. Specifically, you can receive the following two commands, which can be very useful:

  • topic / calibration ppm: By sending a message with the topic "topic / calibration" and a number between 400 and 2000 in the Payload (usually 400) we can order CO2 Gadget to perform a sensor calibration at that concentration.
  • topic / ambientpressure mbar: By sending a message with the topic «topic / ambientpressure» and the value of the atmospheric pressure in millibars, we will tell the CO2 sensor to compensate for CO2 concentration by atmospheric pressure.
Maybe you are also interested in:  CO₂ meter with MQ-135 sensor (Don't miss it, it's not what it seems)

CO2 Gadget Settings

The CO2 Gadget meter is very easy to configure via its on-screen menu or serial port (and the web page soon).

On-screen menu

Navigation through the on-screen menu is done using the two buttons on the front of the meter as follows:

  • Short press on the top button = Up
  • Short press on the bottom button = Down
  • Long press on the top button = Enter / select
  • Long press on the bottom button = Back / deselect

You will see that, despite having only two buttons, the use of the menu is very simple and you will quickly have it mastered.

Serial port menu

If you have decided to mount a meter without a screen, no problem. You can use the menu through the serial port, using any terminal program, using the following keys on your computer's numeric keyboard:

  • Tecla / = up
  • Key * = down
  • Key = Enter / select
  • Key + = Back / deselect

In addition, you can directly use the numbers and letters on the keyboard to enter data.

The menu is exactly the same on the screen and on the serial port. What you see in one you will see in another, and also simultaneously.

Next, I will explain each of the options in the configuration menus and I will do it in the same order in which they are shown.

Main menu

In the main menu you can see the battery voltage (or that of the power supply or charger, if it is connected) and you can enter three other sub-menus: Information, Calibration and Configuration. With the last option, Exit, you can exit the menu and return to the main screen with the measured data.

Information

In this menu you have useful information about the meter.

  • Comp: The CO2 Gadget compilation date in MMM DD YYYY format
  • Version: The version number of the CO2 Gadget charger firmware on the meter
  • IP: The meter's IP address, if it is connected to a WiFi network. If the network is disconnected it will appear «Disconnected» and if the WiFi is disabled it will appear «Disabled»
  • Back: Returns to the previous menu

Calibration

Here you can activate and deactivate the automatic calibration of the CO2 sensor as well as perform its manual calibration.

  • Autom. Cal .: Allows you to activate and deactivate (ON / OFF) the automatic calibration of the CO2 sensor
  • Calibrate at 400ppm: By selecting this option with a long press you can calibrate the sensor at 400ppm
  • Custom Cal: Allows you to specify a concentration between 400 and 2000 ppm at which you want to perform the calibration
  • Calibrate at custom: Performs the calibration at the concentration specified in the previous point
  • Back: Returns to the previous menu

Note that the option «Calibrate at custom ppm»Is intended for advanced users and I do not recommend it for inexperienced users. Its main utility is to be able to calibrate the CO2 sensor using another reference CO2 sensor.

Setting

In this menu, with various options and sub-menus, you can configure different CO2 Gadget options.

The options and sub-menus available are the following:

  • BLE Config: Activation and deactivation of BLE (Bluetooth Low Energy) and its settings
  • WIFI Config: Activation and deactivation of WiFi and its settings
  • MQTT Config: Enabling and disabling MQTT and its settings
  • Battery Config: Battery Configuration
  • Brightness 150: Screen brightness level
  • Save preferences: Save the preferences in the NVR (non-volatile memory) so that they are permanent even if you remove the power from the meter
  • Back: Returns to the previous menu

BLE Config

BLE (Bluetooth Low Energy) is the radio communication technology that CO2 Gadget uses to communicate, for example, with your mobile phone.

If you want to view the CO2 Gadget data in the MyAmbience App, you need this option to be turned ON.

Keep in mind after activating or deactivating this option you will have to restart the meter (for example by pressing the reset button) for the changes to take effect.

WIFI Config

In this menu you can activate and deactivate the WiFi. Soon you will also be able to configure its parameters.

  • WiFi Enable: ON / OFF: With this option you can activate and deactivate the WiFi. Interesting if you are not going to use it, for example outside the home, to increase battery life.
  • SSID: You must enter the SSID, the "name", of the access point you want the CO2 Gadget to connect to.
  • Pass: You must enter the key of your WiFi network.
  • Host: The host name or hostname CO2 Gadget on the net

Security / privacy notice: Keep in mind that, today, the cave is visible in this menu. In the future it will be "masked" with asterisks so that it is not visible.

MQTT Config

Here you can configure everything that has to do with CO2 Gadget's MQTT communication.

You have the following options:

  • MQTT Enable: Enables (ON) or disables (OFF) the meter's MQTT communication functionalities.
  • Topic: Topic in which CO2 Gadget will send and receive the messages.
  • Id: The Client Id or Client Identifier that CO2 Gadget will use when connecting to the broker. This identifier must be unique (there must not be more than one device with the same identifier).
  • IP: It is the IP address of the MQTT broker (server) to which CO2 Gadget must connect.
  • Back: Returns to the previous menu
Maybe you are also interested in:  CO2 Meter TFT Color Display with TTGO T-Display Sensirion SCD30 - The CO2 Gadget

Battery Config

In this menu you can configure different aspects related to the battery.

These parameters are a bit technical and you can completely ignore them if you want. They are used to match the voltage displayed on the screen to the actual battery voltage.

  • Battery: Current battery voltage (or external power if connected).
  • Voltage ref: Value of the internal voltage reference.
  • Bat Full (mV): Value in millivolts that matches the battery voltage when it is fully charged.
  • Bat Empty (mV): Minimum value in millivolts when we assume that the battery is completely discharged (at which point the meter turns off or begins to give erroneous measurements due to having too much voltage).
  • Back: Returns to the previous menu

If you do not have a voltmeter, you can do the following calibration, which is very simple and will give you a battery voltage very close to the real one: Connect the meter to a power supply or USB charger and adjust the value of "Voltage ref" so that the Voltage read from the battery read approximately 5.00 volts (on the plates on which I have tested it the value of Voltage ref is about 940mV).

Screen Config

Here you have options related to the CO2 Gadget screen and how it manages it.

  • Brightness: Brightness of the screen.
  • Time To Off: Time in seconds without pressing a button to turn off the screen. Useful to save battery. The display will turn on again by briefly pressing a button. Setting it to 0 deactivates (screen always on).
  • Off on USB: Allows you to indicate if you want the screen to also turn off if the CO2 Gadget is running on external power (USB, for example). In this case it may not be necessary to turn it off to save battery but you may want to turn it off so that the light does not bother you if you have it on the bedside table.

Flashing CO2 Gadget Advanced

Flashing the firmware to the board with the ESP32 is super easy. You don't have to download or install anything on your PC.

Press the button corresponding to the version you want to install, select the port where you have your motherboard connected and press "Connect". That simple, the flashing to the ESP32 board will be done in a moment without further complication with just two clicks.

Easy recording

Version: v0.3.079 created on 11-21-2021 at 09:24:57 GMT for ESP32

Normal version

This version is suitable for LILYGO® TTGO T-Display boards with the sensor mounted with the I2C connections in the normal way (without inverting, SDA to the GPIO21 pin and SCL to the GPIO22 pin).

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

Sandwich version

This version is suitable for LILYGO® TTGO T-Display boards with the sensor mounted with the I2C connections reversed (as in sandwich mounting) with the SDA connected to the GPIO22 pin and SCL connected to the GPIO21 pin

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

Memory Clear Recording

These versions are the same as the previous ones with the difference that before recording the ESP32 erase memory (They do not keep the configuration you had).

Version: v0.3.079 created on 11-21-2021 at 09:24:57 for ESP32
.

Normal version

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

Sandwich version

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

Firmware download (binaries)

The above method is the simplest for recording ESP. If you prefer to record it in another way, here are the ➡ links to CO2 Gadget binaries so you can download them.

Sandwich version Beta-Development

This is a Beta-Development testing version of the sandwich version and it is not intended for general use (I recommend that you use the above unless I have told you in the Telegram group to use this for some reason).

This is the version: v0.3.085-dev created on 11-26-2021 for ESP32
.
Your browser is not supported! You have to use Windows with Microsoft Edge or Google Chrome to see the button

Share this article

Thank you very much for collaborating with the most difficult part of this project: SHARE IT AND MAKE IT KNOWN. It is useless how much I can work on these tutorials and projects 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.

❤

2 thoughts on “CO2 Gadget: Medidor de CO2 avanzado”

Leave a Comment