Published: October 01, 2018, Edited by: Martin Malthe Borch

Sensing CO2 with Arduino

There are many different CO2 sensors available. We are constantly researching sensors and diffrent projects using the sensors. We have collected some of that research in this CO2 and environmental sensor research document. Hackteria also have a project on measuring soil respiration with homebuild DIY-CO2 sensor euipment

Senserion SDC30

Sensor info on sparkfun homepage
Datasheet (preliminary)
Code examples and documentation

Price 30-60 USD
+ Auto calibration
+ Code examples
− Code made for indoor monitoring situations, thus does not give rawdata back for extreme experiments

Setup

Install arduino library "SparkFun SCD30"
_Menu: Sketch / Include library / Manage Libraries
_search for "SparkFun SCD30" pres it and install

find code examples in:
_Menu: File / examples / SCD30 examples

Connecting SCD30 to Arduino
_SCD30 - Arduino
_GND - GND
_VIN - 5V
_RX/SDA - A4
_TX/SCL - A5

Notes

  • The SCD30 has an automatic self-calibration routine. Sensirion recommends 7 days of continuous readings with at least 1 hour a day of ‘fresh air’ for self-calibration to complete. (Practically bring it outside the first night it's running)
  • Sparkfun uses a connection system called QWiiC that is equal to I2C connection system.
Arduino Code
/*
By: Nathan Seidle SparkFun Electronics  
Library: http://librarymanager/All#SparkFun_SCD30  
*/

#include <Wire.h>
#include "SparkFun_SCD30_Arduino_Library.h" 

SCD30 airSensor;

void setup()  
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("SCD30 Example");
  airSensor.begin(); //This will cause readings to occur every two seconds
}

void loop()  
{
  if (airSensor.dataAvailable())
  {
    Serial.print("co2(ppm):");
    Serial.print(airSensor.getCO2());

    Serial.print(" temp(C):");
    Serial.print(airSensor.getTemperature(), 1);

    Serial.print(" humidity(%):");
    Serial.print(airSensor.getHumidity(), 1);

    Serial.println();
  }
  else
    Serial.println("No data");

  delay(1000);
}