Infrared_CO2_Sensor_0-50000ppm_SKU__SEN0220-DFRobot

Introduction

DFRobot released its latest wide range infrared CO2 sensor, whose effective range is up to 0~50000ppm. This sensor is based on non-dispersive infrared (NDIR) technology and has good selectivity and oxygen-free dependency. It integrates temperature compensation and support UART communication mode. Most importantly, the product is easy to use and is compatible with all types of microcontrollers with UART port, like Arduino, Raspberry Pi and other microcontrollers. Besides, it has a long service life, up to 5 years! In addition, this UART Infrared CO2 Sensor 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 wide range detection, high sensitivity, high resolution, low power consumption, fast response, anti-water vapor interference, no poisoning, high stability and long life. It can be widely used in HVAC refrigeration and indoor air quality monitoring, industrial process and safety monitoring, agricultural and animal husbandry production process monitoring, etc..

Feature

Specification

Board Overview

SEN0220 CO2 Sensor

Num Label Description
1 RX RX
2 TX TX
3 GND GND
4 VCC VCC
5 Detector connection Detector connection

Tutorial

Upload the code to Arduino Uno, open the serial monitor to check the CO2 concentration.

NOTE: The CO2 concentration during the preheating time in the serial monitor is not accurate, just ignore the result in the first 3 minutes (Preheating Time).

Requirements

Connection Diagram

SEN0220_Connection

Sample Code

/*!
 * @file  SEN0220.ino
 * @brief Infrared CO2 Sensor 0-50000ppm(Wide Range)
 * @n This example is used for detectting CO2 concentration.
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  lg.gang(lg.gang@qq.com)
 * @version  V1.0
 * @date  2016-06-06
 */

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX
unsigned char hexData[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}; //Read the gas density command /Don't change the order

void setup()
{
  Serial.begin(9600);
  while (!Serial) {
  }
  mySerial.begin(9600);
}

void loop()
{
  mySerial.write(hexData, 9);
  delay(500);

  for (int i = 0, j = 0; i < 9; i++)
  {
    if (mySerial.available() > 0)
    {
      long hi, lo, CO2;
      int ch = mySerial.read();

      if (i == 2) {
        hi = ch;    //High concentration
      }
      if (i == 3) {
        lo = ch;    //Low concentration
      }
      if (i == 8) {
        CO2 = hi * 256 + lo; //CO2 concentration
        Serial.print("CO2 concentration: ");
        Serial.print(CO2);
        Serial.println("ppm");
      }
    }
  }
}

Expected Results

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

FAQ

- Some general Arduino Problems/FAQ/Tips
Q I found the output data is always cyclic variation. Why?
A Yes, this is normal for the infrared CO2 sensor, It is using NDIR optical detection principle, the value will be hyperactive. But the finial result is still in the precision range. You can use some filtering algorithm to read the average value.
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents