In late 2022 my wife, an avid caver, was explaining to me about "caving season" and that in Texas, many caves cannot be explored in the summer. The issue is that a layer of CO2, which is heavier than air, will stratify in caves and make it uncomfortable or dangerous to enter the cave. As CO2 is colorless and odorless - I asked her how she knew that the "CO2 had left for the season." The answer was "we use a portable air monitor." She really meant "we buy a butane lighter from a gas station."
When levels of ambient CO2 reach a point where they could be dangerous to humans, the butane flame will either not ignite, or the flame will float up to several inches above the lighter, in mid-air. This means that (for example) you could be on a rope descending into a dark pit and suddenly find yourself in a stratified and thick layer of CO2 and need to quickly "change over" to ascending the rope in order to escape. This is not ideal and near accidents have occurred. I'm not a fan.
She further explained "commercial units exist, fire departments and rescue units use them, but they are $800 or more." This put actual caver safety equipment out of the range of a typical caver's budget.
While she was talking, I was discretely googling to see if I could find some commercially available CO2 sensors and breakout boards. My bet was that the sensor itself was cheap but the unit had a huge mark-up in price. Could I make a small prototype safety device for my wife for Christmas? And thus, the CavAir was born.
Spoiler alert - while this project is "completed" it never really became the "final product." For that, see (TODO) my other project - the CavAirMini. That being said, this project laid the groundwork and helped to identify some key weaknesses in the original concept.
The goals of the project:
- Measure typical gas levels using off-the-shelf sensors that are easily available (CO2 & O2 for now)
- Must withstand the abuse my caver friends put equipment through
- Always-on display
- Visual and Audio alerts (flashing LED and buzzer)
- Simple - display PPM/Percentage, red light bad, loud noise bad
After a bit of searching and discussion with friends, I was able to find a small Pelican 1050 case that might fit the bill. It comes with a purge valve that could be modified with a small port to allow for gas exchange when the device is in use.
Because the CavAir was going to be carried through a cave (well, put in a bag and dragged/dropped/manhandled) the electronics inside needed to be well-secured. This necessitated a "carrier" that the electronics could be attached to, and the carrier needed to snugly fit into the rubber inside the case. Off to Fusion360 to make a model, which would drive PCB size/shape and wiring.
Some trickery was necessary for this carrier. The thread on the O2 sensor needed to be 3d printed with the thread in the horizontal plane and in very fine layers in order to get high-quality threads. However, I wanted to print the main carrier in its natural orientation at a thicker layer height in order to save manufacturing time. These were printed separately and then glued together with CA (cyanoacrylate/superglue) which does a fantastic job of binding PLA together.
The first step for these kinds of projects is typically to mock-up a design on a breadboard and generally see if things will all work as expected. Clever eyes will notice that this picture (one of the only ones I have from early development) is using an Arduino XIAO and a different display. This was about the moment I realized that a XIAO was pretty awful to work with (lack of reset button, difficult bootloader, limited GPIO, lack of generalized platformIO support). Additionally for the case I'd selected, this SSD1306 display was too small to work well.
KiCAD was used for schematic capture and PCB design. Some of the parts (the nano module, battery carrier, and some of the connectors) were not available as downloadable models, but KiCAD makes it easy to design custom parts including electrical connections (for debugging incorrect wiring) and physical models (for drill holes and 3d modeling).
The schematic is quite simple - mostly because the complexity is all in the Arduino Nano module itself.
OshPark does a fantastic job of small-run PCBs for the hobbyist. Relatively inexpensive and quick with great options for simple two-layer boards like this project required. I was able to select some expedited manufacturing options and two-day shipping to speed the process up even further.
This is where our story takes a bit of a turn.
The first step was getting the PCB back from OshPark. This is always a bit of a surprise - was something missed in the design? Does everything boot up correctly? If not, is it possible to hack the PCB to get things working by cutting traces and re-wiring to fix it? Or will another iteration of the PCB be required. Fortunately, probably due to the simplicity of the design, everything came out perfect this time. Assembling the custom PCB is one of my favorite times - the culmination of a lot of work that suddenly comes alive is very rewarding. :)
So, after a couple of days of programming, the system booted up, displayed CO2 readings, and seemed to run well. However, it quickly became clear that despite all the effort put into this prototype, this was not the final version that I would be able to gift my wife (and our friends). I immediately created a branch of the code and started adding #defines in the code to build a second, different module on a breadboard to address some of the issues, but after a day or two, gave up. It was time to collate the learnings from this version of the CavAir and build a new one from scratch.
Success? Failure? A lot was learned during this process, but the final product wasn't ready for release and use. A follow-up product (CavAirMini) was needed. Here is a summary of the lessons learned.
- Overall, this is too large of a package to be "jammed into a pack and casually used." Need to move towards a device that be shoved in a pocket or dangled from a line. Smaller, more robust, capable of taking measurements without an open lid.
- Modifying the purge valve in an acrylic/hard plastic case is problematic and prone to breakage, and defeats the general waterproof/dustproof ability of the system. Additionally, a small hole in a case like this does not promote enough gas diffusion to quickly measure CO2 levels - so in practice the lid has to stay open to accurately measure anything.
- The Arduino Nano module is too large to be practical for a device that needs to be carried into a cave.
- Arduino Bootloaders are less than ideal for quick iteration - prefer using an actual programmer (UPDI/6-pin ICSP). Unfortunately, due to the confined nature of the modules, the 6-pin header on the Nano module could not be used - it would stick up too far and impact other wires and devices in the case.
- The overall form factor (small pelican box) is not well suited to the task. In order to get CO2 readings, the box has to be open, and this is impractical in almost all situations. Additionally, anything with a rubber seal that remains exposed during a caving trip will attract dirt and eventually become "not sealed."
- A 2x20 display is insufficient for the task - it cannot display enough data and limits some of the things the device should be capable of.
- An O2 sensor is nice, but not something that every caver is going to need. Typically the primary concern is CO2 levels, not O2 levels. Additionally, the sensor is large, can be expensive, is consumable (lasts 3 years at most) and is quite sensitive to banging around.
- Being able to read an O2 sensor with the required precision means using a 12-bit ADC, a much smaller reference voltage, and potentially a single-sided op-amp. This is a lot of extra hardware for a sensor that's already problematic. It might be best to leave the O2 sensor behind for the next version.
- A battery carrier is too large and without a zip tie to hold the battery in, the battery can become dislodged or lose contact with the springs with a sharp bump - a common situation in caving.
- The current design has far too many wires and stand-offs. Find some ways to put more parts directly onto the main PCB in some way.
- Buttons for control of menus and display information need to be more accessible.
So...on to the next version!
Bad Air image from Non Toxic Foul Air Can Kill - a paper by Garry K Smith of The University of South Florida.
Title photograph by Genevieve Daniell — see more of her work at www.genevievedaniell.com









