MH-Z16 이산화탄소 센서

32,340

카테고리:

설명

적외선 CO2 센서로 높은 민감도와 높은 분해능을 가지고 있다.

NDIR(Non-Dispersive Infrared)을 이용하여 공기중의 CO2를 검출한다.

온도센서가 내장되어 있어 온도 보정을 하며, UART로 센서 데이터를 출력한다.

공기 품질모니터링, 농업, 가축 사육장 등에서 사용이 가능.

Specifications

  • Measuring the range of 0-2000 parts per million (PPM)
  • Resolution of 1 PPM 0-2000 parts per million (PPM)
  • Accuracy of 200 PPM
  • A Warm – up time 3 minutes
  • Response Time < 90s
  • Operating temperature 0 to 50℃
  • Operating Humidity 0% ~ 90% RH
  • Storage temperature – 20-60℃
  • Operating Voltage4.5 V to 6 V DC
  • The Current maximum Current of less than 100 ma, the average Current of less than 50 ma
  • Output mode UART

Pin Line

처음 가동시 센서의 예열 시간은 약 180초이다.

Reference

  • 350~450ppm: General outdoor environment
  • 350~1000ppm:The air is fresh and breathing smooth
  • 1000~2000ppm:The air was stagnant and feel asleep
  • 5000ppm:Permissible exposure limit for an 8h work day

DataSheet EN :   MH-Z16_CO2_datasheet_EN.pdf

참조 : http://wiki.seeedstudio.com/Grove-CO2_Sensor/

SourceCode

/*
  This test code is write for Arduino AVR Series(UNO, Leonardo, Mega)
  If you want to use with LinkIt ONE, please connect the module to D0/1 and modify:

  // #include <SoftwareSerial.h>
  // SoftwareSerial s_serial(2, 3);      // TX, RX

  #define sensor Serial1
*/


#include <SoftwareSerial.h>
SoftwareSerial s_serial(2, 3);      // TX, RX

#define sensor s_serial

const unsigned char cmd_get_sensor[] =
{
    0xff, 0x01, 0x86, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x79
};

unsigned char dataRevice[9];
int temperature;
int CO2PPM;

void setup()
{
    sensor.begin(9600);
    Serial.begin(115200);
    Serial.println("get a 'g', begin to read from sensor!");
    Serial.println("********************************************************");
    Serial.println();
}

void loop()
{
    if(dataRecieve())
    {
        Serial.print("Temperature: ");
        Serial.print(temperature);
        Serial.print("  CO2: ");
        Serial.print(CO2PPM);
        Serial.println("");
    }
    delay(1000);
}

bool dataRecieve(void)
{
    byte data[9];
    int i = 0;

    //transmit command data
    for(i=0; i<sizeof(cmd_get_sensor); i++)
    {
        sensor.write(cmd_get_sensor[i]);
    }
    delay(10);
    //begin reveiceing data
    if(sensor.available())
    {
        while(sensor.available())
        {
            for(int i=0;i<9; i++)
            {
                data[i] = sensor.read();
            }
        }
    }

    for(int j=0; j<9; j++)
    {
        Serial.print(data[j]);
        Serial.print(" ");
    }
    Serial.println("");

    if((i != 9) || (1 + (0xFF ^ (byte)(data[1] + data[2] + data[3] + data[4] + data[5] + data[6] + data[7]))) != data[8])
    {
        return false;
    }

    CO2PPM = (int)data[2] * 256 + (int)data[3];
    temperature = (int)data[4] - 40;

    return true;

}

실행화면

센서보정시 Code

// Grove - Co2 Sensor calibration

#include <SoftwareSerial.h>
SoftwareSerial sensor(A5, A4);      // TX, RX


const unsigned char cmd_calibrate[] = 
{
    0xff, 0x87, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2
};

void setup()
{
    sensor.begin(9600);
    Serial.begin(115200);
    Serial.println("begin to calibrate");

    for(int i=0; i<sizeof(cmd_calibrate); i++)
    {
        sensor.write(cmd_calibrate[i]);
    }

    Serial.println("calibrate done");
}

void loop()
{

// nothing to do

상품평

아직 상품평이 없습니다.

“MH-Z16 이산화탄소 센서”의 첫 상품평을 남겨주세요

이메일 주소는 공개되지 않습니다. 필수 항목은 *(으)로 표시합니다