Skip to content
DIY CO2 Carbon Dioxide Detector

DIY CO2 Carbon Dioxide Detector

2020-09-25 18:31

I’ve been playing with the embedded system Arduino these days and found it quite easy to learn, so I decided to build a carbon dioxide detector. The main reason is that I’ve been keeping the windows closed due to PM2.5 and wanted to know if there’s enough oxygen in the room and what kind of fresh air system I should install.

Assembly Materials Used:

Material Price RMB (including shipping)
Arduino Nano Compatible Development Board 15
Logic Level Converter 5.5
DS-CO2-20 Sensor 145
SSD1306 128x64 OLED Display 14
3x7 Double-sided Universal Board 5.14
Wires 4
M2*15 Standoffs 5

For the soldering iron, a DIY one with a T12 tip is sufficient. It costs around 170 RMB and can achieve performance comparable to the original version which costs over 2000.

Circuit Diagram

The sensor communication protocol is 3.3v UART. I used a Level Converter for convenience.

Code

Here is just the simple code for reading sensor values:

#include <SoftwareSerial.h>

#define rxPin 12
#define txPin 11
SoftwareSerial CO2_Serial(rxPin, txPin);
const byte readCO2[] = {0x42, 0x4d, 0xe3, 0x00, 0x00, 0x01, 0x72}; //Command
byte responses[12];

void setup()
{
  CO2_Serial.begin(9600);
}

unsigned int GetCo2()
{
  int valMultiplier = 1;

  while (!CO2_Serial.available())
  {
    CO2_Serial.write(readCO2, 7);
    delay(1000);
  }

  CO2_Serial.setTimeout(2000);
  CO2_Serial.readBytes(responses, 12);

  int high = responses[4];              //high byte
  int low = responses[5];               //low byte
  unsigned int val = high * 256 + low; 
  return val * valMultiplier;
}

void loop()
{
  auto co2 = GetCo2();
  draw_co2(co2);
  delay(1000);
}

For the display part, I used the u8g2 library. To increase rendering speed, I could only render partial areas, so I enabled fullbuffer. As a result, it used up 92% of the memory. Looking at this, it might be better to switch to a different library.

Conclusion

So, back to the original question: is there enough oxygen when the windows are always closed? Here is my experience for one sedentary person in a one-bedroom apartment with poor-quality aluminum alloy windows, about 30 $m^2$:

  • With windows closed, CO2 increases by about 500ppm every 30 minutes, reaching a maximum of around 3000-4000ppm (depending on the test location).
  • With the windows slightly ajar, it can stabilize at around 1000ppm maximum.
  • With both windows and doors slightly open, it can stabilize at around 500ppm (showing the importance of cross-ventilation from north to south).

Every 10,000ppm is equivalent to 1% CO2 concentration.

How much CO2 is harmful to humans? This is scientifically debated. Some experiments found cognitive decline above 1200ppm, while a keyboard typing experiment found no effect even at 5000ppm. Medical advice for life safety suggests not staying in an environment above 10,000ppm for more than 8 hours. Therefore, it can be considered safe to keep windows closed all the time, but it’s better to maintain levels between 1000-2000ppm if possible.

EDIT: I previously suspected that the CO2 max of 3000-4000ppm was due to poor airtightness in the old house. However, testing in a house with newly installed system windows and confirmed airtightness via negative pressure tests yielded the same results.

Since opening the windows a crack has such a noticeable effect, does that mean just installing a wall-mounted fresh air system in each room is sufficient? This could also avoid the complexity of whole-house fresh air systems (ducted systems) with roof piping. If only considering oxygen, yes, it is possible.

Whole-house fresh air systems can typically exchange the entire house’s air 1-2 times per hour, thus removing odors and formaldehyde. Of course, formaldehyde is less of an issue nowadays, often more of a marketing gimmick. However, installation is troublesome; figuring out the ductwork can be a headache, and repairing a broken machine is a daunting thought.

Wall-mounted units have low air exchange rates, short airflow distances, and are only suitable for small rooms. Their heat exchange capability is limited, which can lead to issues with blowing out cold or hot air.

Last edited
hugo-builder
hugo-builder · · 自动翻译 about.md 2... · 248520b
Other contributors
...