I've just connected a co2 sensor to my RGB keyboard.

The keyboard turns from green to red the worse the co2 concentration in the room gets, reminding me to ventilate the office from time to time.

It's amazing what you can do with just a little Arduino, some C++, Go & MQTT 🤓


It's not hard to build at all. You need a bit of hardware obviously, but everything else I can help with.

@fribbledom Cool and useful!

How expensive is the CO₂ sensor itself?


You can get cheap ones for 5 bucks, but if you want accurate measurements you can spend more than $50 right now. Prices have gone up a lot in 2020 (for obvious reasons, I guess).

For a simple indicator when to air the room you don't need perfect accuracy, though. This can be a $10 build if you already got the keyboard or other controllable RGB gadgets.

Now I'm a bit envious that my ventilation does all that by itself without changing my keyboard color 🙃

@fribbledom are you planning to write about it? I would be interested to know 😁

Also, great stuff!

@fribbledom That's a genius idea! Beats my plan of using keyboard RGB colors for vim modes x)

@fribbledom Awesome! Careful with the CO2 sensors, at least the one I have seems to vary its values wildly. With no better tool to compare with, I don't really trust it.

@fribbledom Just for completeness, here's my "setup", these #esp32 devices are really versatile.


Looks like a CCS811? What's up with the co2 reading tho, 400ppm seems rather unrealistic (it's the lowest value this thing can actually measure).

@fribbledom just looked at the source and indeed, it's the CCS811. I had it in an open window occasionally, that data is a year old so I don't remember what was happening 🙂 but I do remember it "saturating" to 5000ppm often and needing a restart.

@michal AIUI, the problem with the cheap sensors is that they assume they'll get a periodic whiff of 400 ppm to recalibrate themselves with. In real life, that doesn't happen often. The CO₂ in my bedroom has only got down to that sort of level a couple of times this month, at least according to the CDM7160 sensor in my vAir monitor whose readings seem sensible.


@fribbledom I just have one of those clock-sized hygrometers underneath my screen.

Provides a good indication as well, when to open a window. But has the benefit of not requiring any electricity and working while my computer is off ^^

@fribbledom I have a bigger question that no one else has seemed to ask...

But how much of a problem is C02 concentration in your residence? 😯

Like, this is literally something I've never thought about.


You'd be surprised how bad these co2 levels get if you don't air the room regularly, especially the smaller ones.

@fribbledom Yikes. Yet one more thing to worry about. :P

I have always been amazed why more HVAC systems don't have an option to pull air in from the outside, passing it through the air filter first.

@mdm @fribbledom The nice ones use a CO2 sensor (and/or VOC sensor, maybe?) to adjust their fresh air mix automatically.

Before the pandemic hit us, I noticed that the CO2 levels in my new office would ramp up from about 600 ppm when I got there in the morning to about 1000 ppm and then *stay there* until late afternoon. That must have been the HVAC threshold.

(Good air handling systems also use heat recovery or enthalpy recovery countercurrent exchange so that bringing in e.g. cold outside air doesn't mean the heat pumps have to work much harder.)

@mdm @fribbledom It's also not exactly clear what the lowest level of CO2 is that causes problems. You can find sources for anything from 1000 ppm to 5000, with the purported effects being mildly decreased cognitive function along one or more axes. At least one claimed to show that initiative was decreased.

For reference, I found that with two adults sleeping in a bedroom with the door closed, the CO2 could get up to 3000 ppm after about 6 hours (after which my meter stops measuring and starts beeping), and our house is generally in the 800 to 1200 range during the day.

CO2 itself isn't toxic, so nothing to worry about in "regular" environments (unless you're e.g. making wine in huge barrels in your cellar and the CO2 displaces all the breathable air...)
Carbon monoxide (CO) *is* dangerous but only generated by incomplete combustion.

I guess measuring CO2 can be useful as a proxy for oxygen content (if CO2 is at 5-10% and you feel a bit tired, ventilating gets you more oxygen.) -- or just as a reminder to ventilate, instead of humidity.



I should write a blog post really. But feel free to ask away if you have specific questions already, I'm happy to help.

@fribbledom @silkevicious I would check out that blog post. Where does to Go code fit into all this? Keyboard light controller? How does data get from the Arduino to something else? Ethernet shield?


Using Go to control my RGB keyboard:

The Arduino is technically not an Arduino, but an ESP8266 with Wi-Fi on board 😄


@fribbledom what are the thresholds you used? In other words, how bad is bad in a regular office?


People recommend keeping it below 1000ppm. I've configured my system to gradually go from green (<1000ppm) to yellow (~1500ppm) to red (2000ppm).

To keep my room below the recommend 1000ppm, I would have to vent the room every 10 minutes 😅

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!