Seeed
Published © MIT

Indoor Hand-held Co2 Detector (for Covid-19 Purpose)

How do people know there is enough air exchange in their rooms? There is a simple way to make that determined by Seeeduino XIAO.

BeginnerProtip4 hours1,721
Indoor Hand-held Co2 Detector (for Covid-19 Purpose)

Things used in this project

Hardware components

Seeed Studio Xiao
×1
Seeed Studio Seeeduino XIAO Expansion board
×1
Seeed Studio Grove - Carbon dioxide and temperature and humidity sensors
×1
3.7V Lithium Battery
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Multitool, Screwdriver
Multitool, Screwdriver
double-sided glue
M3*60 double-end stud
M3*20 double-end stud
fM2*60 double-end stud
M3 screws (5mm≤length≤10mm)
M2 screws (5mm≤length≤10mm)

Story

Read more

Custom parts and enclosures

Portable hand-held Co2 Detector Laser cutting machine diagram

Code

Arduino CO2 code

C/C++
#include <Arduino.h>
#include <U8x8lib.h> //https://github.com/Seeed-Studio/OLED_Display_128X64/archive/master.zip
#include "SCD30.h" //https://github.com/Seeed-Studio/Seeed_SCD30
#if defined(ARDUINO_ARCH_AVR)
    #pragma message("Defined architecture for ARDUINO_ARCH_AVR.")
    #define SERIAL Serial
#elif defined(ARDUINO_ARCH_SAM)
    #pragma message("Defined architecture for ARDUINO_ARCH_SAM.")
    #define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_SAMD)
    #pragma message("Defined architecture for ARDUINO_ARCH_SAMD.")  
    #define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_STM32F4)
    #pragma message("Defined architecture for ARDUINO_ARCH_STM32F4.")
    #define SERIAL SerialUSB
#else
    #pragma message("Not found any architecture.")
    #define SERIAL Serial
#endif
 U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
 int speakerPin = A3;
// U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // OLEDs without Reset of the Display

void setup(void) {
  u8x8.begin();
  u8x8.setFlipMode(1);   // set number from 1 to 3, the screen word will rotary 180
  Wire.begin();
  scd30.initialize();
  pinMode(speakerPin, OUTPUT);
}
 
void loop(void) {
  u8x8.setFont(u8x8_font_chroma48medium8_r);
  u8x8.setFlipMode(0);//Reverse screen
  u8x8.drawString(0,0,"CO2:");
  u8x8.drawString(0,10,"TEMP:");
  u8x8.drawString(0,20,"HUM:");
  float result[3] = {0};
     if(scd30.isAvailable()){      
       scd30.getCarbonDioxideConcentration(result);
         u8x8.setInverseFont(0);
         float co2 = result[0];
         float temp = result[1];
         float hum = result[2];
         u8x8.setCursor(7, 0);
         u8x8.println(co2);
         u8x8.setCursor(7, 10);
         u8x8.println(temp);
         u8x8.setCursor(7, 20);
         u8x8.println(hum);
            if(co2 > 800){
                u8x8.setInverseFont(1);
                tone(speakerPin, 900, 200);
            }
     }
     delay(10 00);
}

Github file

https://github.com/olikraus/u8g2/wiki/u8x8reference#print

Credits

Seeed

Seeed

102 projects • 168 followers
Seeed R&D Team

Comments