Portable C02 Monitor


Skills and assumed supplies

Supplies and costs

Why I choose this to work on

This project is going to be a portable CO2 monitor. The idea behind a CO2 monitor is that we are testing the air quality of a room that we are in for very specific things. One of the issues that has come up with the coronavirus that started in 2019 (also known as covid-19) is that, because the virus is airborne, ventilation and air quality has come to the forefront of things people care about. And if we know that CO2 is air from other people's lungs we can make some calculations as to the likelihood of the amount of covid in a room based off of the CO2 that's in a room.There has been some research into this over the last several years, like this paper, this presentation, or this paper.

Even the US government, who is notoriously slow to update recommendations, is willing to say "This document recommends research into the impacts of CO2 on occupant health, comfort, and performance and on the application of indoor CO2 concentrations in building operation, as well as the development of guidance on the measurement and practical application of CO2 concentrations", and that "Increasing ventilation, for example by opening windows or doors, can also reduce risks from particles resuspended during cleaning, including those potentially carrying SARS-CoV-2 (or other contaminants)"

It is also important to note that air quality is important outside of covid, air quality and specifically CO2 in the air can actually also be something that can affect the ability to concentrate, problem solve, and how sleepy you are. There has been some research that has indicated the level of CO2 in the air can indicate how well a room is ventilated, and while it is true that we cannot detect if covid is in a room what we can detect is how much CO2 is in a room. This has been something that has been researched several times, for example going back to 1996 there was research into this, and currently there is research into c02 and how that can affect concentration in children. There are a lot more studies, this is just to show there are numerous studies available if you would like to do more research into this yourself.

After the industrial Revolution CO2 has actually gone up in the atmosphere in general, so even if we are outside there's actually somewhere around 400-500 parts per million CO2 in the general air, NOAA keeps track of this. It is important to make sure that we take things like that into account and note what is considered good versus bad. Part of the reason that it's important to make a note of this is because if we were looking at this from the outside and we didn't know that there was already a bunch of CO2 in the air from the industrial Revolution and corporations we might think that that's actually really high instead of our low bound.

What we are trying to do with this project is have a way to be able to monitor CO2, but we would like this to be portable, so that it can come with us, and we would like to be able to customize it. One of the reasons that it's good to have this project be portable, run off of a battery, is so that you can bring it with you and make decisions about your personal safety and choose to leave if there is too high a concentration of CO2 and therefore too much air from other people's lungs in the atmosphere. This way you would be able to do things like decide what is too crowded of a room, or what is too crowded of a public space, and if, for example, it makes sense to request that a window is opened, or you to take a walk or request ventilation or something.

Project Basics and Starting Place

This particular project is actually very beginner friendly! Because we are going to be using components from Adafruit and they have well done libraries, well done documentation, and are well known to be a more entry-level, accessible, electronics company.

For this particular project we are going to need a Feather, and OLED featherwing, and a C02 sensor. Now the CO2 monitor is going to be the most expensive part of the project, the monitor is unfortunately almost $60. The reason that we wanted to choose the $60 monitor is because it is a true CO2 monitor( NDIR sensor), and it is not one of the ones that approximates CO2. What a lot of the cheaper CO2 monitors do is they actually measure VOCs in the air and then approximate the CO2 based off of that. And we don't want to do that we want to use a specific true CO2 monitor. This monitor is going to be $60, which is the lowest cost NDIR sensor I could find, which means this entire project is probably going to run you close to 75 to $100 depending on how you choose to do it.

One of the things that's really nice about Adafruit is you can sometimes choose to buy different pieces that are already pre soldered. So if you are not comfortable soldering you can actually buy feathers with headers already soldered on so you don't need to do any soldering. I chose to use a featherwing OLED, however you could absolutely use something like, for example this feather with OLED attached so you don't have to solder anything and it's even more compact. And then what we are actually going to do is use the stemma QT connector to attach the CO2 monitor to the OLED screen (or feather if you got the all in one feather with OLED), this means we actually don't have to solder any connections here either, we just have to buy a Stemma QT connector.

Now for the portable part, we are going to want to buy a Battery, you can also buy batteries on Adafruit. One of the things that I really like about the feather is it actually has a lot of the stuff that you would worry about for overcharging or working with batteries all taken care of on the board so you can actually just plug an adafruit lipoly battery into an adafruit feather and know that they will work together, they will charge together, and they will live happily ever after. I ended up using a battery that should make this run for about 12 hours, you can obviously use a smaller or larger battery as it makes sense for you and your project and your budget. For the battery I have chosen to solder in a switch so that I can turn it on and off easily through the case, however if you do not wish to solder anything that's completely valid as well and you can unplug the battery from the feather when you no longer want the device to be on. I am going to be following this tutorial on how to add a switch to any project with a battery that uses a JST connection.

Project Case

I have chosen to 3D print my case because I happen to have a 3D printer at home, you may or may not have a 3D printer at home, however you probably have access to one through either your school, your work, a local makerspace, or even your local library. I always advocate asking your local library because libraries and librarians are awesome. The case needs to have space for the feather with featherwing, C02 sensor, a battery, and the JST switch. The switch needs to be accessible from the outside, but we'd like the wires hidden. The USB needs to be easily accessible on the feather for charging. And we need to be able to see the featherwing OLED, because we want to be able to read our air quality easily.

All that being said, the case was actually a harder part of this build for me. There are several case options you can pick that are already made, but trying to get a nice case that holds everything well has been a challenge. I am trying to learn some Computer Aided Design (CAD) so that I can design a case, but that's a slow process, so what I'll recommend first instead, is some cases that other people have designed that you could remix, or even just glue together or resize for your project. Option 1 is this set of cases from adafruit, it was designed by people that know what they are doing so they will be easy to print and work well with the feathers, and there are several options for you to mix and match into what you want. Next you'll need a case for the C02 monitor, this one also from Adafruit was designed to be put on a wall, but you could easily attach it to one of the choose your own adventure cases above to make this easier to carry. I will note, when I printed that C02 monitor, the top did not snap fit in for me, it was slightly too small, which means it falls out all the time. I would suggest printing it about a millimeter larger to make it hold better. You could also take something like this SCD-30 lego base plate and attach it to one of the feather cases.

I have worked on a case mode, and it does print well, no supports needed, everything took about 4 hours to print, which isn't bad, but I'm sure could be improved on. For my case modification I've added in some holes for elastics so this piece can be worn on a wrist. I've adjusted the top of the C02 case so that it's a more snug fit to hold up to wearing instead of putting on a wall. I've also made the feather case slightly larger so that the battery can fit with the feather and did a cut out so the wires can fit properly. I choose to use something called "stand offs" which is basically a way to keep electronics projects off a surface, they come in different sizes, different lengths and different colours. I bought these from Amazon, and used the 2M ones, these fit both the feather and the case and gave enough room to put the battery below the feather along with the power switch. The case for the C02 detector was modified from the Adafruit one, you can see my remix here. The feather case I also modified from the Adafruit one, and that remix is here. If you follow the links for my remixes you can also see photos of what the cases look like when printed, and a computer generated version of what they look like as well. Timelapse of the case printing:

Pieces, Assemble!

The assembly for this is very straightforward, if you have chosen to buy pre-soldered pieces you are all set, you can move to the next step. If you have chosen to solder on your own pieces then you need to make a decision here, do you want to solder in the headers to both the feather wing and the feather? Or do you want to permanently solder the featherwing OLED to the feather?

I have chosen to permanently solder the featherwing OLED to the feather because I plan on continuing to use this monitor for a while, and I feel that it is very reasonable to leave the board with this project and if I want another feather, I can go buy another feather. However, if this is not something that you want to do, that's also completely fine, in which case I would recommend that you buy the soldered on headers or the pass-through headers that Adafruit sells. Then you can just click the OLED onto the headers and take it apart as much as possible. The choices and a great tutorial are here from Adafruit so you can see what the choices are and how to set it up.

The featherwing is going to go on to the feather, and then the CO2 monitor is going to get plugged in using the stemma QT connector that you have bought. Either one of the ports on the CO2 monitor is completely fine to use, and then you can plug it into the OLED or feather stemma connector. If you have chosen to use a different screen type of any variety and it does not have a stemma QT connector, you are going to have to go look at the wiring diagram and schematics of the CO2 monitor, and then figure out how you want to add your wires in and connect them.

My feather actually came with circuit python version 5, but Adafruit is at circuit python version 8. Because of the supply shortages I had to buy a feather m0, instead of the m4. The reason that this matters here is because of the amount of memory that is on the feather, my feather m0 was actually unable to run some of the recommended libraries for the OLED and I did not have enough memory to get circuit python working the way that I needed it to work for this. So instead I ended up using the Arduino IDE to write this code. The feather will get plugged in and connected through the arduino, follow these instructions to connect the feather to computer using Arduino IDE, and then upload the code that I have written or you can write your own code. Next we'll talk about the code and libraries I used.

The brains of the operation

I had to install the Adafruit scd30 library and the Adafruit unified sensor library. One thing to note, is as of march 2023 the Adafruit scd-30 library ended up needing some dependencies which Arduino asked if I would like to install as well. I thought I already had those installed, but I didn't and had to indicate that yes, I would like to install the dependencies.

Once the library's are successfully installed in Arduino then you can try taking the code that I have written which was based on other open source projects and libraries and pasting it in.

There are two version of the code so far. Both have been commented extensively so if you want to change anything hopefully it will be easier. The first version is called "c02withOLED_test_AQI.ino" and this one is the basic code that will show all the data on the screen all at once with an emoji to indicate air quality. The emoji scale is commented in the code in case you would like to change it. The print however is pretty small, and on showing it to a couple people they said it was challenging to read. Therefore we have version 2! This version is called "c02withOLEDwithbuttons.ino" which has the "Air Quality Index" and larger emoji as the base screen. Then each button will show you a different value in larger and hopefully easier to read text. Button A is C02 in parts per million (PPM), Button B is Humidity, and Button C is temperature. Because of the slower processor and code logic the button needs to be held down for a second or two not just pressed really quickly. The larger text value will show on the screen for 5 seconds before going back to the air quality emoji.

So if you have copied this code into your Arduino IDE, you now should be able to verify the code, by clicking the little check mark in the upper left hand corner of the IDE, and then you can upload this to your feather using the arrow next to the checkmark. After this has been uploaded to your feather you should be able to see everything working on the OLED screen, I am using a feather m0, a featherwing OLED, and the SCD-30 CO2 monitor. If however you are using any different devices you may have to make some changes to the code to make it to work. The most common change that you might make is choosing a different OLED screen, in which case you may have to do a different library and you may have to call the display.print in a different way. You may also have a differently sized screen in which case you are going to have to go in and change that code as well to match what you have bought. The code has been commented with what each of the sections do so if you would like to take sections of code and work with them using different libraries or different devices you can absolutely do that.

Recommended Upgrades/changes

Ideas for how to save some Money

Cost breakdown with suggested supplies

NOTE: NO affiliate links of any kind are used.
Supply Name Cost Weblink
Adafruit Feather $19.95 https://www.adafruit.com/product/3403
Adafruit c02 monitor $58.95 https://www.adafruit.com/product/48673
Adafruit OLED featherwing $14.95 https://www.adafruit.com/product/4650
Stemma QT connector $0.95 https://www.adafruit.com/product/4210
Adafruit battery $6.95 https://www.adafruit.com/product/3898
Total $101.75