Gravity: Analog Infrared CO2 Sensor For Arduino SKU: SEN0219

From DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot


DFRobot released its latest high-precision analog infrared CO2 sensor. The effectively measuring range is from 0 to 5000ppm. This sensor is based on non-dispersive infrared (NDIR) technology and has good selectivity and oxygen-free dependency. Besides, its service life could up to 5 years! It integrates temperature compensation and support DAC output. Most importantly, the product is easy to use; it is compatible with all types of microcontrollers with ADC function.
In addition, this product is a high-performance sensor that combines technology of mature infrared absorption gas detection with precision optical circuit design as well as sophisticated circuit design. It has characteristics such as high sensitivity, high resolution, low power consumption, fast response, anti-water vapor interference, no poisoning, high stability and long life.
This sensor is able to directly compatible with the DFRobot Arduino IO expansion board thanks to its external DFRobot Gravity interface. This character simplify the use of the sensor as it is plug and play and no need additional wiring.
This product could be widely used in HVAC, indoor air quality monitoring, industrial process and security protection monitoring, agriculture and animal husbandry production process monitoring.


  • Waterproof and anti-corrosion
  • High sensitivity
  • Low power consumption
  • Excellent stability
  • Temperature compensation
  • Excellent linear output
  • High cycle life
  • Anti-water vapor interference
  • No poisoning


  • Gas Detection: Carbon Dioxide (CO2)
  • Operating Voltage: 4.5 ~ 5.5V DC
  • Average Current: <60mA @ 5V
  • Peak Current: 150mA @ 5V
  • Output Signal: Analog output (0.4 ~ 2V)
  • Measuring Range: 0 ~ 5000ppm
  • Accuracy: ± (50ppm + 3% reading)
  • Preheating Time: 3min
  • Response Time: 120s
  • Operating Temperature: 0 ~ 50 ℃
  • Operating Humidity: 0 ~ 95% RH (no condensation)
  • Service Life: >5 years
  • Size: 37mm * 69mm

Board Overview

SEN0219 CO2 Sensor
Num Label Description
1 Signal Analog Output (0.4~2V)
2 VCC VCC (4.5~5.5V)


In this tutorial, we'll show you how to use DFRobot Infrared Sensor within 5 minutes.


Connection Diagram


Data Analysis

When the IR CO2 sensor get 5V power supply, it will output 0.4~2V analog value, corresponding to 0~5000 ppm; And when the sensor finds faults during the self-checking process, it will output 0V.

SEN0219 data.png

Sample Code

 * Infrared CO2 Sensor0-5000ppm 
 * ****************************************************
 * This example The sensors detect CO2
 * @author lg.gang(
 * @version  V1.0
 * @date  2016-7-6
 * GNU Lesser General Public License.
 * See <> for details.
 * All above must be included in any redistribution
 * ****************************************************/
int sensorIn = A0;  

void setup(){  
  // Set the default voltage of the reference voltage

void loop(){ 
  //Read voltage
  int sensorValue = analogRead(sensorIn);  

  // The analog signal is converted to a voltage 
  float voltage = sensorValue*(5000/1024.0); 
  if(voltage == 0)
  else if(voltage < 400)
    int voltage_diference=voltage-400;
    float concentration=voltage_diference*50.0/16.0;
    // Print Voltage
    //Print CO2 concentration

Expected Results

Open your IDE serial monitor and wait for 3 minutes (preheat process), then you'll see the finial data. (Indoor Temperature: 30℃)

SEN0219 Result.jpg


Q. Can I use the CO2 sensor with 3.3V microcontroller?

A. yes, you need to power it with 5V power supply, and change the conversion formula float voltage = sensorValue*(3300/1024.0);

Q. How do I make a Calibration?

A. The sensor should be calibrated regularly. The cycle time is better to be no more than 6 months. Manual calibration of zero point is to calibrate the sensor's HD pin input low level (0V) to calibrate the zero point, and the low level shall last more than 7 seconds.The calibration of zero point is 400 ppm, Please ensure that the sensor is stable for more than 20 minutes at 400ppm.

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

DFshopping car1.png Shopping from Gravity: Analog Infrared CO2 Sensor For Arduino or DFRobot Distributor.