CO2 Gadget: Advanced CO2 Meter

Last modified 1 year

Contents

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 will 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: CO2 Meter with ESP32

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 even easier to mount 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, Bluetooth and ESP-NOW
  • Support for LoRa/LoraWAN in studio (*) (¡participates!)
  • Many popular compatible CO2 sensors: Sensirion SCD30, Sensirion SCD40, Sensirion SCD41, Senseair S8 LP, MH-Z19, Cubic CM1106
  • Various temperature, humidity and atmospheric pressure sensors
  • Temperature display in degrees Celsius or Fahrenheit
  • Support for color TFT LED displays
  • Support of OLED displays
  • Sending data by MQTT
  • Compatible with the free air quality app Sensirion MyAmbience for iOS and Android with real-time visualization, graphs and access to historical data
  • Activation of relays for, for example, automatically start ventilation equipment
  • Output for RGB and Neopixel LEDs (or LED strips) (WS2812B and others)
  • Sending data to home automation systems, and others, through MQTT
  • Receiving remote commands using MQTT
  • Configuration via web page (*)
  • OTA updates through your 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 their taste and 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.

This post is intended for users of CO2 Gadget firmware. For any issue related to its development, questions, problems or requests, please refer to the CO2 Gadget repository at GitHub.

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).

This tutorial was made with a TTGO T-Display board and a sensor Sensirion SCD30 Sensor but you can build your CO2 Gadget using many different sensors, plates and displays, as the OLED I2C display with 128 * 64 pixel SSH1106 driver, which is fully supported, 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.

A nice thing you can do is to contribute your improvements to the CO2 Gadget code so that other users can benefit from them. Did you design a new display screen because you were not satisfied with the ones it came with? Share it!

LoRa and LoRaWAN Support

I have already started with the implementation of the communication protocol. ESP-NOW on CO2 Gadget and there is a request that has a lot to do with... LoRa and LoRaWAN.

Since the Telegram group is up and running, several people have shown interest in having a CO2 meter with data sending via LoRa, and in CO2 Gadget on GitHub there is an open feature request to include it.

If this is your case, I would like you to, please, join us at this conversation on GitHub by clicking here.

Using the CO2 Gadget Meter

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

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

CO2 Gadget: CO2 Meter with TTGO T-Display

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
ESPNOWOFF
Green colorUp to 700 ppm
OrangeUp to 1000 ppm
Red colorFrom 1000 ppm
CO2 Gadget Default Settings

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 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 to) and I am going to tell you about each of them below.

Bluetooth operating mode

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 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 it in some way (load into Excel, for example).

This is a very interesting option if what you want is to have a easy-to-use CO2 meter without the need of sending data to the internet or integration with other systems.

You only have to install the Sensirion MyAmbience App from the official Google or Apple stores (it is free), depending on your device.

Note that on Android devices it is necessary to enable location services and grant the appropriate permissions to the app. This is necessary to allow the app to continuously scan for nearby Bluetooth devices. This is a requirement of the Android operating system for Bluetooth scanning. The application itself does not use your location.

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 the web page generated by the meter.

At http: // ip_del_medidor it shows a web page with the measurements taken by the meter in real time with some graphs representing these measurements. This page is updated every few seconds with the updated measurements without the need to reload the page.

CO2 Gadget website

For the integration of the meter with other systems, you have three URLs (API end points) where you can access 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).

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.

MESP-NOW operating mode

ESP-NOW is a long-range, low-power radio communications protocol.

Its inclusion allows CO2 Gadget to send its data over several hundred meters without the need for additional hardware.

If you want to know more about this protocol, I recommend you to read my article on ESP-NOW and the ESP-NOW Gateway to MQTT

Activation of ventilation equipment (relay outputs)

CO2 Gadget has three outputs that can be used to activate relays or other elements, for example, automatically activate ventilation or air filtering equipment, activate audible or light alarms, etc.

The concentrations at which these outputs are activated are customizable and match those you have configured as orange level and red level, in addition to green.

Both outputs are activated when reaching the level of that color and do not turn off until the CO2 level drops at least 100 ppm below that level (hysteresis = 100ppm).

Hysteresis prevents the connected device from continually turning on and off if the concentration keeps fluctuating around that concentration).

Notifications via RGB LEDs

If you need to have a light indication of the CO2 concentration you can connect an RGB LED (or RGB strips) to CO2 Gadget,

You can even use high power lighting using external relays. Can you imagine large colored spotlights in a disco indicating the level of CO2?

To connect an RGB LED, you will use the same relay outputs plus the green level output, which works slightly differently:

The green level output turns on when the level is below the orange level and turns off when orange turns on (when operating in relay mode green stays on when orange turns on).

Note that you will have to put three resistors, one for each color, to limit the current supplied to each LED and prevent it from burning out (or damaging the board). I recommend you try values of about 330 or 470 ohms. The RGB LEDs to be used must be common cathode.

If you use RGB strips you will have to put external circuitry (some relays may work) as they will probably consume more than what the ESP32 can provide directly (about 60mA per output).

Neopixel LED Notifications (WS2812B)

CO2 Gadget supports notifications via WS2812B addressable color LEDs (also called Neopixel). Their operation in CO2 Gadget is very similar to normal RGB LEDs.

Keep in mind that these LEDs are designed to work with 5V so if you power them by battery you can have problems (I recommend putting a Step up to raise the voltage to 5V). I have done some tests at 3.3V and they worked for me, but I don't guarantee they will in your case.

CO2 meter communication 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 broker and Node-Red, 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.

Sending measurements by MQTT

CO2 Gadget sends CO2, temperature and humidity measurements every time there is an update on the following topics:

  • topic / co2: Sends the CO2 concentration in PPM with the value in the message payload.
  • topic / temp: Sends the current temperature in degrees centigrade with the value in the message payload with two decimal places.
  • topic / humi: Sends the relative humidity with the value in the message payload as a percentage.

Receiving commands via MQTT

In addition to sending data using MQTT, CO2 Gadget is also capable of receiving commands. 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.

Alarm sending by MQTT

CO2 Gadget sends messages via MQTT corresponding to the configured color levels (green, orange, and red).

The messages sent are the following:

  • topic / green: Ships with the text «ON» in the payload when the CO2 concentration is within the configured green range. It will send "OFF" in the payload when the concentration reaches the orange level.
  • topic / orange: Ships with the text «ON» in the payload when the CO2 concentration reaches or exceeds the configured orange range. "OFF" will be sent in the payload when the concentration drops below the orange level ("OFF" is not sent when it turns red).
  • topic / network: Ships with the text «ON» in the payload when the CO2 concentration reaches the red range. "OFF" will be sent in the payload when the concentration falls below that range.

The orange and red messages have a hysteresis of 100 ppm so the "OFF" message is not sent until the CO2 level drops at least 100 ppm below that level. It is foreseen that, in a future version, this hysteresis will be configurable in the menu.

CO2 Gadget: The most advanced and easy to build CO2 meter with ESP32. Don't miss it and take care of your health. Click to Tweet

CO2 Gadget Settings

Current CO2 Gadget Appearance (as of 12/4/22021)

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, although it only has two buttons, the use of the menu is very simple and you will soon have it mastered.

If you have mounted your meter with a plate without buttons, you can connect your own push buttons.

The use of buttons is optional. CO2 Gadget does not need buttons to work. You can configure all options through the USB/serial port as you will see in the next point.

Serial port menu

If you have decided to set up a meter without a display or buttons, no problem. You can use the menu through the serial port, using any terminal program, by using the following keys on the numeric keypad of your computer:

  • 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 am going to explain each one of the options in the configuration menus and I am going to 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 connected) and you can enter other submenus such as: Information, Calibration and Configuration. With the last option, Exit, you can leave 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 firmware loaded 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»
  • DLE Dev: The Bluetooth device code. It will be useful, if you have several meters, to differentiate one from another in the App.
  • 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 "Custom Cal"
  • Back: Returns to the previous menu

The option "Calibrate at custom ppm»Is intended for advanced users. Its main utility is to be able to calibrate the CO2 sensor using another reference CO2 sensor. Not all sensors have this ability.

Setting

In this menu, with several options and submenus, you can configure different CO2 Gadget options.

The available options and submenus are as follows:

  • CO2 Sensor: Options related to the CO2 measurement such as the activation and deactivation of automatic calibration, the colors you want to use for the concentration ranges, humidity or atmospheric pressure compensation, etc.
  • 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
  • Temp Config: Configuration of parameters related to temperature (temperature offset and units of measure)
  • Display Config: Display configuration options
  • Neopixel config: Neopixel LED configuration (WS2812B)
  • Outputs config: Configuration of relay and RGB LED outputs
  • 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

CO2 Sensor

In this menu you can configure everything related to the CO2 sensor installed in CO2 Gadget.

  • Sensor: Here you can select the installed sensor between: Auto (for I2C sensors like the Sensirion SCD30, SCD40 and SCD41), MH-Z19, CM1106 and Senseair S8.
  • Autom. Cal .: ON / OFF: Enables or disables automatic sensor calibration.
  • Comp. Pres .: Sets the pressure in millibars for pressure dependent CO2 concentration compensation.
  • Altitude: Set the height above sea level to perform pressure compensation (if you don't know the atmospheric pressure).
  • Orange: CO2 concentration level in PPM from which you want it to appear on the screen in orange.
  • Red: CO2 level in PPM for the color red.
  • Debug sensors: ON / OFF: Enables the output of additional information from the sensors through the serial port (USB) to help debug the sensors.
CO2 sensor selection

To select the sensor, simply press «Enter» on the «Sensor» option (for example, a long press on the top button of a TTGO T-Display) to access a submenu where you can choose the sensor you have connected to CO2 Gadget.

Scroll between the available sensors (up and down keys or «/» and «+» on the serial terminal) until you select the one you want to choose and press «Enter» to choose it (if you are using the serial console, in this case do not select it by menu number, please).

Remember that sensors with I2C connection (Sensirion SCD30, SCD40 and SCD41) are automatically detected. You just have to choose "Auto" and CO2 Gadget will detect and use it automatically.

Don't forget to save your settings when you're done and satisfied.

BLE Config

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

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

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).
  • Broker IP: It is the IP address of the MQTT broker (server) to which CO2 Gadget must connect.
  • User: User name that will be used for authentication with the MQTT broker.
  • Pass: The authentication key with the MQTT broker.
  • Back: Returns to the previous menu

ESP-NOW Config

This menu allows you to set the options available for using the ESP-NOW radio communications protocol in CO2 Gadget.

  • ESP-NOW Enable [ON/OFF]: Enables or disables the ESP-NOW protocol.
  • TX Time: Allows you to set the interval between sends using ESP-NOW between 10 and 360 seconds.

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 (the moment when the meter shuts down due to lack of voltage or starts to give erroneous measurements due to too low a 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).

Temp Config

Configuration of parameters related to temperature.

  • Temp: Current temperature (always in degrees Celsius)
  • Offset: Temperature offset (always in degrees Celsius) to adjust possible discrepancies in the temperature measurement.
  • Units [Celsius / Fahrenheit]: Allows you to select the units of measurement for the display on the display (only the display on the display, the rest are still in degrees Celsius)

Display Config

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

  • Brightness: Brightness of the screen from 0 (off) to 255 (maximum brightness).
  • Time To Off: Time in seconds without pressing a button for the screen to turn off automatically. Useful to save battery. The display will turn on again by briefly pressing a button. Setting it to 0 deactivates it (screen always on).
  • Off on USB: Allows you to select if you want the screen to turn off when 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.
  • Orient: [Normal / Reversed]: Allows you to rotate the screen 180º. In this way in, for example, a TTGO T-Display board, the USB port and the buttons would be on the left. The functions of the buttons are also reversed so that the operation remains normal (when turned 180º the one that was up will be down and vice versa).
  • Temp: [Show/Hide]: Shows or hides the temperature measurement on the display. Useful when the meter does not have a temperature sensor (or its measurements are not valid).
  • Humidity: [Show/Hide]: Shows or hides the humidity measurement on the display. Useful when the meter does not have a humidity sensor (or its measurements are not valid).
  • Battery: [Show/Hide]: Allows us to choose whether to show or hide the battery data. Useful when the meter has no battery.

Outputs Config

  • Neopix Bright: Allows to choose the brightness of the Neopixel LEDs (WS2812B).
  • Neopixels: Selection of the type of Neopixel used. The available options are NEO_GRB, NEO_RGB and NEO_RGBW (all at 800Khz).
  • GPIO Outputs: You can select whether to connect RGB LEDs or relays to the outputs to adjust their operating mode.
I have decided to build the CO2 Gadget: The most advanced and easy to make CO2 meter with ESP32. Click to Tweet

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 on LILYGO® TTGO T-Display

Version: v0.6.000 created on 23-02-2022 at 13:56:13 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

Optional, clear the memory:

When recording you have the option to select "Erase device", which will first erase the memory of the ESP32 and restore all settings. Recommended when recording CO2-Gadget for the first time.

Easy recording on ESP32 with OLED (OLED I2C display with 128 * 64 pixel SSH1106 driver)

Version: v0.6.000 created on 23-02-2022 at 13:56:03 GMT for ESP32

Normal version with OLED

This version is suitable for boards with an ESP32 and OLED I2C display with 128 * 64 pixel SSH1106 driver with I2C sensor (like SCD30, SCD40 and SCD41) connected in the normal way (without inverting, SDA to GPIO21 pin and SCL to GPIO22 pin) or with serial sensor (like MH-Z19, Senseair S8 and Cubic CM1106).

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

OLED version with OTA

This is also for ESP32 boards with OLED I2C display with 128 * 64 pixel SSH1106 driver. It differs from the previous one in that has support for OTA (Over The Air) updates and does not have bluetooth (In the future it will be possible to use OTA and Bluetooth simultaneously).

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

Optional, clear the memory:

When recording you have the option to select "Erase device", which will first erase the memory of the ESP32 and restore all settings. Recommended when recording CO2-Gadget for the first time.

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.

Pins used by CO2 Gadget (GPIO)

Although you will find detailed pins to use in the building tutorials on the blog, here you have, in a more generic way, the pins used by each CO2 Gadget firmware variant.

VariantDisplayRX / TXI2CUP / DWNGPIO IN GPIO GreenGPIO OrangeGPIO Red GPIO BatteryNeopixel GPIO
TTGO_TDISPLAYTFT 240 × 13513/1221/22 35/0 272532333426
TTGO_TDISPLAY_SANDWICHTFT 240 × 13513/1222/21 35/0 2725323334 26
esp32dev_OLEDSSH1106 128 × 6417/1621/2215/02725323334 26
esp32dev_OLED_OTASSH1106-128 × 6417/1621/2215/02725323334 26
"Pins used by CO2 Gadget"
  • Variant: Name of the firmware variant, or flavor
  • Display: Display supported by variant.
  • RX / TX: Pins (GPIO) used for connection of sensors connected by Serial port
  • I2C: Pins (GPIO) corresponding to the I2C bus for connection of I2C sensors and displays
  • UP / DWN: Pins (GPIO) to which to connect the "Up" and "Down" buttons. They are optional, CO2 Gadget is fully functional with no buttons attached.
  • IN: Pin (GPIO) that supplies an ENABLE signal for switching the sensors on and off.
  • Green GPIO: Pin (GPIO) corresponding to the output before reaching the orange level.
  • GPIO Orange: Pin (GPIO) corresponding to the output when the orange level is reached.
  • GPIO Red: Pin (GPIO) corresponding to the output when the orange level is reached.
  • GPIO Battery: Pin for battery reading. Keep in mind that on most boards the maximum admissible value is 1V or 3.3V, so you will have to put a resistive divider at the input.
  • Neopixel GPIO: Pin to which you must connect the data line of the Neopixel or WS2812B LEDs

Technical support and help

If you encounter any difficulties join the Telegram group or write your question, problem or request in the section CO2 Gadget Issues on GitHub (recommended for inquiries in English).

Do you have problems? Frequently Asked Questions (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 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 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.

❤

This post is intended for users of the CO2 Gadget firmware. For any issue related to your development, if you have any questions, problems or requests, please contact us at CO2 Gadget project repository on GitHub.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 9

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

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

  1. Hello,
    This is an amazing project !
    Sorry If I missed this information, but I was looking for the wiring diagram.
    My plan is to use a MH-Z19C with a TTGO T-display, a BME280 and a WS2812B LED, would this be possible?

    Thanks !

    Reply
  2. Very nice project, hats off to you!

    Got a couple of questions:
    1. The questions in the FAQ on this page cannot be expanded. Nothing happens when I click them. I tried in Edge and Firefox, both normal and inprivate mode. Is it broken?
    Where can I find how to connect a MH-Z19 and a BME280 sensor?

    Reply
    • Hi jr.

      It's a nice sensor.

      Support for PM sensors in CO2 Gadget is planned. I can't include it now as I don't have one of these sensors. If anyone wants to donate a sensor (or make a pull request to include support for it) I'll be more than happy to include it.

      Reply
  3. SCD41 running just fine. On the Comm output, I see this:

    ->[SENS] CO2: 1459 CO2humi: 29.81 CO2temp: 32.04 H: 0.00 T: 0.00
    ->[SENS] CO2: 1458 CO2humi: 29.97 CO2temp: 32.08 H: 0.00 T: 0.00

    What is H: 0.00 T: 0.00? I don't know what to look up since I don't know what it could be.

    Reply
    • Hi Mike.

      CO2 Gadget supports external temperature and humidity sensors (apart from the integrated sensors in the, in you case, SCD41). H: 0.00 T: 0.00 shows data from these external sensors. In your case it's zero because you don't have any connected.

      Reply
  4. Hi,
    I don't understant, I can enable Wifi on my ESP32 with the OLED version firmware. I have this error :

    [WiFi-event] event: 5 - Disconnected from WiFi access point

    I enter my Wifi SSID and the correct password.

    Do you have any ideas ?

    Thanks

    Reply
  5. I used step-up so voltage is stable 5V, but now I don't know when battery is going to die, TTGO is showing 5V all the time. We could use some analog in pin to show real battery voltage, or maybe, use step up only for powering the CO2 sensor and feed TTGO battery voltage?

    Reply
  6. Hi,

    Is it possible to integrate this CO2 project into Home assistant ?

    I know that it is possible to use SCD30 with ESPHome, but it is not possible to manually calibrate the sensor with ESP Home, whereas it is possible with your project.

    Regards

    Reply
    • Hi Romain.

      Yes, it's possible.

      The best option is to integrate it via MQTT as its supported by both, Home Assistant and CO2 Gadget, and it's really powerful and simple to setup and use.

      Reply
  7. Hi Mariete,

    It seems that there is a limit for the length of the wifi password (around 28 caracters). My password is rather long with 37 car and I can't have a wifi connection. Do you confirm this limit. How to overpass it ?
    Anyway, you have done a wonderful job !!!!

    laurent

    Reply
  8. Hey Mariete, nice project and got the waffled version running. I had some issues though on flashing from a MacBook where I moved to Windows laptop it was swifltly flashed. The LiPo battery as well: learned that batteries are not all the same size ...
    Question: to try to extend battery life: can you share the BLE message format? That way I could just read the BLE message into my home automation.

    Regards, Wim

    Reply

Leave a Comment