锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

CCS811空气质量传感器引脚配置_工作原理_示例电路

时间:2023-10-31 17:51:09

CCS811空气质量传感器引脚配置_工作原理_示例电路

锐单 锐单 289 2023-03-28 17:12:43

CCS811空气质量传感器可以测量eCO2(当量CO2)和TVOC(总挥发性有机化合物)密度,广泛应用于空气质量检测、空气净化器、通风系统等诸多领域。

CCS811空气质量传感器采用AMS独特的微热板技术,与传统气体传感器相比,该传感器功耗更低、加热速度更快、体积更小。该器件内部集成的ADC和MCU允许通过IIC收集、计算和返回数据。CCS811支持浓度报警,当浓度超过用户设定的阈值时触发。

此外,CCS811空气质量传感器支持每秒检测、每10s检测、每1分钟检测、每250ms检测、睡眠模式等多种模式。这些模式针对传感器测量期间的低功耗进行了优化,因此CCS811也适用于便携式应用。

注意:芯片在IIC中延长了时钟。因此,它与某些控制器不兼容,例如Raspberry Pi。

CCS811

附:二氧化碳和TVOC对人体的影响:

二氧化碳 (PPM) 对人体的影响 TVOC 浓度 (PPB) 对人体的影响
<500 普通的 <50 普通的
500-1000 有点不舒服 50-750 着急,不舒服
1000-2500 疲劳的 750-6000 抑郁、头痛
2500-5000 不良 >6000 头痛和其他神经问题

规格参

  • 工作电压:3.3V~5.5V
  • 预热时间:<15s
  • IIC 地址:0x5A(默认)/0x5B
  • 工作温度:-40℃~85℃
  • 工作湿度:0ppb~1100ppb
  • 尺寸:16*20mm/0.63*0.79“

规格参数

功能特性

  • 预热时间短
  • 低功耗
  • 高度集成的MCU和ADC
  • IAQ阈值警报

引脚配置

引脚配置

  • Pin1 (VCC):该引脚使用3.3V为电路板供电。
  • Pin2 (GND):GND引脚。
  • Pin3 (SCL):这是通过10K电阻拉至VCC的I2C时钟引脚。
  • Pin4 (SDA):这是I2C数据引脚,通过一个10K电阻连接到VCC。
  • Pin5 (WAKE):这是CO2传感器的唤醒引脚。
  • Pin6 (INT):这是中断o/p引脚。
  • Pin7(RST):复位引脚。
此外, CCS811还有一个Pin8 (ADD),它是一个单一的地址选择位引脚,用于允许选择备用地址,一般情况下不常用。

功能框图

功能框图

时钟特性

时钟特性

电源状态示意图

电源状态示意图

典型应用电路

应用电路

CCS811Arduino连接实例演示

产品预热时间短,一通电即可快速准确读数,可以通过设置环境基线来缩短读取时间(基线的获取和设置方法在下面进行说明)。

注意首次使用时请运行该传感器48小时。

要求

  • 硬件
    • DFRduino ONE R3(或类似)x 1
    • CCS811空气质量传感器 x 1
    • 跳线
  • 软件
    • Arduino IDE开发环境
    • 下载并安装CCS811库和示例(地址:github.com/DFRobot/DFRobot_CCS811,不知道如何安装库,请自行搜索了解)

关于API函数列表

/*** @brief Judge if the data can be read* @return true when the reading is successful, false means it fails to read.*/bool checkDataReady();/*** @brief Set environment parameter* @param temperature Input temperature value, unit: centigrade, range (-40~85℃)* @param humidity Input humidity value, unit: RH, range (0~100)*/void setInTemHum(float temperature, float humidity);/*** @brief Measurement parameter configuration* @param mode: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 1xx: Reserved modes (For future use)* }eCycle_t;* @param thresh:0 for Interrupt mode operates normally; 1 for interrupt mode only asserts the nINT signal (driven low) if the new* @param interrupt:0 for Interrupt generation is disabled; 1 for the nINT signal is asserted (driven low) when a new sample is ready in*/setMeasurementMode(eCycle_t mode, uint8_t thresh = 0, uint8_t interrupt = 0),/*** @brief Get the current carbon dioxide concentration* @return current carbon dioxide concentration, unit:ppm*/uint16_t getCO2PPM();/*** @brief Get current TVOC concentration* @return Return current TVOC concentration, unit: ppb*/uint16_t getTVOCPPB();/***@brief get the current baseline number*@return a Hexadecimal number of the current baseline number*/uint16_t readBaseLine();/***@brief write a baseline number into register*@param a Hexadecimal number get from getBaseLine.ino*/void writeBaseLine(uint16_t baseLine);


连接电路原理图

连接电路原理图

连接电路实物图


连接电路实物图
示例代码

1、获取基线

为什么要得到基线?因为一旦得到它,就可以通过输入基线快速显示传感器预热后的空气质量。否则,在污染空气中启动时,需要很长时间才能正确读取。在运行传感器的第一周,建议每24小时保存一次新基线。运行1周后,每1-28天可保存一次。

注意:

  • 请将其置于空气新鲜的环境中(20分钟或更长时间)以获得基线。
  • 不同的传感器、不同的测量周期有不同的基线。
/*!* @file getBaseLine.ino* @brief Put the module in clear air and work a few minutes, wait for baseline doing not change* @n Experiment phenomenon: get** @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)* @licence The MIT License (MIT)* @author [LuoYufeng](yufeng.luo@dfrobot.com)* @version V0.1* @date 2019-07-19* @get from https://www.dfrobot.com* @url https://github.com/DFRobot/DFRobot_CCS811*/#include "DFRobot_CCS811.h"/** IIC address default 0x5A, the address becomes 0x5B if the ADDR_SEL is soldered.*///DFRobot_CCS811 CCS811(&Wire, /*IIC_ADDRESS=*/0x5A);DFRobot_CCS811 CCS811;void setup(void){Serial.begin(115200);/*Wait for the chip to be initialized completely, and then exit*/while(CCS811.begin() != 0){Serial.println("failed to init chip, please check if the chip connection is fine");delay(1000);}}void loop() {if(CCS811.checkDataReady() == true){/*!* @brief Set baseline* @return baseline in clear air*/Serial.println(CCS811.readBaseLine(), HEX);} else {Serial.println("Data is not ready!");}//delay cannot be less than measurement cycledelay(1000);}
一段时间后,基线达到稳定值。

预期成绩

2、获取数据

给函数输入基线值sensor.writeBaseLine();如果不想设置基线,请在示例程序中禁用该功能。传感器会自动校准基线,但这将是一个相当漫长的过程。函数上传到UNO后,打开串口监视器可以查看二氧化碳浓度和TVOC浓度。

/*!* @file readData.ino* @brief Read the concentration of carbon dioxide and TVOC* @n Experiment phenomenon: read data every 0.5s, and print it out on serial port.** @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)* @licence The MIT License (MIT)* @author [LuoYufeng](yufeng.luo@dfrobot.com)* @version V0.1* @date 2019-07-19* @get from https://www.dfrobot.com* @url https://github.com/DFRobot/DFRobot_CCS811*/#include "DFRobot_CCS811.h"/** IIC address default 0x5A, the address becomes 0x5B if the ADDR_SEL is soldered.*///DFRobot_CCS811 CCS811(&Wire, /*IIC_ADDRESS=*/0x5A);DFRobot_CCS811 CCS811;void setup(void){Serial.begin(115200);/*Wait for the chip to be initialized completely, and then exit*/while(CCS811.begin() != 0){Serial.println("failed to init chip, please check if the chip connection is fine");delay(1000);}}void loop() {if(CCS811.checkDataReady() == true){Serial.print("CO2: ");Serial.print(CCS811.getCO2PPM());Serial.print("ppm, TVOC: ");Serial.print(CCS811.getTVOCPPB());Serial.println("ppb");} else {Serial.println("Data is not ready!");}/*!* @brief Set baseline* @param get from getBaseline.ino*/CCS811.writeBaseLine(0x447B);//delay cannot be less than measurement cycledelay(1000);}
预期成绩如下:

预期成绩

3、浓度报警

将基线值输入函数sensor.writeBaseLine();上传到UNO,当CO2浓度从当前范围(低、中、高)移动到另一个范围(大于50ppm)时,产生中断并打印当前CO2值。

注意:本例需要将传感器的INT引脚连接到主板上相应的中断引脚(示例中选择了UNO的D2)。

AVR系列中断引脚和中断号说明如下:

328主板:Uno、Nano、Mini… Mega2560 32u4主板:Leonardo...
中断引脚 D2, D3 D2、D3、D21、D20、D19、D18 D3、D2、D0、D1、D7
中断号 0, 1 0, 1, 2, 3, 4, 5 0, 1, 2, 3 ,4
/*!* @file setInterrupt.ino* @brief Set interrupt parameter, when CO2 concentration range changes, get an interrupt* @n Experiment phenomenon: read data every 1s, and print it out on serial port.** @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)* @licence The MIT License (MIT)* @author [LuoYufeng](yufeng.luo@dfrobot.com)* @version V1.0* @date 2019-07-13* @get from https://www.dfrobot.com* @url https://github.com/DFRobot/DFRobot_Sensor*/#include "DFRobot_CCS811.h"volatile int8_t GPIO1TRIG = 0;/** IIC address default 0x5A, the address becomes 0x5B if the ADDR_SEL is soldered.*///DFRobot_CCS811 CCS811(&Wire, /*IIC_ADDRESS=*/0x5A);DFRobot_CCS811 CCS811;void setup(void){Serial.begin(115200);/*wait for the chip to be initialized completely, and then exit*/while(CCS811.begin() != 0){Serial.println("failed to init chip, please check if the chip connection is fine");delay(1000);}attachInterrupt(0, interrupt, RISING);/*** @brief Measurement parameter configuration* @param mode: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 1xx: Reserved modes (For future use)* }eCycle_t;* @param thresh:0 for Interrupt mode operates normally; 1 for interrupt mode only asserts the nINT signal (driven low) if the new* @param interrupt:0 for Interrupt generation is disabled; 1 for the nINT signal is asserted (driven low) when a new sample is ready in*/CCS811.setMeasurementMode(CCS811.eCycle_250ms, 1, 1);/*** @brief Set interrupt thresholds* @param lowToMed: interrupt triggered value in range low to middle* @param medToHigh: interrupt triggered value in range middle to high*/CCS811.setThresholds(1500,2500);}void loop() {if(GPIO1TRIG == 1){Serial.println("CO2 range has changed");Serial.print("CO2: ");Serial.print(CCS811.getCO2PPM());Serial.print("ppm, TVOC: ");Serial.print(CCS811.getTVOCPPB());Serial.println("ppb");delay(1000);}GPIO1TRIG = 0;Serial.print("CO2: ");Serial.print(CCS811.getCO2PPM());Serial.print("ppm, TVOC: ");Serial.print(CCS811.getTVOCPPB());Serial.println("ppb");CCS811.writeBaseLine(0x447B);delay(1000);}void interrupt(){GPIO1TRIG = 1;}

预期成绩如下:

预期成绩

封装设计参数

封装设计参数

总结

CCS811是一种超低功率数字气体传感器解决方案,它集成了金属氧化物(MOX)气体传感器,用于检测室内空气质量监测的各种挥发性有机化合物(VOC),并配有微控制器单元(MCU),其中包括模数转换器(ADC)和I²C接口。

CCS811集成了MCU管理传感器驱动程序模式和测量。I²C数字接口大大简化了硬件和软件设计,从而加快了上市时间。CS811支持智能算法来处理原始传感器测量值,以输出等效总VOC(eTVOC)和等效CO2(eCO2)值,其中VOC的主要原因是来自人类。

CCS811支持多种测量模式,这些模式已针对有源传感器测量期间的低功耗进行了优化,并且在便携式应用中支持延长电池寿命的空闲模式。该器件采用2.7mmx4.0mmx1.1mm、0.6mm间距的10引脚LGA封装(封装示意图如上所示)。

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章