Zeven Development

Hydroponics CO2 Monitoring

Build a monitoring system that will track your CO2 levels

Plants use CO2 with photosynthesis. It is essential to growth and development of all plant life. Growing indoors presents the opportunity to introduce extra CO2 to your plants which can lead to huge spikes in growth rates. This monitoring system will take the guess work out of measuring and recording your CO2 levels.


Wiring Diagram


Hydroponics CO2 Monitoring Parts

Qty Part Description Cost
1 IO Expander Bundle. $35.00
1 Sensirion SCD30 CO2 Humidity, and Temperature Sensor. $63.27
1 3/4" x 24" PVC Schedule 40 Pipe. $1.60
2 3/4" Schedule 40 PVC Cap. $0.82

Note: Do not use eCO2 (equivalent CO2) sensors, they do not read CO2 directly but other gases and attempt to extrapolate. They are not accurate and can lead to false readings.

Build your CO2 Sensor

To build a 1-Wire to I2C enclosure, it has been designed to fit exactly into a 3/4" PVC pipe. Cut a 2" length of 3/4" PVC pipe, and drill a 3/16" hole through the center of the 3/4" end caps. Feed the wires through the holes and assemble the parts as shown.


Now compress all the PVC parts together. This will create what I refer to as a 'pill' enclosure because it looks like a giant pill. It's cheap but effective. If you need to make it waterproof you can use silicone to seal the ends where the wires come out.


CO2 Code

The Hydroponics Monitoring System performs five CO2 reads a minute and then does a median filter on the data.

#define CO2_SAMPLES_IN_MIN      5
#define CO2_INTERVAL            (SEC_IN_MIN / CO2_SAMPLES_IN_MIN)
#define MAX_CO2_FAILS           10
const char ONEWIRE_TO_I2C_CO2[] = "i2s4a";   // I2C BUS - CO2 Sensor
const char CO2_SENSOR[] =       "st16;ic0";  // SCD30 CO2 Sensor 100kHz
const char INIT_CO2[] =         "si;sc3,2";  // SCD30 Init; Config measurement interval to 50 sec
  float co2, co2_temp, co2_relative;
  static uint8_t co2_samples = 0;
  static float co2_data[CO2_SAMPLES_IN_MIN];
        // Check for CO2 sensor
        co2 = -1; co2_temp = -1; co2_relative = -1;
        if (SerialCmdNoError(ONEWIRE_TO_I2C_CO2) &&
            SerialCmdDone(CO2_SENSOR)) {
          if (init_co2) {
            if (SerialCmdNoError(INIT_CO2)) {
              init_co2 = false;
              co2_fail = false;
          else {
            if (co2_samples) {
              if (SerialReadFloat(&co2_data[co2_samples]))
              else co2_fail++;
            else co2_fail++;
            if (co2_samples > 2) {
              qsort(co2_data, co2_samples, sizeof(float), comparefloats);
              co2 = co2_data[co2_samples / 2]; // Median Filter
              co2_samples = 0;
              co2_fail = false;
            else {
                if (co2_fail >= MAX_CO2_FAILS) {
                  SerialCmdDone("sc10"); // Soft reset CO2 sensor
                  init_co2 = true;  
                  co2_fail = false;
        else {
          co2 = ERROR_NO_ROM;
          init_co2 = true;
            if (co2 != ERROR_NO_ROM) {
              if (color_temp == ERROR_NO_ROM || clk.tm_min & 1 == 1) {
                Serial.print(C2F(co2_temp), 1);

Monitoring and Display in Grafana


OLED Display


Note: If you have the CO2 and the light sensor connected at the same time, they will alternate on the same line every other minute.

Natural sources of CO2

Do you have pets? Then you have a natural source of CO2. Let them stay in your garage and help your plants grow and healthy air for your pets to breath!

My personal CO2 supply! Kenai (Right), Kadai (Left), and Pickles (Bottom).


For the Complete Garage Hydroponics Solution please see our other projects

Garage Hydroponics
Hydroponics Deep Water Culture Bucket System
Hydroponics Growbed Sensors/Display Module
Hydroponics Chiller
Hydroponics Water/Nutrient Control
Hydroponics Database Management
Hydroponics Germination Control
Hydroponics CO2 Monitoring
Hydroponics Light Monitoring
Hydroponics pH and DO Monitoring

« Previous  Hydroponics Germination Control
Hydroponics Light Monitoring   Next »