Indoor CO2 Monitor

Indoor CO2 monitoring device  Indoor CO2 monitoring device In this article, the DIY master proposes to consider a portable, self-contained and easy-to-use open source device for monitoring and recording CO2 concentration in air in real time.
In this article, the wizard will try to solve a problem that is both simple and complex: effective signaling of the need for ventilation in closed spaces filled with people. SARS-CoV2, the virus responsible for Covid19, is considered an airborne virus that spreads (among other things) through respiratory aerosols (microscopic droplets that are released as a normal byproduct of breathing). Outdoors or mostly in open areas, the best strategy for dealing with airborne contamination is distance. In closed rooms, respiratory aerosols can travel long distances and disperse evenly throughout the room if given sufficient time. In such conditions, distancing loses some of its effectiveness, and breathable air throughout the room risks becoming a carrier of infection. In principle, this problem is easy to solve: good ventilation in enclosed spaces solves the problem. However, the problem is compounded by the lack of obvious indicators to rely on in order to choose the best ventilation strategy: for a given number of people in a given enclosed space, how often windows or doors should be opened, and for how long.
The wizard suggests using CO2 monitoring as a marker to quantify how much breathable indoor air is potentially contaminated with respiratory aerosols.
Tools and Materials: -Co2 Sensor Detector;
-Adafruit Feather 328P or any similar Arduino compatible microcontroller (Feather M0, M4, 32u4);
-Adafruit Featherwing Adalogger or any separate SPI SD card and I2C RTC board;
– OLED screen I2C 128×32; – Pin headers; – Micro-SD card; – RGB LED 5 mm (with common cathode); – 120 Ohm resistor; -Power Bank (capacity from 1500 mAh); – USB A – Micro-USB ; -Battery CR1220;
-Heat shrink tubes;
-Suitable plastic box;
Step one: theory and a little about the components
Attempting to directly detect the microscopic droplets responsible for air pollution, while technically feasible, would prove to be very difficult and expensive under normal day-to-day conditions. However, given that these aerosols are a direct by-product of the respiration of people in the room, they can be indirectly controlled by another natural product of respiration: carbon dioxide. By dosing carbon dioxide in a room where people live, and comparing this measurement with the background CO2 concentration in the atmosphere (usually around 400 ppm on average), a direct estimate of how much air the occupants have “exhaled” can be obtained. Based on this measurement, ventilation can then be monitored, making it safer for people in enclosed spaces.
The Feather 328P microcontroller mentioned in the materials is the equivalent of an Arduino board adapted to the Feather form factor and powered by a logic voltage of 3.3 V. If size is not an issue (for example, for fixed devices), it can be replaced with any basic Arduino board. A requirement for any replacement board for this project is that the chosen microcontroller can communicate with peripherals via both SPI and I2C, and also have at least one analog input pin connected to the ADC (ideally with range greater than 2V).
Any Arduino-compatible Feather device can be used in place of the 328P listed here, such as Feather M0 board, M4 or 32u4 board, or any other model. .
Featherwings is the equivalent of an Arduino expansion board.
Featherwing OLED is an OLED screen that communicates via I2C. An interesting feature of the specific model recommended here is the presence of three buttons (A, B and C), which are used here to interact with the device interface. They can be easily replaced with checkboxes if required.
The Featherwing Adalogger is a combination of I2C RTC and SPI SD card reader. It is used here to record measurements and their corresponding time and date.
The power supply can be replaced with any type of Micro-USB phone charger when using the device as a stationary device plugged into a wall outlet. Please note that USB power supplies usually come with their own USB A to Micro-USB cable. In most cases, these battery cables have only power wires and cannot be used for programming or data transfer.
Step two: preparing the microcontroller
The very first task is to install the connectors on the microcontroller and two expansion boards. Then, the PCBs can be stacked on top of each other or placed on a breadboard.
Connectors are installed by soldering them into the corresponding mounting holes on each board.
CO2 monitoring device indoors Indoor CO2 monitoring device Indoor CO2 monitoring device Step three: loading the code and testing the boards
Now that the boards are mounted, you need to connect the Micro-USB connector of the microcontroller to the computer using the USB A-Micro-USB cable.
The Adalogger Featherwing has two functions: it controls the micro-SD card and keeps track of the time using a real time clock (RTC). Before uploading the code to the Feather board, you need to set the current time. This only needs to be done once during the life of the battery. For this operation, you need to install a new battery in the Adalogger Featherwing and then download and run the specific code on the Feather board. The code in question can be found in the examples in the Arduino IDE under the RTClib menu. It bears the name of the RTC used, in this case pcf8523. The time will be synchronized with that of the computer.
After initializing the RTC, you can upload the working code to the Feather board.
The code provided here is written for the Arduino IDE. The Arduino IDE language is derived from C/C ++. The code is well commented. It is based on the following libraries, which must first be imported into the Arduino IDE using the Library Manager:
The code can be downloaded from the GitHub repository.
The structure of the code is simple:
When the device is turned on, a two-minute preheat phase begins, during which the LED glows blue.
The file in which the CO2 levels are recorded is created on the micro-SD card. The file name is automatically generated on upload as LOG *****. TXT, where ***** is a unique 5-digit index number that increases over time. This indexing of numbers simplifies the time ordering of files and protects the system from unintentionally overwriting old files when the device is rebooted.
A normal operating cycle then begins, in which the CO2 concentration is measured every two seconds. After a series of five such measurements, the calculated CO2 concentration is calculated as the average of the previous five values. It is then recorded to the micro-SD card along with the date and time and displayed in a similar manner on the OLED screen.
The displayed CO2 concentration is compared with a user-defined threshold. If it exceeds the threshold, the LED turns red, otherwise it turns green.
Then a new measurement cycle starts again.
Between two measurements, the code checks to see if button A is pressed. If pressed, a menu appears on the display that allows the user to increase or decrease the selected threshold in steps of ± 250 ppm using buttons B and C. The default threshold is set at 1000 ppm. , in accordance with the recommendations of several international health organizations.
Indoor CO2 monitoring device Step four: assembly diagram < br> The scheme is quite simple. The boards, as mentioned earlier, are installed on top of each other, the LED and the CO2 sensor are wired.
The LED connects to digital I/O pins 13 (R), 12 (B) and 11 (G), and its common cathode to ground. Other pins could be chosen, but this particular choice was motivated by the need to avoid using pin 10, which already affects the SPI hardware communication between the microcontroller and the Adalogger board. Also, on Feather boards (and most Adafruit boards) pin # 13 is connected to a debug red SMD LED installed on the board itself. With this choice of connection, the red channel of the external RGB LED always simulates the red LED of the board, which is convenient for debugging purposes.
The CO2 sensor is an NDIR CO2 infrared sensor manufactured by Gravity. There are several other models on the market, although most are more expensive. This particular model provides a 0 to 2V analog output. The output is connected to pin A2 on the board. This pin is also used as an analog input, and the instruction in the code activates its 12-bit ADC resolution (compared to the 10-bit ADC of the classic Arduino). The sensor power wires are connected to the USB and ground pins of the Feather board, respectively.
To power the device, you can use a 5V power adapter or a power bank. After the tests, the wizard found that the 2000 mAh battery allows the device to work continuously for just over 24 hours.
Since the main board and expansion boards are stacked on top of each other, there is no direct access to the pins on the board for soldering wires. There are several ways to get around this.
If the Feather board (as in the photo) had long female connectors, then the connections can be easily soldered to the part of the pins that protrudes from the bottom of the board.
Option 2, the Feather board can be soldered to a small perforated board, which then you can easily solder other wires.
Indoor CO2 monitoring device Indoor CO2 monitoring device Indoor CO2 monitoring device Step five : case
Once everything is connected, all you have to do is find a box of the right size, make holes in it where necessary, and finally fix all the electronic components and the power supply.
CO2 monitor devices are ready.
Indoor CO2 monitoring device Indoor CO2 monitoring device  Indoor CO2 monitoring device The device manufactured in this project is small and compact. One of the reasons for this is that the CO2 device is designed for portable use. It is easy to move the device from one room to another. Attaching magnets to the back of the case will allow you to attach it to any metal surface. It is generally recommended to place indoor CO2 sensors at a height of 1 to 1.5 meters, away from doors and windows.


Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button