# Canary Recently my partner bought an LCD resin 3D printer. That was kind of the last straw for a risk that has been growing in the last few months. I already had a filament 3D printer (so far just for PLA, but who knows!), and several weeks ago I hooked up a kegerator with a carbonation system. Oh, and all of these share the same airspace as my office. The risk we're concerned about is a buildup of VOCs, carbon dioxide and carbon monoxide. To mitigate this, I wanted to build a device that can sense these things, display their levels on a readout, and potentially make a loud noise if they go over a certain threshold. Are there consumer devices that also do this? possibly. Are there even fancy filter fans that can show you what's in the air on your smartphone? [also yes](https://www.dyson.com/air-treatment/air-purifiers/link-app). But this sounded simple enough to prototype that I could spend a little extra money on the parts and then have fun putting them together. (Also, I couldn't find a consumer-grade device that would measure carbon _dioxide_, so I wanted to start there). The main board I chose for this is the [Adafruit Trinkey QT2040](https://www.adafruit.com/product/5056) ([guide](https://learn.adafruit.com/adafruit-trinkey-qt2040/overview)). I didn't have a lot of criteria to match. I mostly wanted it to be easy to get running, and use I<sup>2</sup>C for the connections. Trinkey is easier than easy. Anything Adafruit makes that works with their [Circuit Python](https://circuitpython.org/) libraries is _very_ approachable, code-wise. And this board is based on the RP2040 chip, which is more than powerful enough to run the code I need. It also happens that Adafruit maintains a hardware spec called "Stemma QT" that transmits I<sup>2</sup>C signals over premade JST PH wires ([youtube intro](https://www.youtube.com/watch?v=6GXRRuFuFy0)). Trinkey has Stemma QT (hence "**QT**2040"), and a lot of the sensor breakout boards that Adafruit makes also use Stemma QT. ![Image: An Adafruit Trinkey RP2040 QT](trinkey.jpeg) The star of the show is the CO<sub>2</sub> sensor: that's an [Adafruit SCD-41](https://www.adafruit.com/product/5190) ([guide](https://learn.adafruit.com/adafruit-scd-40-and-scd-41)) photoacoustic "true" CO2 sensor. It measures temperature, relative humidity, and CO<sub>2</sub> (in parts-per-million). It transmits all of this over I<sup>2</sup>C, using Stemma, once every few seconds. ![Image: An Adafruit SCD-41 sensor package](sensor.jpeg) For an interface, I'm using a [monochrome 0.96" I<sup>2</sup>C OLED Display](https://www.adafruit.com/product/326) ([guide](https://learn.adafruit.com/monochrome-oled-breakouts)) with 128 x 64 pixels. Later I may switch to something like a SHARP Memory display, for low-power use. ![Image: A monochrome 0.96" 128x64 OLED display](display.jpeg) I had a [Pi-Fan](https://www.adafruit.com/product/3368) laying around from a past project, and figured the sensor wouldn't do much good without a continuous supply of new air. ![Image: A DC brushless "pi-fan"](fan.jpeg) Finally, I 3d-printed a frame for all these parts to screw (or hot-glue) onto. The first attempt is always a little kludgy, but I really like it! Without further ado, here's my first take of a CO2 sensor: ![Image: The full CO2 sensor device, powered off](off.jpeg) ![Image: The full CO2 sensor device, powered on](on.jpeg) The code and 3d-printing files are available at https://github.com/spilliams/canary Final Bill of Materials: * (1) [Adafruit Trinkey QT2040](https://www.adafruit.com/product/5056) * (1) [Adafruit SCD-41](https://www.adafruit.com/product/5190) * (1) [monochrome I<sup>2</sup>C OLED Display](https://www.adafruit.com/product/326) * (1) [Pi-fan](https://www.adafruit.com/product/3368) * (3) [JST PH cables (socket-socket)](https://www.adafruit.com/product/4210) * (1) [adapter cable (JST PH socket to breadboard plug)](https://www.adafruit.com/product/4209) * (12) M2.5 screws * PLA filament * hot glue Next time I come back to this, maybe I'll add a speaker and "hush" button, or CO and VOC sensors, or a battery for portable use! - [ ] #homelab #canary and maybe figure out how to get the Canary to report its sensor data to home assistant