Infineon Team
Published © MIT

CO2 Buddy

USB powered CO2 monitor which helps your mind to stay awake

BeginnerFull instructions provided3 hours679
CO2 Buddy

Things used in this project

Hardware components

XENSIV™ PAS CO2 Shield2Go Board
Infineon XENSIV™ PAS CO2 Shield2Go Board
×1
Seeeduino XIAO (Pre-Soldered)
Seeed Studio Seeeduino XIAO (Pre-Soldered)
×1
LED Ring 5V RGB WS2812B 12LED 50mm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

CO2 Buddy base

base holding the electronic components

CO2 Buddy housing

Housing of the CO2 Buddy

CO2 Buddy ring

transparent ring

CO2 Buddy top

top part of the housing

Schematics

CO2 schematics

Code

CO2 Buddy

Arduino
Arduino code of the project
#include <Arduino.h>
#include <pas-co2-ino.hpp>
#include <Adafruit_NeoPixel.h>

/* 
 * The sensor supports 100KHz and 400KHz. 
 * You hardware setup and pull-ups value will
 * also influence the i2c operation. You can 
 * change this value to 100000 in case of 
 * communication issues.
 */
#define I2C_FREQ_HZ 400000  

#define PIN        6 
#define NUMPIXELS 12 
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

/**
 * Create CO2 object. Unless otherwise specified,
 * using the Wire interface
 */
PASCO2Ino cotwo;
int16_t co2ppm;

void setup()
{
  Serial.begin(9600);
  Serial.println("serial initialized");

  /* Initialize the i2c interface used by the sensor */
  Wire.begin();
  Wire.setClock(I2C_FREQ_HZ);
  
  /* Initialize the LED ring */
   pixels.begin(); // Initialize NeoPixel object
   pixels.fill(pixels.Color(255,255,255), 0, 12);
   pixels.setBrightness(5);
   pixels.show();

  /* Initialize the sensor */
  cotwo.begin();
}

void loop()
{
  /* Trigger a one shot measurement */
  cotwo.startMeasure();
  /*  getCO2() is called until the value is available.  
   *  getCO2() returns 0 when no measurement result is yet available or an error hasoccurred. */
  do {cotwo.getCO2(co2ppm);} while (0 == co2ppm);
  Serial.print("co2 ppm value : ");
  Serial.println(co2ppm);

  pixels.fill(pixels.Color(constrain(map(co2ppm, 800, 1400, 0, 255),0,255),constrain(map(co2ppm, 1400, 2000, 255, 0),0,255),0), 0, 12);
  pixels.show();

  delay(5000);
  
}

PAS CO2 sensor library

Adarfuit Neopixel library

Credits

Infineon Team

Infineon Team

90 projects • 134 followers

Comments