Skip to content

Latest commit

 

History

History
130 lines (88 loc) · 9.69 KB

README.md

File metadata and controls

130 lines (88 loc) · 9.69 KB

Adanet CO₂ Monitor

The ambient CO₂ level is important for at least three reasons:

  1. Excessive CO₂ can lead to a decline in cognitive ability and sleep quality
  2. CO₂ levels can be used to as a proxy for good ventilation and COVID risk
  3. You can monitor climate change in real time!

The Wirecutter-recommended CO₂ monitor for personal use is the Aranet4, and if you're just looking for something reliable and can afford it ($250 as of writing), stop reading and go buy one of those (or for a slightly cheaper option, one of these).


Still here? Congratulations on not taking the coward's way out. Now let's build a thing!

The Adanet CO₂ Monitor has the following features:

  • CO₂ (ppm), temperature (°C), relative humidity (%), battery life (%), and pressure (hPa) sensing
  • "Tri-color" E Ink screen (black, red, and white I guess?)
  • Long-ish battery life (~several weeks on a single charge)
  • USB-C charging (and programming!) interface
  • Built-in Wi-Fi and Bluetooth for feature expansion (currently disabled in software)

adanet-co2-monitor

BOM

Most of the COTS parts are from Adafruit (hence the "Ada" prefix), but can be sourced through any of their distributors (and/or substituted for equivalents, but YMMV). Here's a snapshot of the current BOM and pricing from Octopart:

Qty MPN Part Description Unit Price Batch Total
1 5477 Adafruit Esp32-S3 Feather With 4Mb Flash 2Mb Psram - Stemma Qt / Qwiic 17.5 17.5
1 4814 Adafruit 2.13 Hd Tri-Color Eink / Epaper Display Featherwing - 250X122 Rw Panel With Ssd1680 24.95 24.95
1 5187 Adafruit SCD-40 - True CO2 Temperature and Humidity Sensor 49.5 49.5
1 4494 Adafruit DPS310 Precision Barometric Pressure/Altitude Sensor - STEMMA QT/Qwiic 6.95 6.95
1 2011 Lithium Ion Battery - 3.7V 2000mAh 12.5 12.5
2 4399 STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long 0.95 1.9
113.30

(Note that the SCD-41 can be used as a drop-in replacement.)

In addition, you'll need several fasteners. Most come in the Adafruit 3299 kit, but this is overkill (only 20 out of the 380 pieces are used), so you may have better luck at a hardware store or on Amazon. Either way, you'll need:

Qty Part Description Material
8 M2.5 Hex Nut Nylon
8 M2.5 x 6mm Screw Nylon
4 M2.5 x 6mm M-F Hex Standoff Nylon
4 M2.6 x 5mm Self-Tapping Screw Steel

I also bought the self-tapping screws in a kit, but there are other options too.

Finally, you'll need to 3D print the "top" and "bottom" pieces. If you don't have a 3D printer, either ask someone who does (these are relatively easy parts), visit to a local maker space (maybe even your library?), or use a service like (3D)Hubs. (Note: I recommend printing the "top" upside down, both to get a smooth finish on the outside and to avoid unnecessary overhangs.)

If you want to modify the design or are just curious, the parametric model is available at OnShape.

adanet-case

Assembly

First assemble the top and bottom of the case separately:

Top

  1. Attach the Feather board to the FeatherWing display as shown here (under "FeatherWing Connection")
  2. Screw the assembly into the underside using 4 M2.5 x 6mm screws and 4 M2.5 hex nuts. Make sure that the flexible PCB on the FeatherWing (on the right in the image below) fits into the rectangular slot!

adanet-assembly-top

Bottom

  1. Use 4 M2.5 x 6mm screws to attach the 4 M2.5 x 6mm M-F hex standoffs to the inside of the case (using the holes that border the the sensor slot)
  2. Attach the 4-pin STEMMA QT cables to either side of the SCD4x board
  3. Press the SCD4x board onto the four exposed standoffs, with the sensor facing "out" of the case, and use 2 M2.5 hex nuts to secure to the bottom two standoffs
  4. Connect the DPS310 to the 4-pin STEMMA QT cable on the "right" (when facing the non-sensor side) of the SCD4x board
  5. Use 2 M2.5 hex nuts to attach the DPS310 to the top two standoffs, back-to-back with the SCD4x so that the sensor is facing "in" (note: first apply Kapton/electrical tape to the back of the DPS310 to avoid shorting to the SCD4x)
  6. Carefully insert the battery, which should fit snugly lengthwise, and adjacent to the bottom standoffs holding the SCD4x (note: you can use double-sided tape securely affix the battery to the case)

adanet-assembly-bottom

Once both the top and bottom are assembled, connect the remaining 4-pin STEMMA QT and battery to the Feather board (middle and side connectors respectively). Close the lid to ensure a good fit, but don't install the 4 M2.3 x 5mm self-tapping screws until loading the firmware (as the BOOT/DFU and Reset buttons are not externally accessible)!

Once complete, your final assembly should look like this:

adanet-assembled

Firmware

The Arduino firmware (adanet-co2-monitor.ino) has been tested using the following software (and corresponding versions):

  • Arduino IDE (v1.8.19 or v2.0.0)
  • Adafruit DPS310 (v1.1.1)
  • Adafruit EPD (v4.5.0)
  • Adafruit LC709203F (v1.3.1)
  • ESP32 Arduino (v2.0.5)
  • Sensirion I2C SCD4x (v0.3.1)

Development environment

To prepare your development environment:

  1. Install Arduino IDE (and optionally the VS Code extension)
  2. Follow these instructions to install the ESP32 Arduino library
  3. Using the Library Manager (Tools/Manage Libraries...), install the remaining libraries listed above
  4. Under Tools/Board (or Arduino: Board Config), select the "Adafruit Feather ESP32-S3 2MB PSRAM" option
  5. In the same menu, change "USB Mode" to "Hardware CDC and JTAG" (see here) and "Upload Mode" to "UART0/Hardware CDC"
  6. Plug in your Feather using the USB-C connector, and set the Port to match the one assigned by your OS (e.g. COM5 on Windows, /dev/ttyACM0 on Linux)

Loading firmware

To load the firmware on the device:

  1. Clone this repository somewhere sensible (Arduino projects are typically located in the $HOME/Documents/Arduino folder)
  2. While holding the BOOT/DFU button, press and release the Reset button, putting the Feather into ROM bootloader mode
  3. If loading firmware for the first time, initialize and calibrate the sensor using the adanet-init program
  4. In Arduino (or VS Code using the Arduino extension), open the arduino-co2-monitor.ino file and click Upload (or run the Arduino: Upload task in VS Code)
  5. Once finished, you may have to manually press the Reset button again to start the firmware

Pseudocode

And that's it! The firmware does the following once every 180 seconds (the fastest update rate supported by the E Ink screen):

  1. Enable the SCD4x and DPS310 sensors, start measurements
  2. Read battery charge state from the LC709203F sensor
  3. Light sleep for 5 seconds while the initial CO₂ and pressure measurements are taking place
  4. Update SCD4x with ambient pressure (the nominal reason for the DPS310 sensor!)
  5. Discard initial measurements (as per SCD4x Low Power Operation) and light sleep for another 5 seconds
  6. Save new measurements and disable I2C power (turns off all sensors)
  7. Enable the E Ink screen and update the display using the saved measurements
  8. Deep sleep for ~170 seconds and repeat