Skip to content

Commit

Permalink
Pre release cleanup (#11)
Browse files Browse the repository at this point in the history
* Updating STLs to latest version with SD card slot

* Restructuring the adanet-co2-monitor.ino sketch to improve error handling, add version info, and fix other minor issues

* Adding initial draft of arduino-init.ino sketch, for initializing and calibrating newly built sensors

* Updating README with latest changes (still need to change pics), reformatting error display screen

* Cleanup of init app with better error handling, optional calibration. Adding minimal README

* Using CDC air quality threshold of 800 ppm, minor formatting fixes

* Moving battery test to top of init script, adding user input before factory reset and forced recalibration

* Updating README instructions and images to correspond to latest changes
  • Loading branch information
danwahl authored Oct 10, 2022
1 parent b764c47 commit 8f06a14
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 139 deletions.
56 changes: 29 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adanet CO₂ Monitor

Knowledge of the ambient CO₂ level is important for at least three reasons:
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](https://slatestarcodex.com/2018/08/23/carbon-dioxide-an-open-door-policy/)
2. CO₂ levels can be used to as a [proxy for good ventilation and COVID risk](https://www.cdc.gov/coronavirus/2019-ncov/community/ventilation.html#faq-53432-answer0)
Expand All @@ -16,7 +16,7 @@ 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 (~one month on a single charge)
- 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)

Expand All @@ -31,24 +31,24 @@ Most of the COTS parts are from [Adafruit](https://www.adafruit.com/) (hence the
|:---:|:----:|:----------------------------------------------------------------------------------------------:|:----------:|:-----------:|
| 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 | 5190 | Adafruit SCD-41 - True CO2 Temperature and Humidity Sensor | 59.5 | 59.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 |
| | | | | 123.30 |

In addition, you'll need several fasteners. Most come in the [Adafruit 3299](https://www.adafruit.com/product/3299) kit, but this is overkill (only 12 out of the 380 pieces are used), so you may have better luck at a hardware store. Either way, you'll need:
In addition, you'll need several fasteners. Most come in the [Adafruit 3299](https://www.adafruit.com/product/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. Either way, you'll need:

| Qty | Part Description | Material |
|:---:|:-----------------------------:|----------|
| 12 | M2.5 Hex Nut | Nylon |
| 12 | M2.5 x 6mm Screw | Nylon |
| 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.3 x 5mm Self-Tapping Screw | Steel |

I also bought the self-tapping screws in [a kit](https://smile.amazon.com/dp/B081DVZMHH), but there are almost certainly cheaper options.

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?](https://www.chipublib.org/maker-lab/)), or use a service like [(3D)Hubs](https://www.hubs.com/). (Note: I recommend printing the "top" upside down, both to get a smooth finish on the outside and to avoid overhangs.)
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?](https://www.chipublib.org/maker-lab/)), or use a service like [(3D)Hubs](https://www.hubs.com/). (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](https://cad.onshape.com/documents/5da5dcb1f603a01f8bec88c9/w/ca967a8a956dc66b8484bce3/e/ef1ece94c6975fbb49878b31?renderMode=0&uiState=6315320c2f77803a879eb7f9).

Expand All @@ -68,15 +68,15 @@ First assemble the top and bottom of the case separately:
### 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 SCD40 board
3. Press the SCD40 board onto the four exposed standoffs, with the sensor facing "out" of the case, and use 4 M2.5 hex nuts to secure
4. Connect the DPS310 to the 4-pin STEMMA QT cable on the "right" (when facing the non-sensor side) of the SCD40 board
5. Use 4 M2.5 x 6mm screws and 4 M2.5 hex nuts to attach the DPS310 to the remaining holes in the case, such that the sensor is facing "in"
6. Carefully insert the battery, which should fit snugly under the DPS310, and adjacent to the bottom standoffs holding the SCD40
2. Attach the 4-pin STEMMA QT cables to either side of the SCD41 board
3. Press the SCD41 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 SCD41 board
5. Use 2 M2.5 hex nuts to attach the DPS310 to the top two standoffs, back-to-back with the SCD41 so that the sensor is facing "in" (note: first apply Kapton/electrical tape to the back of the DPS310 to avoid shorting to the SCD41)
6. Carefully insert the battery, which should fit snugly lengthwise, and adjacent to the bottom standoffs holding the SCD41 (note: you can use double-sided tape securely affix the battery to the case)

![adanet-assembly-bottom](images/adanet-assembly-bottom.jpg)

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/DF and Reset buttons are not externally accessible)!
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:

Expand All @@ -88,33 +88,35 @@ The Arduino firmware (adanet-co2-monitor.ino) has been tested using the followin

- Arduino IDE (v1.8.19)
- Adafruit DPS310 (v1.1.1)
- Adafruit LC709203F (v1.3.0)
- Adafruit NeoPixel (v1.10.5)
- ESP32 Arduino (v2.0.4)
- Adafruit EPD (v4.5.0)
- Adafruit LC709203F (v1.3.1)
- ESP32 Arduino (v2.0.5)
- Sensirion I2C SCD4x (v0.3.1)

To prepare your development environment:

1. Install [Arduino IDE](https://www.arduino.cc/en/software/) (and optionally VS Code)
1. Install [Arduino IDE](https://www.arduino.cc/en/software/) (and optionally the [VS Code extension](https://github.com/microsoft/vscode-arduino))
2. Follow [these instructions](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html) 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](https://github.com/espressif/arduino-esp32/issues/6762)) 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/ttyUSB0` on Linux)
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)

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](https://learn.adafruit.com/adafruit-esp32-s2-feather/factory-reset)
3. In Arduino (or VS Code using the [Arduino extension](https://github.com/microsoft/vscode-arduino)), open the arduino-co2-monitor.ino file and click Upload (or run the Arduino: Upload task)
4. Once finished, you may have to manually press the Reset button again to start the firmware
3. If loading firmware for the first time, initialize and calibrate the sensor using the [adanet-init](adanet-init) program
4. In Arduino (or VS Code using the [Arduino extension](https://github.com/microsoft/vscode-arduino)), 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

And that's it! The firmware does the following once every 180 seconds (the [fastest update rate](https://learn.adafruit.com/adafruit-2-13-eink-display-breakouts-and-featherwings/usage-expectations) supported by the E Ink screen):

1. Enable the SCD40 and DPS310 sensors, start measurements
1. Enable the SCD41 and DPS310 sensors, start measurements
2. Light sleep for 5 seconds while the initial CO₂ and pressure measurements are taking place
3. Update SCD40 with ambient pressure (the [nominal reason](http://www.co2meters.com/Documentation/AppNotes/AN149-Senseair-Pressure-Dependence.pdf) for the DPS301 sensor!)
4. Discard initial measurements (as per [SCD40 Low Power Operation](https://sensirion.com/media/documents/077BC86F/62BF01B9/CD_AN_SCD4x_Low_Power_Operation_D1.pdf)) and light sleep for another 5 seconds
5. Save new measurements and disable I2C power (turns off SCD40 and DPS301)
6. Enable the E Ink screen and update the display using the saved measurements
7. Deep sleep for ~170 seconds and repeat
3. Update SCD41 with ambient pressure (the [nominal reason](http://www.co2meters.com/Documentation/AppNotes/AN149-Senseair-Pressure-Dependence.pdf) for the DPS301 sensor!)
4. Discard initial measurements (as per [SCD41 Low Power Operation](https://sensirion.com/media/documents/077BC86F/62BF01B9/CD_AN_SCD4x_Low_Power_Operation_D1.pdf)) and light sleep for another 5 seconds
5. Read battery charge state from the LC709203F sensor
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
Binary file modified adanet-case-bottom.stl
Binary file not shown.
Binary file modified adanet-case-top.stl
Binary file not shown.
Loading

0 comments on commit 8f06a14

Please sign in to comment.