Difference between revisions of "KS0457 keyestudio CCS811 Carbon Dioxide Temperature Air Quality Sensor"

From Keyestudio Wiki
Jump to: navigation, search
(Technical Parameters)
(Test Code)
(6 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
<br>
 
<br>
 
== Description ==
 
== Description ==
Keyestudio CCS811 carbon dioxide, temperature air quality sensor mainly uses the CCS811B chip. It is an ultra-low-power miniature digital gas sensor that can detect a wide range of volatile organic compounds (TVOCs), including equivalent carbon dioxide (eCO2) and metal oxide (MOX) levels.<br>
+
 
Equivalent carbon dioxide (eCO2) is measured in the range of 400 to 8192 ppm (parts per million), and various volatile organic compounds (TVOC) ranges from 0 to 1187 ppb (parts per billion).<br>
+
Keyestudio CCS811 carbon dioxide, air quality sensor mainly uses the CCS811 chip. It is an ultra-low-power miniature digital gas sensor that can detect a wide range of volatile organic compounds (TVOCs), including equivalent carbon dioxide (eCO2) and metal oxide (MOX) levels. Equivalent carbon dioxide (eCO2) is measured in the range of 400 to 29206 ppm (parts per million), and various volatile organic compounds (TVOC) ranges from 0 to 32768ppb(parts per billion).
At the same time, the sensor comes with a 10K precision 1% NTC thermistor, which can be used to test the specific temperature in the environment.
+
3mm diameter position hole on sensor contributes to fix on the other device.<br>
In order to fix to other devices, the sensor comes with a positioning hole with a diameter of 3mm.<br>
 
  
 
<br>
 
<br>
 +
 
== Technical Parameters ==
 
== Technical Parameters ==
 +
 
* Working voltage: DC 5V
 
* Working voltage: DC 5V
 
* Working current: 30mA
 
* Working current: 30mA
* Maximum power: 46mW
+
* Maximum power: 60mW
* eCO2 measurement range: 400-8192 ppm
+
* eCO2 measurement range: 400-29206 ppm
* TVOC measurement range: 0 to 1187 ppb
+
* TVOC measurement range: 0 to 32768ppb
* Working temperature: -25 ~ +65℃
 
 
* Interface: 7pin (2.54mm pitch)
 
* Interface: 7pin (2.54mm pitch)
 
* Positioning hole diameter: 3mm   
 
* Positioning hole diameter: 3mm   
* Dimensions: 36mm*20mm*7mm
+
* Dimensions: 30*20mm
 
* Environmental attributes: ROHS
 
* Environmental attributes: ROHS
  
Line 36: Line 36:
 
<br>
 
<br>
 
== Test Code ==
 
== Test Code ==
<span style="color:red"> '''NOTE:'''  <br>
 
1)Before upload the code, should place the necessary library into the libraries folder of Arduino IDE;
 
  
<br>[[File:0457图片4.png|700px|frameless|thumb]]<br> 
+
<span style="color:red">NOTE: 
<br>
+
1.Place the corresponding file in the libraries folder of Arduino IDE before uploading the code.</span>
<span style="color:red"> 2)The code is tested by Arduino IDE 1.8.7 version. Other version may not compatible. </span><br>
+
 
 +
2.We recommend to use arduino 1.8.7 version , other version may be not compatible.</span>
  
 
<pre>
 
<pre>
#include "Adafruit_CCS811.h"
+
#include <CCS811.h>
Adafruit_CCS811 ccs;
 
  
void setup() {
+
/*
  Serial.begin(9600);
+
* IIC address default 0x5A, the address becomes 0x5B if the ADDR_SEL is soldered.
  Serial.println("CCS811 test");
+
*/
 
+
//CCS811 sensor(&Wire, /*IIC_ADDRESS=*/0x5A);
  if(!ccs.begin()){
+
CCS811 sensor;
    Serial.println("Failed to start sensor! Please check your wiring.");
+
 
     while(1);
+
void setup(void)
   }
+
{
   //calibrate temperature sensor
+
    Serial.begin(115200);
  while(!ccs.available());
+
    /*Wait for the chip to be initialized completely, and then exit*/
  float temp = ccs.calculateTemperature();
+
    while(sensor.begin() != 0){
  ccs.setTempOffset(temp - 25.0);
+
        Serial.println("failed to init chip, please check if the chip connection is fine");
 +
        delay(1000);
 +
    }
 +
     /**
 +
    * @brief Set measurement cycle
 +
    * @param cycle:in typedef enum{
 +
    *                  eClosed,      //Idle (Measurements are disabled in this mode)
 +
    *                  eCycle_1s,    //Constant power mode, IAQ measurement every second
 +
    *                  eCycle_10s,   //Pulse heating mode IAQ measurement every 10 seconds
 +
    *                  eCycle_60s,   //Low power pulse heating mode IAQ measurement every 60 seconds
 +
    *                  eCycle_250ms  //Constant power mode, sensor measurement every 250ms
 +
    *                  }eCycle_t;
 +
    */
 +
    sensor.setMeasCycle(sensor.eCycle_250ms);
 
}
 
}
 
 
void loop() {
 
void loop() {
   if(ccs.available()){
+
   delay(1000);
    float temp = ccs.calculateTemperature();
+
     if(sensor.checkDataReady() == true){
     if(!ccs.readData()){
+
        Serial.print("CO2: ");
      Serial.print("CO2: ");
+
        Serial.print(sensor.getCO2PPM());
      Serial.print(ccs.geteCO2());
+
        Serial.print("ppm, TVOC: ");
      Serial.print("ppm, TVOC: ");
+
        Serial.print(sensor.getTVOCPPB());
      Serial.print(ccs.getTVOC());
+
        Serial.println("ppb");
      Serial.print("ppb   Temp:");
+
       
      Serial.println(temp);
+
     } else {
     }
+
        Serial.println("Data is not ready!");
    else{
 
      Serial.println("ERROR!");
 
      while(1);
 
 
     }
 
     }
  }
+
    /*!
  delay(500);
+
    * @brief Set baseline
 +
    * @param get from getBaseline.ino
 +
    */
 +
    sensor.writeBaseLine(0x847B);
 +
    //delay cannot be less than measurement cycle
 +
    //delay(1000);
 
}
 
}
 
</pre>
 
</pre>
  
<br>
+
== Test Result ==
  
== Test Result ==
+
Done uploading the code, open the serial monitor and set the baud rate to 115200. The data will be displayed on serial monitor. It may not correct at the beginning, just wait for a few minutes(up to 20min)until the data is stable.
<br>[[File:0457图片5.png|700px|frameless|thumb]]<br>
+
<br>[[File:0457图片6.png|700px|frameless|thumb]]<br>
  
Done uploading the code, open the serial monitor and set the baud rate to 9600. You will see the monitor window show the data as below.
+
When a person exhales to the sensor, , the data changes obviously, as shown below:
 
<br>[[File:0457图片6.png|700px|frameless|thumb]]<br>   
 
<br>[[File:0457图片6.png|700px|frameless|thumb]]<br>   
 +
  
  
 
<br>
 
<br>
 +
 
==Resource==
 
==Resource==
 
*'''Download all the relevant info from the link:'''<br>
 
*'''Download all the relevant info from the link:'''<br>

Revision as of 12:23, 30 July 2020


Keyestudio CCS811 Carbon Dioxide/ Temperature Air Quality Sensor (Black and Eco-friendly)



Description

Keyestudio CCS811 carbon dioxide, air quality sensor mainly uses the CCS811 chip. It is an ultra-low-power miniature digital gas sensor that can detect a wide range of volatile organic compounds (TVOCs), including equivalent carbon dioxide (eCO2) and metal oxide (MOX) levels. Equivalent carbon dioxide (eCO2) is measured in the range of 400 to 29206 ppm (parts per million), and various volatile organic compounds (TVOC) ranges from 0 to 32768ppb(parts per billion). 3mm diameter position hole on sensor contributes to fix on the other device.


Technical Parameters

  • Working voltage: DC 5V
  • Working current: 30mA
  • Maximum power: 60mW
  • eCO2 measurement range: 400-29206 ppm
  • TVOC measurement range: 0 to 32768ppb
  • Interface: 7pin (2.54mm pitch)
  • Positioning hole diameter: 3mm
  • Dimensions: 30*20mm
  • Environmental attributes: ROHS


PINOUTS


thumb



Connection


thumb


Test Code

NOTE: 1.Place the corresponding file in the libraries folder of Arduino IDE before uploading the code.

2.We recommend to use arduino 1.8.7 version , other version may be not compatible.

#include <CCS811.h>

/*
 * IIC address default 0x5A, the address becomes 0x5B if the ADDR_SEL is soldered.
 */
//CCS811 sensor(&Wire, /*IIC_ADDRESS=*/0x5A);
CCS811 sensor;

void setup(void)
{
    Serial.begin(115200);
    /*Wait for the chip to be initialized completely, and then exit*/
    while(sensor.begin() != 0){
        Serial.println("failed to init chip, please check if the chip connection is fine");
        delay(1000);
    }
    /**
     * @brief Set measurement cycle
     * @param cycle:in typedef enum{
     *                  eClosed,      //Idle (Measurements are disabled in this mode)
     *                  eCycle_1s,    //Constant power mode, IAQ measurement every second
     *                  eCycle_10s,   //Pulse heating mode IAQ measurement every 10 seconds
     *                  eCycle_60s,   //Low power pulse heating mode IAQ measurement every 60 seconds
     *                  eCycle_250ms  //Constant power mode, sensor measurement every 250ms
     *                  }eCycle_t;
     */
    sensor.setMeasCycle(sensor.eCycle_250ms);
}
void loop() {
  delay(1000);
    if(sensor.checkDataReady() == true){
        Serial.print("CO2: ");
        Serial.print(sensor.getCO2PPM());
        Serial.print("ppm, TVOC: ");
        Serial.print(sensor.getTVOCPPB());
        Serial.println("ppb");
        
    } else {
        Serial.println("Data is not ready!");
    }
    /*!
     * @brief Set baseline
     * @param get from getBaseline.ino
     */
    sensor.writeBaseLine(0x847B);
    //delay cannot be less than measurement cycle
    //delay(1000);
}

Test Result

Done uploading the code, open the serial monitor and set the baud rate to 115200. The data will be displayed on serial monitor. It may not correct at the beginning, just wait for a few minutes(up to 20min)until the data is stable.
thumb

When a person exhales to the sensor, , the data changes obviously, as shown below:
thumb



Resource

  • Download all the relevant info from the link:

https://drive.google.com/open?id=1rKBkaN3RpuUP24UWuM1guAe2bhhT6pA9



Buy from

  • [ Official Website]
  • [ Shop on Aliexpress ]