SKU:U103
UNIT CO2是一颗数字式空气CO2浓度检测单元,内置Sensirion的SCD40
传感器及电源降压电路,采用I2C通信。该单元适用于空气环境条件测量,CO2测量的典型精度为±(50 ppm + 5 %读数),量程范围:400 ppm – 2000 ppm,同时测量环境温度和湿度。
规格 | 参数 |
---|---|
CO2测量范围 | 400 ~ 2000 ppm |
CO2采样精度 | ±(50 ppm + 5% of reading) |
温度范围 | -10 - 60 °C |
湿度范围 | 0 - 95 %RH |
通信协议 | I2C:0x62 |
净重 | 7.54g |
毛重 | 13.13g |
产品尺寸 | 长48mm 宽24mm 高16mm |
包装尺寸 | 长134mm 宽61mm 高16.3mm |
外壳材质 | Plastic ( PC ) |
CO2 Unit | SCL | SDA | 5V | GND |
---|---|---|---|---|
M5Core(PORT A) | GPIO22 | GPIO21 | 5V | GND |
M5Core2(PORT A) | GPIO22 | GPIO21 | 5V | GND |
M5Atom(PORT A) | GPIO32 | GPIO26 | 5V | GND |
M5StickC/Plus(PORT A) | GPIO33 | GPIO32 | 5V | GND |
M5Station(PORT A1,A2) | GPIO33 | GPIO32 | 5V | GND |
Datasheet
#include <Arduino.h>
#include <Wire.h>
// SCD4x
const int16_t SCD_ADDRESS = 0x62;
void setup() {
// check in your settings that the right speed is selected
Serial.begin(115200);
// wait for serial connection from PC
// comment the following line if you'd like the output
// without waiting for the interface being ready
while (!Serial)
;
// output format
Serial.println("CO2(ppm)\tTemperature(degC)\tRelativeHumidity(percent)");
// init I2C
Wire.begin();
// wait until sensors are ready, > 1000 ms according to datasheet
delay(1000);
// start scd measurement in periodic mode, will update every 5 s
Wire.beginTransmission(SCD_ADDRESS);
Wire.write(0x21);
Wire.write(0xb1);
Wire.endTransmission();
// wait for first measurement to be finished
delay(5000);
}
void loop() {
float co2, temperature, humidity;
uint8_t data[12], counter;
// send read data command
Wire.beginTransmission(SCD_ADDRESS);
Wire.write(0xec);
Wire.write(0x05);
Wire.endTransmission();
// read measurement data: 2 bytes co2, 1 byte CRC,
// 2 bytes T, 1 byte CRC, 2 bytes RH, 1 byte CRC,
// 2 bytes sensor status, 1 byte CRC
// stop reading after 12 bytes (not used)
// other data like ASC not included
Wire.requestFrom(SCD_ADDRESS, 12);
counter = 0;
while (Wire.available()) {
data[counter++] = Wire.read();
}
// floating point conversion according to datasheet
co2 = (float)((uint16_t)data[0] << 8 | data[1]);
// convert T in degC
temperature = -45 + 175 * (float)((uint16_t)data[3] << 8 | data[4]) / 65536;
// convert RH in %
humidity = 100 * (float)((uint16_t)data[6] << 8 | data[7]) / 65536;
Serial.print(co2);
Serial.print("\t");
Serial.print(temperature);
Serial.print("\t");
Serial.print(humidity);
Serial.println();
// wait 5 s for next measurement
delay(5000);
}