Yearly Archives: 2023

The e360: A DIY Classroom Data Logger for Science [2023]

2023 is the ten-year anniversary of the Cave Pearl Project, with hundreds of loggers built from various parts in the Arduino ecosystem and deployed for Dr. Beddows research. During that time her EARTH 360 – Instrumentation course evolved from using commercial equipment to having students assemble a logging platform for labs on environmental sensing. The experience of those many first-time builders has been essential to refining our educational logger design to achieve maximum utility from a minimum number of components. So, in recognition of their ongoing and spirited enthusiasm, we call this new model the e360.

A standard 50mL centrifuge tube forms the housing, which is waterproof to about 8 meters depth. For better moisture resistance use tubes with an O-ring integrated into the cap (made of silicone or ethylene propylene) which gets compressed when the threads are tightened.

One of the things that distinguishes this project from others in the open science hardware movement is that instead of constantly adding features like IOT connectivity, we have been iterating towards simplicity. Cheap, flexible, stand-alone loggers enable many teaching and research opportunities that expensive complicated tools can not.

This fully functional data logger is essentially just two modules connected by four I2C bus wires and an alarm line. We usually add an LDR, NTC thermistor, and RGB LED, but those are optional.
A mounting bracket that accommodates both 30ml (self standing Caplug) and 50ml (Thermo NUNC) centrifuge tubes. The logger snaps into place but Zipties can also be threaded through the central support to wrap around the tube. This prints without any generated supports and the printable STL can also be downloaded (with the rails) from the projects Github repository for this logger .

Many parallel trends have advanced the open-source hardware movement over the last decade, including progress towards inexpensive and (mostly) reliable 3D printing. In keeping with the project’s ethos of accessibility, we use an Ender 3 for the rails and you can download that printable stl file directly from Tinkercad. Tinkercad is such a beginner-friendly tool that students are asked to create their own logger mounting brackets from scratch as as an exercise in the Lux/LDR calibration lab. This directly parallels our increasing use of 3D prints for installation brackets & sensor housings on the research side of the project.

There are a few trade-offs to be aware of with this minimalist 2-module design: Supporting only Analog & I2C sensors makes the course more manageable but loosing the DS18b20, which has served us so well over the years, does bring a tear to the eye. Removing the SD card used on previous EDU models means that memory becomes the primary constraint on run-time (but that can be expanded easily). The RTC’s one second alarm means this logger is not really suitable for high frequency sampling and UV exposure makes the 50ml centrifuge tubes brittle after 3-4 months in full sun. Coin cells can only power sensors that draw less than 1-2mA and voltage droop limits operation to environments that don’t much below -10°C, although it’s easy enough to run the logger on two lithium AAA‘s in series and we’ve run those down to -20°C.


Jump links to the sections of this post:


Parts for the lab kit:

The basic logger kit costs about $10 depending on where you get the DS3231 RTC & 3.3v/8MHz ProMini modules. Pre-assembly of the UART cable, NTC cluster & LED can be done to shorten lab time. CP2102 6pin UARTs are cheap, and have good driver support, but you have to make that Dupont crossover cable because the pins don’t align with the ProMini headers.
Sensor modules for lab activities: TTP233 touch, BMP280 pressure, BH1750 lux, AM312 PIR, 1k &10k pots and a sheet of metal foil for the capacitive sensing lab. Other useful additions are a Piezo Buzzer, a 0.49″ OLED and 32k AT24c256 EEproms. The screen is $4, but the other parts should should cost about $1 each.

You can find all the parts shown here on eBay and Amazon – except for the rail which needs to be printed but these days it’s relatively easy to send 3D models out to an printing service if someone at your school doesn’t already have a printer. Expect 15% of the parts from cheap suppliers like eBay or Amazon to be high drain, or simply DOA. We order three complete lab kits per student to cover defects, infant mortality, and replacement of parts damaged during the course. This is usually their first time soldering and some things will inevitably get trashed in the learning process – but that’s OK at this price point. We also order each part from three different vendors, in case one of them is selling rejects from a bad production run. The extra parts allow students to build a second or third logger later in the course – which is often needed for their final projects.

I’ve used short jumpers here to make the connections clear, but it’s better use longer wires from a 30cm, F-F Dupont ribbon to make these cables. Only the 3.3v line from the Cp2102 gets connected to the logger.
Cp2102 UARTProMini
DTR->DTR
RXD->TXO
TXD->RXI
GND->GND
3V3->VCC

Macintosh USBc to USBa adapters are smart devices with chips that will shut-down if you unplug from the computer with a battery powered logger is still connected. The coin cell back-feeds enough voltage to put the dongle into an error state. Always disconnect the UART to logger connection FIRST instead of simply pulling the whole string of still-connected devices out of the computer. New Macs often require genuine Apple brand USBc-a adapters for any UART driver install to succeed.

After installing OS drivers for your UART, you need to select the IDE menu options:
[1] TOOLS > Board: Arduino Pro or Pro Mini
[2] TOOLS > Processor: ATmega328 (3.3v, 8mhz)
[3] TOOLS > Port: Match the COM# or /dev that appears when you connect the UART

On this UART the 5v connection had to be cut with a knife before soldering the 3.3v pads together to set the output voltage.

For many years we used FT232s, but the current windows drivers will block operation if you get one of the many counterfeit chips on the market. If you do end up with one of those fakes only OLD drivers from 2015 / 2016 will get that UART working with the IDE. To avoid that whole mess, we now use Cp2102’s or Ch340’s. Some UARTs require you to cut or bridge solder pads on the back side to set the 3.3v that an 8MHz ProMini runs on. Many I2C sensor modules on the market also require this lower voltage. Avoid Pro Mini’s with the much smaller 328P-MU variant processors. They may be compatible inside the chip but the smaller solder pad separation makes the overall logger noticeably more susceptible to moisture related problems later.


Assembling the logger:

This e360 model is based on the 2-Module logger we released in 2022, with changes to the LED & NTC connections to facilitate various lab activities in the course. That post has many technical details about the logger that have been omitted here for brevity, so it’s a good idea to read through that extensive background material when you have time.

Prepare the RTC module:

Clipping the Vcc supply leg (2nd leg in from the corner) reduces DS3231 from its typical 89µA to only 3.5µA and disables the 32k output.
Disconnect the power indicator LED by removing its limit resistor.
Remove the 200Ω charging resistor, and bridge the Vcc to the battery power line at the black end of diode.

Cutting the VCC input leg forces the clock to run on VBAT which reduces the DS3231 chip constant current to less than 1µA, but that can spike as high as 550µA when the TCXO temperature reading occurs (every 64 seconds). The temp. conversions and the DS3231 battery standby current averages out to about ~3µA so the RTC is responsible for most of the power used by this logger over time. If the time reads 2165/165/165 instead of the normal startup default of 2000/01/01 then the registers are bad and the RTC will not function. Bridging Vcc to Vbat means a 3.3V UART will drive some harmless reverse current through older coin cells while connected. DS3231-SN RTCs drift up to 61 seconds/year while -M chips drift up to 153 sec/year. If the RTCs temperature readings are off by more than the ±3°C spec. then the clocks will drift more than that. I usually give the RTC modules a coating of conformal (or clear nail polish) before using them in a logger.

As shown on the schematic, you can build the minimum configuration of this logger with only five jumper wires on a breadboard. You can then use this to test the RTC modules (with the logger base-code) before hard-soldering them into a logger unit.

Modify & Test the Pro Mini:

A Pro Mini style board continues as the heart of the logger, because they are still the cheapest low-power option for projects that don’t require heavy calculations.

Carefully clip the 2-leg side of the regulator with sharp side-snips and wobble it back and forth till it breaks the 3 legs on the other side.
Remove the limit resistor for the power indicator LED with a hot soldering iron tip.
Clip away the reset switch. This logger can only be started with serial commands via a UART connection.
Add 90° UART header pins and vertical pins on D2 to D5. Also add at least one analog input (here shown on A3). Students make fewer soldering errors when there are different headers on the two sides of the board for orientation.
Bend these pins inward at 45° and tin A3, D2 & D3 for wire attachments later. We use D4 & D5 for a capacitive sensor lab with Paul Stoffregen’s library.
Do not progress with the build until you have confirmed the ProMini has a working bootloader by loading the blink sketch onto it from the IDE.

Add the NTC/LDR Sensors & LED indictor

These components are optional if you are only using I2C sensor modules, but they provide options for pulse width modulation and sensor calibration activities.

Join a 10k 3950 NTC thermistor, a 5528 LDR, a 330Ω resistor and a 0.1µF [104] ceramic capacitor. Then heat shrink the common soldered connection.
Thread these through D6=LDR, D7=NTC, D8=330Ω, and the cap connects to ground at the end of the Pro Mini module. Note that the D6/D7 connections could be any resistive sensors up to a maximum value of 65k ohms.
Solder the sensor cluster from the bottom side of the Pro Mini board and clip the tails flush with the board. Clean excess flux with alcohol & a cotton swab.

The way we read resistive sensors using digital pins is described in this post from 2019 although to leave more digital pins open for lab activities we use the 30k internal pullup resistor on D8 as the reference that the NTC and LDR get compared to. We have another post describing how to calibrate those NTC thermistors in a classroom setting. Noise/Variation in the NTC temperature readings is ±0.015°C, so the line on a graph of rapid 1second readings is about 0.03°C thick. The base-code uses 16bit integer variables, and a typical 10k NTC exceeds that 65535 ohm limit at about -12°C. Range switching with two NTCs could be done if the max / min resistance values of one thermistor can’t deliver the span you need or you could edit the code to use 32bit ints.

Add a 1/8 watt 1kΩ limit resistor to the ground leg of a 5mm common cathode RGB led. Extend the red channel leg with ~5 cm of flexible 26 AWG wire.
Insert Blue=D10, Green = D11, GND = D12. Solder these from the under side of the Pro Mini and clip the excess length flush to the board.
Bring the red channel wire over and solder it through D9. Note that if the RGB is not added, the default red LED on D13 can still be used as an indicator.

You can test which leg of an LED is which color with a cr2032 coin cell using the negative side of the battery on the ground leg. The LED color channels are soldered to ProMini pins R9-B10-G11 and a 1k limit resistor is added to the D12 GND connection to allow multi-color output via the PWM that those pins support. Note that the little red LED on the ProMini at pin D13 is still available to use as an indicator if you do not add the RGB led.


Join the Two Modules via the I2C Bus:

Use legs of a scrap resistor to add jumpers to the I2C bus connections on A4 (SDA) and A5 (SCL). Trim any long tails from these wires left poking out from the top side of the ProMini.
Cover the wires with small diameter heat-shrink and bend them so they cross over each other. The most common build error is forgetting the to cross these wires.
Use another scrap resistor to extend the Vcc and GND lines vertically from the tails of the UART headers. This is the most challenging solder joint of the whole build.
Add a strip of double-sided foam tape across the chips on the RTC module and remove the protective backing.
Carefully thread the I2C jumpers though the RTC module.
Press the two modules together and check that the two boards are aligned.
Check that the two I2C jumpers are not accidentally contacting the header pins below, then solder all four wires into place on the RTC module.
Bend the GND wire to the outer edge of the module, and trim the excess from the SDA and SCL jumpers. Adding a capacitor to the power wires helps the coin cell handle brief loads:
Optional: Solder a 440µF [477A] to 1000µF [ 108J ] 10volt tantalum capacitor to the VCC and GND wires. Clip away the excess wire.
Tin the four I2C headers on the RTC module and the SQW alarm output pin.
Join the RTC’s SQW alarm output to header pin D2 with a short flexible jumper wire. At this point the logger core is complete and could operate as a stand-alone unit.
Bend the four I2C header pins up to 45 degrees. You can clip away the 35k header as it is not used.

As soon as you have the two modules together: connect the logger to a UART and run an I2C bus scanning program to make sure you have joined them properly. This should report the DS3231 at address 0x68, and the 4K EEprom at 0x57.


Add Rails & Breadboard Jumpers:

Clip the bottom posts away from two 25 tie-point mini breadboards.
Insert the breadboards in the rails. Depending on the tolerance of your 3D print, this may require pliers and/or a deburring tool to make the hole larger.
Mount the breadboards so they project about 2mm above the upper surface of the rails. The breadboards can be secured quickly with a drop of cyanoacrylate glue sprinkled with a little baking soda to act as an accelerant. This can also be used to repair broken rails or lock down loose wires.
Carefully place a small bead of CA glue along the edge where the mini breadboard meets the UNDER SIDE of the logger rail.
Sprinkle a tiny amount of baking soda onto the clear super glue. This will act as a catalyst that rapidly sets the glue so that it is safe to touch while you continue the logger assembly.
After waiting a couple of seconds blow away the excess baking soda. Repeat this procedure again on opposite edges of both breadboards to secure them to the printed rail.
The 3D printed rails have a pocket cutout for the logger stack. The RTC module board should sit flush with the upper surface of the rail. Hot glue can be applied from the underside through the holes near the corners to hold the logger to the rails…
or very thin zip ties or twisted wire can hold the logger stack in place. I often use the legs of a scrap resistor as the twist-tie because that can be ‘locked’ in place with solder. (see 1:06 in the build video)
Check that the RTC pcb is flush in the pocket at opposite diagonal corners.
Cut two 14 cm lengths of 22AWG solid core wire. Insert stripped ends into the breadboards as shown, then route though the holes in the rail.
Secure the wires from the underside with a zip tie. Note: the ‘extra’ holes in the rail are used to secure small desiccant packs during deployment.
Route the solid core wires along the side of the breadboard and back out through the two inner holes near the logger stack.
The green wire should exit on the analog side of the Pro Mini and the blue wire should be on the digital side.
Route and trim the green wire to length for the A3 header.
Strip, tin and solder the wire to the A3 pin.
Repeat the process for the blue wire, connecting it to D3.
Extend the four I2C headers on the RTC module with 3cm solid core jumpers. Here, white is SDAta and yellow is SCLock.
Bend the jumpers into the breadboard contacts. Bmp280 and Bh1750 sensor modules usually require this crossover configuration.

A video covering the whole assembly process:

NOTE: For people with previous building experience we’ve also posted a 4 minute Rapid Review.

Code Overview: [posted on GitHub]

The base code requires the RocketScream LowPower.h library to put the logger to sleep between readings and this can be installed via the library manager in the IDE. In addition to the included NTC / LDR combination, the code has support for the BMP/E280, BH1750(lux), and PIR sensors although you will need to install libraries (via the IDEs library manager) for some of them. Sensors are added by uncommenting define statements at the beginning of the code. Each sensor enabled after the single-byte LowBat & RTCtemp defaults contributes two additional bytes per sampling event because every sensors output gets loaded into a 16-bit integer variable.

The basic sensors cover light, temperature, pressure and humidity – so you could teach an introductory enviro-sci course by enabling or disabling those sensors before each lab. Note: while the BME280 is quite good for indoor measurements where very high RH% occurs rarely; SHT30 or AM2315C sensors encapsulated in water resistant PTFE shells are better choices for long term weather stations.

Bmp280 outputs can be saved individually. Total bytes per sampling record must be 1, 2, 4, 8 or 16 ONLY. You may need to add or remove RTC temp or Current Battery to make the byte total correct for a new sensor. Note that the supported sensors will change over time as our course evolves.

But limiting this tool to only the pre-configured sensors would completely miss the point of an open source data logger project. So we’ve tried to make the process of modifying the base-code to support different sensors as straight forward as possible. Edits are required only in the places indicated by call-out numbers on the following flow diagrams. These sections are highlighted with comments labeled: STEP1, STEP2, STEP3, etc. so you can locate them with the find function in the IDE.

The navigation point comments are also surrounded by rows of PLUS symbols:
//++++++++++++++++++++++++++++
//
STEP1: #include libraries & Declare Variables HERE
//++++++++++++++++++++++++++++

In Setup()

Note: The startup options shown here may change as new code gets released.

A UART connection is required to access the start-up menu through the serial monitor window in the IDE. This menu times-out after 8 minutes but the sequence can be re-entered at any timeby closing and re-opening the serial monitor. This restarts the Pro Mini via a pulse sent from the UARTs DTR (data terminal ready) pin. The start-up menu should look similar to the screen shot below, although the menu options may change as new code updates get released:

Only the first six options appear until you enter ’99’ to expand the menu. If you see random characters in the serial window, set the baud to 500,000 (with the pulldown menu on the lower right corner of the window) and the menu should display properly after you re-open the window. If you Ctrl-A & Ctrl-C to copy logger data from the serial monitor when the window has garbled characters, no information will copy out. On a new logger info fields may display as a rows of question marks until you enter some text via the menu but the Site info & Cal. Constant fields will remain hidden until they are used. RTCage can be left at the -1 default but see below to adjust VREF.

The first menu option asks if you want to download data from the logger after which you can copy/paste everything from the serial window into a spreadsheet. Then, below the data tab in Excel, select Text to Columns to divide the data into separate columns at the comma separators. Or you can paste into a text editor and save a .csv file for import to other programs. While this transfer is a bit clunky, everyone already has the required cable and retrieval is driven by the logger itself. We still use the legacy 1.8.x version of the IDE, but you could also do this download with a generic serial terminal app. You can download the data without battery power once the logger is connected to a UART. However, you should only set the RTC after installing a battery, or the time will reset to 2000/01/01 00:00 when the UART is disconnected. No information is lost from the EEprom when you remove and replace a dead coin cell.

A Unix timestamp for each sensor reading is reconstructed during data retrieval by adding successive second-offsets to the first record time saved during startup. You should download old data from a previous run before changing the sampling interval because the interval stored in memory is used for the calculation that reconstructs each records timestamp. This technique saves a significant amount of our limited memory and = (Unixtime/86400) + DATE(1970,1,1) converts those Unix timestamps into Excel’s date-time format. Valid sampling intervals must divide evenly into 60 and be less than 60. Short second-intervals are supported for rapid testing & debugging, but you must first enter 0 for the minutes before the seconds entry is requested. The unit will keep using the previous sampling interval until a new one is set. It helps to have a utility like Eleven Clock running so that you have HH:MM:SS displayed on your computer screen when setting the loggers clock.

The easiest way to measure the supplied voltage while the logger is connected to USB/UART power is at the metal springs in the Dupont cable.

Vref compensates for variations in the reference voltage inside the 328p processor. Adjusting the 1126400 default value up or down by 400 raises/lowers the reported voltage by 1 millivolt. Adjust this by checking the voltage supplied by your UART with a multimeter while running the logger with #define logCurrentBattery enabled and serial output Toggled ON at a 1 second interval. Note the difference between the millivolts you actually measured and the battery voltage reported on the serial monitor and then multiply that by 400 to get the adjustment you need to make. Restart and save this new number with the [ ] Set VREF menu option and repeat this procedure until the battery reading on screen matches what you are measuring with the DVM. This adjustment only needs to be done once as the number you enter is stored in the 328p EEprom for future use. Note that most loggers run fine with the default 1126400 vref although some units will shutdown early because they are under-reading. It’s rare to get two constants the same in a classroom of loggers so you can use student initials + vref as unique identifiers for each logger. If you do get a couple the same you can change the last two digits to make unique serial numbers without affecting the readings. Note that the 1-byte compressed battery readings have a resolution limit of ±16 millivolts.

After setting the time, the sampling interval, and other operating parameters, choosing [ ] START logging will require the user to enter an additional ‘start’ command. Only when that second ‘start’ confirmation is received does old data get erased by setting every memory location in the EEprom. Maximum value trapping is required on the sensor variables because multiple 0xFF readbacks serve as the End-Of-File indication during download. LEDs then ‘flicker’ rapidly to indicate a synchronization delay while the logger waits to reach the first aligned sampling time so the code can progress from Setup() into the Main Loop().

In the main LOOP()

If all you do is enable sensors via defines at the start of the program you won’t have to deal with the code that stores the data. However to add a new sensor you will need to make changes to the I2C transaction that transfers those sensor readings into the EEprom (and to the sendData2Serial function that reads them back later). This involves dividing your sensor variables into 8-bit pieces and adding those bytes to the wire transfer buffer. This can be done with bit-math operations for long integers or via the lowByte & highByte macros for 16-bit integers. The general pattern when sending bytes to an I2C EEprom is:

Wire.beginTransmission(EEpromAddressonI2Cbus); // first byte in I2C buffer
Wire.write(highByte(memoryAddress)); // it takes two bytes to specify the
Wire.write(lowByte(memoryAddress)); // memory location inside the EEprom

loByte = lowByte(SensorReadingIntergerVariable);
Wire.write(loByte); // adds 1st byte of sensor data to wire buffer
hiByte = highByte(SensorReadingIntegerVariable);
Wire.write(hiByte); // adds 2nd byte of sensor data to the buffer

— add more Wire.write statements here as needed for your sensors —

The saved bytes must total of 1, 2, 4, 8 or 16 in each I2C transaction. Powers of Two byte increments are required because the # of bytes saved per sampling event must divide evenly into the physical page limit inside each EEprom, which is also a power of two in size. The code will display a warning on screen of bytesPerRecord is not a power of two.

Wire.endTransmission(); // bytes accumulated in the buffer are sent now

The key insight here is that the wire library is only loading the bytes into a memory buffer until it receives the Wire.endTransmission() command. So it does not matter how much time you spend adding (sensor variable) bytes to the transaction so long as you don’t start another I2C transaction while this one is in progress. Once that buffered data has been physically sent over the wires, the EEprom enters a self-timed writing sequence and the logger reads the rail voltage immediately after the write process begins. The only way to accurately gauge the state of a lithium battery is to check it while it is under this load.

NOTE: The data download function called in setup retrieves those separate bytes from the EEprom and concatenates them back into the original integer sensor readings for output on the serial monitor. So the sequence of operations in the sendData2Serial function must exactly match the order used in the main loop to load sensor bytes into the EEprom.


Adding Sensors to the Logger:

By default, the logger records the RTC temperature (#define logRTC_Temperature) at 0.25°C resolution and the battery voltage under load (#define logLowestBattery). These readings are compressed to only one byte each by scaling after subtracting a fixed ‘offset’ value. This allows about 2000 readings to be stored on the 4k (4096byte) EEprom which provides 20 days of operation at a 15-minute sampling interval.

A typical RTC temperature record from a logger installed into a cave early in the project. The datasheet spec is ±3° accuracy, but most are within ±0.5° near 25°C. If you do a simple y=Mx+B calibration against a trusted reference sensor, the RTC temperatures are very stable over time. The RTC updates it’s temperature register every 64 seconds so there is no benefit from reading it more frequently than once per minute.

That 4k fills more quickly if your sensors generate multiple 2-byte integers but larger 32k (AT24c256) EEproms can easily be added for longer running time. These can be found on eBay for ~$1 each and they work with the same code after you adjust the define statements for EEpromI2Caddr & EEbytesOfStorage at the start of the program.

This Bmp280 pressure sensor matches the connection pattern on this 32k EEprom module. So the two boards can be soldered onto the same set of double-length header pins.
Vertical stacking allows several I2C modules to fit inside the 50mL body tube. Any I2C sensor breakouts could be combined this way provided they have different bus addresses.

The pullup resistors on the sensor modules can usually be left in place as the logger will operate fine with a combined parallel resistance as low as 2.2k ohms. No matter what sensor you enable, always check that the total of all bytes stored per pass through the main loop is 1,2,4,8 or 16 or you will get a repeating data error when the bytes transmitted over the I2C bus cross a physical page boundary inside the EEprom. This leads to a wrap-around which over-writes data at the beginning of the memory block. Also note that with larger EEproms you may need to slow the serial communications down to only 250k BAUD to prevent the occasional character glitch that you sometimes see with long downloads at 500k.

Perhaps the most important thing to keep in mind is that breadboards connect to the module header pins via tiny little springs which are easily jiggled loose if you bump the logger. Small beads of hot glue can be used to lock sensor modules & wires into place on the breadboard area. ALSO add another drop can help secure the Cr2032 battery in place for outdoor deployments. Some sensors can handle a momentary disconnection but most I2C sensors require full re-initialization or they will not deliver any more data after a hard knock jiggles the battery contact spring. So handle the logger gently while it’s running – no tossing them in a backpack full of books! Many students make additional no-breadboard loggers with fully soldered connections to the sensor modules if their final projects require rough handling. It’s also a good idea to put 1 gram (or 2 half-gram) silica gell desiccant packs with color indicator beads inside the body tube for outdoor deployments. A change in the indicator bead color is the only way to know if moisture is somehow seeping in, potentially causing runtime problems or early shutdown.

The base code also includes the DIGITAL method we developed to read the NTC/LDR sensors. On this new build we used the internal pullup resistor on D8 as a reference to free up another digital pin. The blue jumper wire on D3 (the 2nd external interrupt) can wake the logger with high / low signals. This enables event timing and animal tracking. Pet behavior is a popular theme for final student projects.

The TTP233 can detect a press through 1-2mm of flat plastic but it does not read well through the curved surface of the tube. In open air it triggers when your finger is still 1cm away but the sensitivity can be reduced by adding a trimming capacitor.
The AM312 draws <15µA and has a detection range of ~5m through the centrifuge tube. This sensor has a relatively long 2-4 second reset time and will stay high continuously if it gets re-triggered in that time. Our codebase supports counting PIR detections OR using the PIR to wake the logger for other sensor readings instead of the standard RTC alarm.

These 0.49″ micro OLEDs sleep at 6µA and usually draw less than a milliamp displaying text at 50% contrast. However, like all OLEDs they send wicked charge-pump spikes onto the supply rails. A 220 or 440µF tantalum right next to them on the breadboard will suppress that noise. Sleep the ProMini while the pixels are turned on to lower the total current load on the battery.

These displays run about two weeks on a coin cell if you only turn them on briefly at 15 minute intervals, depending on contrast, pixel coverage, and display time. It might also be possible to completely depower them when not in use with a mosfet like the TN0702N3.
These OLEDs are driven by a 1306 so you can use standard libraries like Griemans SSD1306Ascii which can be installed via the library manager. However, the mini screens only display a weirdly located sub-sample of the controllers 1k memory – so you have to offset the X/Y origin points on your print statements accordingly.

While I2C sensors are fun, we should also mention the classics. It is often more memorable for students to see or hear a sensors output, and the serial plotter is especially useful for lessons about how noisy their laptop power supply is…

If you twist the legs 90°, a standard potentiometer fits perfectly into the 25 tie-point breadboard for ADC control of PWM rainbows on the RGB LED.
Light-theremin tones map onto the squawky little Piezo speaker and alligator clips make it easy to try a variety of metal objects in the Capacitive Sensing lab.

If you run a lab tethered to the UART for power, then your only limitation is the 30-50 milliamps that those chips normally provide. This is usually enough for environmental sensors although some GPS modules will exceed that capacity. If a high-drain GPS module or a infrared CO2 sensor is required then use those you will need one of the previous AA powered loggers from the project.

When running the logger in stand alone mode your sensors have to operate within the current limitations of the CR2032 coin cell. This means sensors should take readings below 2mA and support low-power sleep modes below 20µA (ideally < 2µA). Order 3.3v sensor modules without any regulators – otherwise the 662k LDO on most eBay sensor modules will increase logger sleep current by ~8µA due to back-feed leakage through the reg. Sensors without regulators usually have -3.3v specified in the name, so a GY-BME280-3.3v humidity sensor has no regulator, but most other BME280 modules will have regulators.

Enabling the #define PIRtriggersReadings changes logger operation to a variable duty cycle that only wakes to read when the motion sensor is triggered. So correlational experiments on pet behavior at night, or HVAC recovery time after door traffic become possible. Combining multiple sensors expands the range of final student projects.

The best sensor libraries to choose should support three things: 1) one-shot readings that put the sensor into a low power sleep mode immediately after the readings 2) give you the ability to sleep the ProMini processor WHILE the sensor is generating those readings and 3) use integer mathematics for speed and a lower memory footprint. Many sensors can read at different resolutions using a technique called oversampling but creating high resolution (or low noise) readings with this method takes exponentially more power. So you want your library to let you set the sensor registers to capture only the resolution you need for your application. The library should also have some way set the I2C address to match your particular sensor module as most sensors support different addresses depending on which pin is pulled up. Always have a generic I2C bus scanning utility handy to check that the sensor is showing up on the bus at the expected address after you plug it into the breadboard (and restart the logger).


Logger Operation:

The ProMini/RTC stack usually draws peak currents near 3.3mA although this can be increased by sensors and OLEDs. The logger typically sleeps between 2 – 10µA with a sensor module attached. Four 3.5mA*50millisecond (CPU time) sensor readings per hour gives a maximum battery lifespan of about one year. So the run time is usually more limited by memory than the 100mAh available from a Cr2032. The tantalum rail-buffering capacitor only extends operating life about 20% under normal conditions, but it becomes more important with poor quality coin cells or in colder environments where the battery chemistry slows:

A BMP280 sampling event with NO rail buffering capacitor draws a NEW coin cell voltage down about 50mv during the logging events…
…while the voltage on an OLD coin cell falls by almost 200 millivolts during that same event on the same logger – (again with NO rail buffer cap)
Adding a 1000µF [108j] tantalum rail buffer to that same OLD battery supports the coin cell, so the logging event now drops the voltage less than 20mV.

The logger sleeps permanently when the battery reading falls below the value defined for systemShutdownVoltage which we usually set at 2850mv because many 328p chips trigger their internal brown-out detector at 2.77v. And the $1 I2C EEprom modules you get from eBay often have an operational limit at 2.7v. If you see noisy voltage curves there’s a good chance poor battery contact is adding resistance: secure the coincell with a drop of hot glue before deployment.

High & Low battery readings (in mv) from an e360 logging Pressure & Temp from a BMP280 @30min intervals to a 32k I2C EEprom (full in 84 days). This unit slept at 3.2µA and had a 1000uF tantalum rail capacitor. This kept battery droop below 50mv during the data save, stabilizing above 3000mv.
Same configuration & new Cr2032 at start, only this logger had NO rail capacitor and slept at only 2µA. Despite burning less power during sleep, the coin cell voltage droop during data saves was ~100mv, so the battery plateau is closer to the low battery shutdown at 2800mv.

A typical student logger should draw between 2 – 10µA when sleeping between sensor readings, and if they are consistently several times that, an accidentally overheated rail capacitor is often the cause. After replacing that tantalum cap, try to leave the logger powered for 3 to 5 minutes so that the capacitor has time to fully saturate or the observed sleep current could read artificially high. Loggers built with ‘-M’ RTC chips sleep about 1µA higher than loggers built with ‘-SN’ chips:

Measuring tiny sleep currents in the µA range can not be done easily with cheap multimeters because they burden to whole circuit with so much extra resistance. So you need a special tool like the uCurrent GOLD multimeter adapter (~$75) or the Current Ranger (shown above) from LowPowerLab (~$150 w screen & battery). The only ‘commercial’ device for measuring tiny currents that’s remotely affordable is the AltoNovus NanoRanger but you can also do the job with an oscilloscope if you have that skillset. Note that to do this test you still have to start the logger via the serial menu with the UART connected, then disconnect the UART being careful not to giggle the battery spring connections. Finally switch the range down sequentially from mA to µA or nA.

If a logger seems to have sleep current in the 600-700µA range, that’s often due to the RTC alarm being on (active low) which causes a constant drain through the 4k7 pullup resistor on SQW until that alarm gets turned off. Also check that the ADC is properly disabled during sleep, as that will draw ~200µA if it’s somehow left on. Occasionally you run into a ProMini clone with fake Atmel 328P chips that won’t go below ~100µA no matter what you do. But even with a high 100µA sleep current logger, a new Cr2032 should run the logger for about a month measuring something like temperature, and 10 days with a high power demand sensor like the BME280. This is usually enough run time for data acquisition within a course schedule even if the problem never gets resolved. A few student loggers will still end up with hidden solder bridges that require a full rebuild. This can be emotionally traumatic until they realise how much easier the process is the second time round. Once you’ve made a few, a full logger can usually be assembled in less than 1.5 hours and it’s faster if you make them in batches so that you have multiple units for testing at the same time.

Weak battery springs, or sloppy plastic molding on the RTC module can make a logger vulnerable to bumps that disconnect power (causing the logger to shut down). Most of the time the battery can be secured reasonably well by simply by laying a line of hot glue along the top edge opposite the positive contact spring. This is easily removed after the deployment:

Occasionally you get an RTC module with a battery holder loose enough that the coin cell can actually rock from side to side, pivoting on the negative contact spring. This more extreme loose battery case requires two drops of glue under the coincell:

Place a small drop of hot glue on both sides of the battery holder taking care not to get any on the metal contacts. While the glue is still hot, GENTLY press in a new coin cell in until the side clip engages.
Don’t press the battery too hard – the glue should remain thick enough to brace both sides of the battery. The photo above shows the intended shape after battery removal: The glue is perfectly conformed to the edges of the cell and is nowhere near the metal contacts.
The battery will be significantly more difficult to remove at the end of a deployment, as compared to the glue line on top. So this more robust 2-drop approach is usually reserved for critical/rough deployments.

Sleep current is more of a diagnostic tool than a requirement: you can usually run a course without measuring these currents by simply running the loggers for a week between labs while recording the battery voltage. If that graph falls slowly to a plateau near 3.05v and then stays there for a long time – your logger is probably sleeping at the expected 3-5µA. However, if you can measure the sleep you add exercises to estimate logger run time with online battery life calculators like the one from Oregon Embedded. Order a box of 200 cheap coin cell batteries before running a course, because if a student accidentally leaves a logger running blink it will drain a battery flat in a couple of hours. This will happen regularly.


Running the labs:

The basic two module combination in this logger can log temperature via the RTC. This 0.25°C resolution record enables many interesting temperature-related experiments, for example:

  • Log the temperature inside your refrigerator for 24 hours to establish a baseline
  • Defrost your freezer and/or clean the coils at the back of the machine
  • Log the temperature again for 24 hours after the change
  • Calculate the electric power saved by comparing the compressor run time (ie: while the temperature is falling) before & after the change

Note that the housing, the air inside it, and the thermal inertia of the module stack, result in ~5 to 10 minutes lag behind temperature changes outside the logger.

The small form factor of the e360 enables other benchtop exercises like this Mason jar experiment. The loggers are sealed in a cold jar taken directly from the freezer with a BMP280 sampling pressure & temp. every 15 seconds. The jars are then placed in front of a fan which brings them to room temp in ~45 minutes. For a comparison dataset, this experiment can also be done in reverse – sealing the loggers in room temperature jars which are then cooled down in a freezer; although that process takes longer.

Through no fault of their own, students usually have no idea what messy real-world data looks like, and many have not used spreadsheets before. So you will need to provide both good and bad example templates for everything, but that’s easy enough if you ran the experiment a dozen times yourself at the debugging stage.

Even then students will find creative ways to generate strange results: by using a cactus for the evapotranspiration experiment or attempting the light sensor calibration in a room that never rises beyond 100 Lux. Deployment protocols (Sensor Placement, etc.) are an important part of any environmental monitoring course, and ‘unusable data’ ( though the logger was working ) is the most common project failure. It is critical that students download and send graphs of the data they’ve captured frequently for feedback before their project is due. Without that deliverable, they will wait until the hour before a major assignment is due before discovering that their first (and sometimes only) data capturing run didn’t work. This data visualization is required for ‘pre-processing’ steps like the synchronization of different time series and for the identification of measurements from periods where the device was somehow compromised. Your grading rubric has to be focused on effort and understanding rather than numerical results, because the learning goals can still be achieved if they realize where things went wrong.

The temperature readings have serious lag issues while the pressure readings do not. A good lesson in thinking critically about the physical aspects of a system before trusting a sensor. With the built-in 4096 byte EEprom, saving all three 2-byte Bmp280 outputs (temp, pressure & altitude) plus two more bytes for RTCtemp & battery, gives you room for 512 of those 8-byte records. If you sample every fifteen seconds, the logger will run for two hours before the RTC’s 4k memory is full. The test shown above was done with a ‘naked’ logger, but when the loggers are used with inside the centrifuge body tube the enclosed temperature sensors have about 15 minutes of thermal lag behind changes in air temperature outside the tube.

Try to get your students into the habit of doing a ‘fast burn’ check whenever the logger is about to be deployed: Set the logger to a 1-second interval and then run it tethered to the Uart for 20-30 seconds (with serial on) . Then restart the serial monitor window to download those records to look at the data. This little test catches 90% of the code errors before deployment.


Important things to know:

Time: You need to start ordering parts at least three months before your class. If a part cost $1 or less, then order 3-4x as many of them as you think you need. Technical labs take a week to write, and another week for debugging. Expect to spend at least an hour testing components before each lab. The actual amount of prep also depends on the capabilities of your student cohort, and years of remote classes during COVID lowered that bar a lot. Have several spare ‘known good’ loggers (that you built) on hand to loan out so temporary hardware issues don’t prevent students from progressing through the lab sequence while they trouble-shoot their build. Using different colored breadboards on those loaners makes them easy to identify later. Measuring logger sleep current with a DSO 138 scope or a Current Ranger will spot most hardware related problems early, but students don’t usually get enough runtime in a single course to escape the bathtub curve of new part failures.

Yes, some of that student soldering will be pretty grim. But my first kick at the can all those years ago wasn’t much better and they improve rapidly with practice. As long as the intended electrical contact is made without sideways bridges, the logger will still operate.

Money: Navigating your schools purchasing system is probably an exercise in skill, luck and patience at the best of times. Think you can push through dozens of orders for cheap electronic modules from eBay or Amazon? Fuhgeddaboudit! We have covered more than half of the material costs out of pocket since the beginning of this adventure, and you’ll hear that same story from STEM instructors everywhere. If you can convince your school to get a class set of soldering irons, Panavise Jr. 201s, multimeters, and perhaps a 3D printer with some workshop supplies, then you are doing great. Just be ready for the fact that all 3D printers require maintenance, and the reason we still use crappy Ender3V2’s is that there’s no part on them that can’t be replaced for less than $20. We bought nice multi-meters at the beginning of this adventure but they all got broken, or grew legs, long before we got enough course runs with them. We now use cheap DT830’s and design the labs around it’s burden-voltage limitations. Small tools like 30-20AWG wire-strippers and side-snips should be considered consumables as few of them survive to see a second class. Cheap soldering irons can now be found for ~$5 (which is less than tip replacement on a Hakko!) and no matter which irons you get the students will run the tips dry frequently. The up side of designing a course around the minimum functional tools is that you can just give an entire set to any students who want to continue on their own after the course. That pays dividends later that are worth far more than a given years budget.

An inexpensive BMP280 can be used as a temperature reference for the thermistor calibration lab. At a 1 minute interval the logger will run for 16 hours before the 4K EEprom is full. The logger should remain in each of the three water baths for 8 hours to stabilize. To hold the 50mL e360 down in the water baths attach six M10 x 30mmOD x 2mm stainless steel washers (~80 grams of metal).
With insulated lunch box containers, the 0°C distilled water bath develops a nice rind of ice after being left in the freezer over night. No reference sensor is needed for the ice point because that is a physical constant.

All that probably sounds a bit grim, but the last thing we want is for instructors to bite off more than they can chew. Every stage in a new course project will take 2-3x longer than you initially think! So it’s a good idea to noodle with these loggers for a few months before you are ready to integrate them into your courses. Not because any of it is particularly difficult, but because it will take some time before you realize the many different ways this versatile tool can be used. Never try to teach a technical lab that you haven’t successfully done yourself several times.

A good general approach to testing any DIY build is to check them on a doubling schedule: start with tethered tests reporting via the serial monitor, then initial stand-alone tests at 1,2,4 & 8 hours till you reach a successful overnight run. Follow this by downloads after 1,2 ,4 & 8 days. On the research side of the project, we do short sample-interval runs to full memory shutdown several times, over a couple of weeks of testing, before loggers are considered ready to deploy in the real world. Even then we deploy 2-3 loggers for each type of measurement to provide further guarantee of capturing the data. In addition to assuring data integrity, smooth battery burn-down curves during these tests are an excellent predictor of logger reliability, but to use that information you need to be running several identical machines at the same time and start them all with the same fresh batteries so you can compare the graphs to each other. A summer climate station project with five to ten units running in your home or back yard is a great way to start and, if you do invest that time, it really is worth it.

Common coding errors like variable overflows usually generate repeating patterns of errors in the data. Random logger quits are usually hardware connection or bus-timing related and the best way to spot the problematic code is to run with “Made it to Point A/B/C/etc” comments printed to the serial monitor during the test runs. In battery operated stand-alone mode you can use different indicator LED colors for the different sections of your code. Then when the processor locks up you can just look at the LED and know approximately where the problem occurred.


Last Word:

The build lab at the beginning of the course – with everybody still smiling because they still have no idea what they are in for. The course is offered to earth & environmental science students. Reviewing Arduino based publications shows that hydrologists & biologists are by far the largest users of Open Science Hardware in actual researchnot engineers! Traditional data sources rarely provide sufficient spatiotemporal resolution to characterize the relationship between habitats and organisms.

Why did we spend ten years developing a DIY logger when the market is already heaving with IOT sensors transmitting to AI back-end servers? Because the only ‘learning system’ that matters to a field researcher is the one between your ears. Educational products using pre-written software are usually polished plug-and-play devices, but the last thing you want in higher education is something that black-boxes data acquisition to the point that learners become mere users. While companies boast that students can take readings without hassle and pay attention only to the essential concepts of an experiment that has never been how things work in the real world. Trouble shooting by process-of-elimination, combined with modest repair skills often makes the difference between a fieldwork disaster and resounding success. So sanitized equipment that generates uncritically trusted numbers isn’t compatible with problem-based learning. Another contrast is the sense of ownership & accomplishment that becomes clear when you realize how many students gave their loggers names and displayed them proudly in their dorm after the course. That’s not something you can buy off a shelf.


References & Links:
Waterproofing your Electronics Project
Successful field measurements when logging stream temperatures
Examples of soil temperature profiles from Iowa Environmental Mesonet
Oregon Embedded Battery Life Calculator & our Cr2032 battery tests
A practical method for calibrating NTC thermistors
Winners of the Molex Experimenting with Thermistors design challenge
Sensor Response Time Calculator
Calibrating a BH1750 Lux Sensor to Measure PAR
How to Normalize a Set of BMP280 Pressure Sensors
How to test and Calibrate Humidity Sensors (most RH sensors are not reliable outdoors)
Setting Accurate Logger time with a GPS & Calibrating your RTC

And: We made a Classroom Starter Kit part list back in 2016 when we were still teaching with UNOs and a post of Ideas for your Arduino STEM Curriculum. Those posts are now terribly out of date, but probably still worth a read to give you a sense of things you might want to think about when getting a new course off the ground. Those old lists also predate our adoption of 3D printing, so I will try post updated versions soon. The bottom line is that if you are going to own a 3D printer you should expect to have to completely tear down the print head and rebuild it once or twice per year. While they are the bottom of the market in terms of noise & speed, every possible repair for old Enders is cheap and relatively easy with all the how-to videos on YouTube. Those videos are your manual because Creality broke the cost barrier to mass market adoption by shipping products that were only 90% finished, with bad documentation, and then simply waiting for the open source hardware community to come up with the needed bug-fixes and performance improvements. X/Y models are more robust than bed-slingers, but our Ender 3v2’s have been reliable workhorses provided you stick to PLA filament. If you want a fast turn-key solution then your best option is one of the Bambu Labs printers like the A1 because they are essentially plug&play appliances. But if you enjoy tinkering as a way of learning, that’s Ender’s bread & butter. A bed level touch sensor is -by far- the best way to get that critical ‘first layer’ of your print to stick to the build plate and the E3V2 upgraded with a CRtouch & flashed to MriscoC is an OK beginners rig. Our local computer stores always seem to brand new 3v2’s for about $100 as a new customer deal but these days I buy cheap ‘for parts’ Ender5 S1’s from eBay for about that price and fix them up because 120mm/s is about the minimum speed I have the patience for. Now that multi-color machines are popular, what used to be high-end single-color machines are being discounted heavily so even brand new E5S1’s are selling for about $200 in 2025 if you look around. Having two printers means a jam doesn’t bring production to halt just before fieldwork, and by the time you get three printers the speed issues disappear and you can dedicate machines to different filaments. Keep in mind that no matter how fast your printer is capable of moving the print head, materials like TPU and PETG will still force you to print at much slower rates if you want clean prints with tight tolerances. To reduce noise, I usually put the printer onto a grey 16x16inch cement paver with some foam or squash ball feet under it.

Printer jams like this are inevitable. But if you don’t manage to fix it, a pre-assembled replacement hot end for an Ender3v2 is only $10. I find that it’s better to have multiple slower printers than one high-end machine because then a single jam or failure doesn’t take out all of your production capacity just before a fieldwork trip. Functional prints rarely have to be pretty – so you can speed up production with lower quality settings.

Avoid shiny or multi-color silk filaments for functional prints as they are generally more brittle and crack easily. Prints also get more brittle as they absorb humidity from the air. If that happens, cyanoacrylate glue + baking soda can be used for quick field repairs. It’s worth the extra buck or two to get filaments labeled as PLA pro as they usually have better durability in trade for slightly higher printing temperature (as long as the company was not lying about their formulation). I use a food dehydrator I bought used from a local charity shop to dry out my PLA or PETG filaments if they have been open for more than a couple of weeks. Really hygroscopic filaments (like PVA, TPU or Nylon) have to be dried overnight before every single print. Most machines work fine with the defaults, but you can get great prints out of any printer provided the bed is leveled, the e-steps & flow are calibrated, and the slicer settings are tuned for the filament you are using. If you are using Cura there is a plugin called AutoTowers Generator that makes special test prints. You print a set of those (for temperature, flow rate and then retraction) and set your slicer settings to match the place on the tower where the print looks best. You may have to do this for each brand of filament as they can have quite different properties. I rarely use filaments that cost more than $15/kg roll because functional prints don’t have to be that pretty and you will be tweaking each design at least 10 times before you iterate that new idea to perfection. I stock up on basic black/white/grey on Amazon sale days for only $10/roll. Once you get the hang of it, most designs can use 45° angles and sequential bridging to print without any supports. Conformal coating or a layer of clear nail polish prevents marker ink from bleeding into the print layers when you number your deployment stations.

Our Lux-to-PAR calibration post is a good example of the physical problems that have to be solved before you can collect good data: A printed shield was necessary for to keep the temp sensors cool under direct sun and a ball joint was required for leveling. A ground spike was needed for the mounting. I have started bumping up against the limits of what you can do in Tinkercad with some of our more complex designs, but OnShape is there waiting in the wings when I’m ready.

As a researcher, becoming functional with Tinkercad and 3D printing is a better investment of your time than learning how to design custom PCBs because it solves a much larger number of physical issues in experiments and deployment conditions. That said, it’s not usually worth your time to design things from scratch if you can buy them off the shelf. So people get into 3D printing because what they need does not exist or is outrageously expensive for what it does. All FDM prints are porous to some extent because air bubbles get trapped between the lines when they are laid down – so they are not waterproof like injection molded parts unless you add extra treatment steps. UV-resistant clear coating sprays are a good idea for outdoor deployment. I don’t have much use for multi-color printing, but when they advance to supporting multiple materials I will be interested because being able to print at TPU gasket inside a PETG housing in one shot would be quite useful. Anything you print in PLA will slowly creep and bend out of shape under full summer sun – even faster if the filament is not white..

If you are just getting started and looking for something to learn the ropes you can find useful add-ons to your printer on thingyverse or, you could try organizing your workspace with the Gridfinity system from Zack Freedman. You will also find lots of handy printable tools out there for your lab bench searching with the meta-engines like Yeggi or STLfinder. A final word of warning: this hobby always starts with one printer… then two… then… don’t tell your partner how much it cost.

Addendum 2026: Adding a note here that after years of successfully using the Silabs CP2102 on all three platforms we have started to see more issues installing the UART drivers on the Apple Macs. While the SiLabs VCP installer for Macs is universal, supporting both intel and M-series processors, the newer versions of that OS hide the pop-up buttons that you must press to [ALLOW] the driver installation to proceed. Depending on your OS version, this may appear in the Privacy & Security control panel, or you may have to go to: System settings > General> Login Items and then open: Extensions > Driver Extensions to see the [ALLOW] button during the instal. If you don’t press those hidden buttons the installer just hangs with no progress on screen. Another problem that we’ve only seen on macs is strange asymmetrical delays where uploads are working fine ,and any data from the logger downloads to the computer OK, but only single digits can be sent quickly from the send line at the top of the serial window to the logger. If longer text strings are entered the serial monitor freezes for a couple of minutes. If you just sit there waiting it does -eventually- get sent. I’m convinced theres yet another popup window that the system is hiding somewhere, and things can’t proceed until that times out.

Testing Cr2032 Coin Cell Batteries with μA to mA pulsed duty cycles

Cr2032 Internal Resistance vs mAh [Fig6 from SWRA349] Our peak load of ~8 mA while writing data to the EEprom creates a voltage drop across the battery IR. The load induced transient on the 3v Cr2032 can’t fall below 2.775v or the BOD halts the 328p processor. This limits our useable capacity to the region where battery IR is less than 30 ohms. This also makes it critical to control when different parts of the system are active to keep the peak currents low. With this relatively high cutoff we can only use about 100 milliampseconds of power from a typical CR2032.

Reviewers frequently ask us for estimates based on datasheet specifications but this project is constantly walking the line between technical precision and practical utility. The dodgy parts we’re using are likely out of spec from the start but that’s also what makes our 2-module data loggers cheap enough to deploy where you wouldn’t risk pro-level kit. And even when you do need to cross those t’s and dot those i’s you’ll discover that OEM test conditions are often proscribed to the point of being functionally irrelevant in real world applications. The simple question: “How much operating lifespan can you expect from a coin cell?” is difficult to answer because the capacity of lithium manganese dioxide button cells is nominal at best and wholly dependent on the characteristics of the load. CR2032’s only deliver 220mAh when the load is small: Maxell’s datasheet shows that a 300 ohm load, for a fraction of a second every 5 seconds, will drop the capacity by 25%. However, if the load falls below 3μA for long periods, then this also causes the battery to develop higher than normal internal resistance, reducing the capacity by more than 70%. The self-discharge rate increases with temperature due to electrolyte evaporating through the edge seal. Another challenge is ambient humidity which can change PCB leakage currents significantly.

Voltage Under EEprom load VS date [runtime hours in legend] with red LED on D13 driven HIGH for 1.4mA sleep current, 30second interval, 8-byte buffer. These are serial tests performed on the same logger. 1.4mA continuous is probably is not relevant to our duty cycle.

Surprisingly little is known about how a CR2032 discharges in applications where low μA level sleep currents are combined with frequent pulse-loads in the mA range; yet that’s exactly how a datalogger operates. As a general rule, testing and calibration should replicate your deployment conditions as closely as possible. However, normal run tests take so long to complete that you’ve advanced the code in the interim enough that the data is often stale by the time the test is complete. Another practical consideration is that down at 1-2μA: flux, finger prints, and even ambient humidity skew the results in ways that aren’t reproducible from one run to the next. So a second question is “How much can you accelerate your test and still have valid results?” Datasheets from Energiser, Duracell, Panasonic and Maxell reveal a common testing protocol using a 10-15kΩ load. So continuous discharges below 190μA shouldn’t drive you too far from the rated capacity. Unfortunately, that’s well below the 3-400 ohm loads you get with cheap battery testers, or videos on YouTube, so we are forced yet again to do our own empirical testing.

The easiest way to increase our base load is to leave the indicators on: all three LEDs will add ~80μA to the sleep current when lit using internal the pullup resistors. 80μA is ~16x our normal 5μA sleep current (including sensor draw & RTC temp conversions). A typical sampling interval for our work is 15min so changing that to 1 minute gives us a similarly increased number of EEprom save events. With both changes, we tested several brands to our 2775mv shut-down:

Cr2032 Voltage Under EEprom Load VS Date: Accelerated Cr2032 run tests with 3xLED lit with INPUT_PULLUP for ~80μA sleep current although each unit was slightly different as noted, 1min sampling interval. Blue Line = Average excluding Hua Dao. CLKPR reduced system clock to 1MHz during eeprom save on this test to reduce peak currents to about 6mA. All units had 227E 25V 220μF rail buffering caps.
BrandRun Time (h)Cost / Cell|BrandRun Time (h)Cost / Cell
Panasonic1500$ 1.04|Duracell1298$ 1.81
Voniko1448$ 0.83|AC Delco1223$ 0.79
Maxell1444$ 0.58|Nightkonic1186$ 0.24
Toshiba1325$ 0.64|MuRata1175$ 0.45
Energiser1307$1.28|Hua Dao642$ 0.14
Note: With the slight variation between each loggers measured sleep current, the times listed here have been adjusted to a nominal 80μA. Also note that the price/cell is highly dependant on vendor & quantity.

Despite part variations these batteries were far more consistent on that 20ohm plateau than I was expecting. This ~15x test gives us a projected runtime of more than two years! That’s twice the estimate generated by the Oregon Embedded calculator when we started building these loggers. We did get a 30% delta between the name brands, but these tests were not thermally controlled and we don’t know how old the batteries were before the test. The rise in voltage after that initial dip is probably the pulse loads removing the passivation layer that accumulates during storage. The curves are a bit chunky because the 328P’s internal vref trick has a resolution of only 11mv, and we index-compress that to one byte which results in only 16mv/bit in the logs.

One notable exception is the Hua Dao cells, which I tested because, at only 14¢ each, they are by far the cheapest batteries on Amazon. My guess they are so cheap because they used a lower grade of steel for the shell which increases the cell resistance. We have many different runs going at any one time, and to make those inter-comparable you need to start each test with a fresh cell. Even if the current run test doesn’t need a batteries full capacity sometimes you just need to eliminate that variable while debugging. You also use a lot of one-shot batteries for rapid burn-in tests so it makes sense for them to be as cheap as possible. Now that I know Hua Dao delivers half the lifespan of name brand cells, I can leverage that fact to run some of those tests more quickly. I had planned on doing this with smaller batteries but the Rayovac Cr2025 I tested ran for 1035 hours – longer than the Hua Dao Cr2032!

Cr2032’s used since January for bench testing.

Testing revealed another complicating factor when doing battery tests: With metal prices sky-rocketing, fake lithium batteries are becoming more of a problem. We’ve been using Sony Cr2032’s from the beginning of the project but the latest batch performed more like the Hua Dao batteries. This result was so unexpected that I dug through the bins for some old stock to find that the packaging looked slightly different:

Fake (left) vs Real (right)

On closer inspection it didn’t take long to spot the fraud:

Fake Sony Battery : laser engraved logo
Real Sony Battery: Embossed logo

More tests are under way so I’ll add those results to this post when they are complete. A couple of the 80μA units have been re-run after removing the 227E 25V 220μF rail buffering caps, confirming that the tantalum does not extend overall run time on good batteries very much because their internal resistance rises slowly, but rail caps can more than double the lifespan with poor quality batteries like the Hua Dao. In my 5min tests at 3 volts, [477A] 10v 470μF caps fell to a leakage of about 160nA or about 3x more than the 60nA on a [227E] 25v 220μF tantalum. After leaving them connected (through a 4k7 limiting resistor) on a breadboard for 24 hours the 470uF fell to only 30nA and the 220uF fell to 20nA. 6v volt [108J] 1000μF rail caps have much higher 980nA leakage which is larger than the DS3231’s typical constant Ibat of 840nA. This shortens overall logger runtime to only 6-7 months: so very large rail caps are only useful with high drain sensors or in cold conditions.

Very old tantalum capacitors like the ones you get from eBay may require a resistor-limited “reforming” process to restore their dielectric or you could see high leakage because of damaging inrush currents when they are first connected to power. I now pretreat my tantalums by connecting them through a 10k limiter, and letting them just sit in that state for at least 24 hours before using them. Usually the caps just sit on the breadboard (shown here) until I’m ready to use them…sometimes for a couple of weeks.

A startup-shorted tantalum can have leakage currents as high as 10uA which scuppers your low current device.

Northern caves hold near 5-10°C all year round, so the current set is running in my refrigerator. I will follow that with hotter runs because both coin cell capacity AND self-discharge are temperature dependant. We also plan to start embedding these loggers inside rain gauges which will get baked under a tropical sun .

Addendum 2023-08-01

This summers fieldwork required all of the units in my testing fleet so I only have a handful of results from the refrigerator burn down tests [@5°C]. The preliminary outcome is that, compared to the room temperature burns, the lithium cell plateau voltage lowers between 80-100mv (typically from 3000mv to 2900mv). Provided the loggers were reading a low drain sensor the ‘cold’ lifespan was only about 20% shorter because the normal 50-70mv battery droop (during sensor reading / eeprom save) only becomes important after the battery falls off its plateau. This is approximately the same lifespan reduction you see running at room temp without a rail buffering capacitor – as the buffer also only comes into play when the battery voltage is descending. This is also the reason why the larger 1000μF rail capacitors usually only provide about 10% longer life than the 220μF rail caps as the reduced battery droop with the larger cap only comes into play when the cell is nearing end of life. Net result is that increasing to 1000μF rail buffers almost exactly offsets the lifespan losses at colder ambient temps to 0°C . But for longer deployments, at normal room temps, the 1-2μA leakage of a 6v 1000μF [108j] tantalum removes any advantage over the 25v 220μF [227e] which has only 5nA leakage at 3 volts. Also note that some caps seem to need a few hours to ‘burn in’ before they are saturated enough to measure their leakage properly.

Weak battery springs, or sloppy plastic moulding on the RTC module can make a logger vulnerable to bumps that disconnect power (causing the logger to shut down). Most of the time the battery can be secured reasonably well by simply by laying a line of hot glue along the top edge opposite the positive contact spring. This is easily removed after the deployment:

Occasionally you get an RTC module with a battery holder loose enough that the coin cell can actually rock from side to side, pivoting on the negative contact spring. This more extreme loose battery case requires two drops of glue under the coincell:

A good method to secure the cr2032 is to place a small drop of hot glue on both sides of the battery holder taking care not to get any on the metal contacts. While the glue is still hot, GENTLY press in a new coin cell in until the side clip engages.
Don’t press the battery too hard – the glue should remain thick enough to brace both sides of the battery. The photo above shows the intended shape after battery removal: The glue is perfectly conformed to the edges of the cell and is nowhere near the metal contacts.
The battery will be significantly more difficult to remove at the end of a deployment, as compared to the glue line on top. So this more robust 2-drop approach is usually reserved for critical/rough deployments.

The freezer results are an entirely different situation where are only seeing a few days of accelerated 100μA sleep current operation because once you get below -17°C the voltage starts to droop below our 2800mv shutdown voltage during EEprom saves. So the logger only operates for the brief span of time where the initial overvoltage on new Cr2032 is still above its nominal plateau voltage. For truly cold weather deployments you’d need a different battery chemistry like lithium-thionyl chloride (LiSOCl2) which is good to -40°C provided you add a large rail buffering capacitor to compensate for it’s current limitations. Loggers drawing the normal 2-5μA sleep current should still run OK in a domestic freezer provided the sensor is not too demanding – but that’s about the practical limit for these loggers. In fact we use waters 0°C phase transition as a reference when calibrating the onboard thermistors – and that’s done on a normal CR2032.

Addendum 2025-01-25

Finally getting the 2024 deployments swapped out, so I have some real-world burn down curves to add here. These units were in a U.S. cave rather than our typical Mexico field sites, so temps were cool enough to have some effect on the cell voltage:

11 months of [°C] temperature variation near the entrance of the cave, read by an NTC thermistor on the logger.
A new NightKonic Cr2032 coin cell was installed at the start of the deployment. This logger had a continuous sleep current of 1.2µA, but the RTC TXCO corrections bump that to >3µA average.
[°C] temperature variation is reduced as you move further into the cave (until eventually there is little of the outside annual climate signal left.)
Again a new NightKonic battery was used with this 1.6µA (continuous) sleeper. Lowest battery under load was saved once per day for these records.

With normal runtime operations the CR2032s plateaued near the nominal 3v with a 220µF rail buffering cap. It’s hard to tell if that slight shift indicates the end of the batteries 20ohm plateau or was just a response to the lower winter temperatures. Assuming that was the end of the plateau, then I’d expect another three (?) months of operation before the internal resistance pushes the voltage droop during EEprom saves to our 2800mv cutoff. Both were deployed with 1 gram of desiccant, which probably was not enough for the 30mL polypropylene tubes (given the color of the indicator beads when the loggers were downloaded). Unsaturated silica gel holds the air near 20%, but these loggers probably spent half of their deployment at high RH. I rarely put desiccant in my testing loggers and on the rare occasion when I forget one of them long enough for the Cr2032 to fall below 1000mv there is “a particular smell” that is quite noticeable when the logger is opened. That makes me wonder if electrolyte off-gassing also affects the color of the desiccant indicators beads.

The take home lesson is: when your accelerated testing indicates a two year lifespan under optimal conditions, you should expect to reach only half of that on a real-world deployment. If I assume a 3.5µA sleep current (ie: the DS3231’s timekeeping average incl. TXCO conversions) with four 3.5mA x 50msec logging events per hour, then the Oregon Embedded calculator gives me an 100mAh battery life of 958 days. Interestingly, the capacity of a 256k EEprom @ 15min interval storing 4bytes/record is also about 680 days. Taken together, these factors mean our loggers should only be expected to operate for a year – plus – a healthy 3-6 month margin if you used a good Cr2032 battery. It’s also worth looking at how many I2C transactions you are doing per record as they can add significant CPU runtime. At the 100khz default each byte takes ~100 µs, and a typical sensor transaction will easily exchange ten bytes.

One unknown variable is the self-discharge rate of the Cr2032. I’ve seen references to a nominal 1% loss in battery capacity per year under ideal conditions, which would be like adding another 300nA of continuous load. But that loss can be up to 10x larger in high humidity environments. To minimize capacitor leakage current, try choose caps with a voltage rating that’s 3x larger than the expected operational range.

Another variable that can have a serous impact on lifespan is the number of EEprom save events per day. In my tests a typical EEsave uses between 0.3-0.5 milliamp seconds of power, with sensor readings using a similar amount/record. (in comparison to a ‘good’ loggers sleep-current baseload of about 250-300 milliamp-seconds per day) So a few hundred EEsave events could potentially use power comparable to the sleep current each day. EEproms have to erase and re-write an entire page of memory any time you save a number of bytes less than the hardware page size. If you increase the two wire library buffers, and pre-buffer the sensor data into temporary arrays, you can increase the bytes per EEsave event from 16 to 64 (or even 128) to reduce the number of save events. When you transfer the same number of bytes as the EEproms hardware page size then the chip can skip any ‘pre-erase’ steps entirely – cutting ALL save events to 1/2 the time/power they would use saving a smaller number of bytes. This both increases speed and can extend operating lifespan significantly with multi sensor configurations collecting many bytes of data per record over short 1-5 minute sampling intervals.

Links & References:

Evaluating Battery Models in Wireless Sensor Networks, Rohner et.al.
ATmega328 Calculation Speed tables

A DIY Pressure Chamber to Test Underwater Housings

Pressure testing has been on the to-do list for ages, but the rating on the PVC parts in our older housings meant we weren’t likely to have any issues. However, the new two-part mini-loggers fit inside a thin walled falcon tube, which raised the question of how to test them. There are a few hyperbaric test chamber tutorials floating around the web, and we made use of one built from a scuba tank back at the start of the project, but I wanted something a less beefy, and easier to cobble together from hardware store parts. Fortunately Brian Davis, a fellow maker & educator, sent a photo of an old water filter housing he’d salvaged for use with projects that needed pressure tests. Residential water supply ranges from 45 to 80 psi so could replicate conditions down to 55m. That’s good for most of our deployments and certainly farther than I was expecting those little centrifuge tubes to go.

This mini pressure chamber was made from a Geekpure 4.5″x10″ water filter housing, 2x male-male couplers, a garden tap, & a pressure gauge with a bicycle pump inlet. (~$70 for this combination) The relief valve & o-ring required silicone grease to maintain pressure.

I first tested 50mL ‘Nunc’ tubes from Thermo. These are spec’d to 14psi/1atm, but that’s a rating under tension from the inside. I put indicator desiccant into each tube so small/slow leaks would be easy to see and used a small bicycle pump to increase the pressure by 5psi per day. These tubes started failing at 25psi, with 100% failure just over 30psi. Multiple small stress fractures occurred before the final longitudinal crack which produced an audible ‘pop’ – often four or more hours after the last pressure increase. If 20psi is the max ‘safe’ depth for these tubes then the 50mL tubes can deployed to about 10m with some safety margin for tides, etc. This result matches our experience with these tubes as we often use them to gab water samples while diving.

[Click photos to enlarge]

As expected, the self-standing 30mL tubes proved significantly more resistant. All of them made it to 45psi and then progressed through various amounts of bending/cracking up to 100% failure at 55psi. Where the caps were reinforced (by JB weld potting a sensor module) the rim threads of the cap sometimes split before the tube itself collapsed:

Silicone grease was added to some of the caps although none of the dry ones leaked before the bodies cracked.

So the 30mL tubes have a deployment range to 25m with a good safety margin. The plastic of these tubes was somewhat more flexible with some crushing almost flat without leaks. This implies we might be able take these a little deeper with an internal reinforcement ring (?)

The next experiment was to try filling the tubes with mineral oil to see how much range extension that provides:

A third logger was submerged using only a sample bag:

The bag was included to test the ‘naked’ DS3231 & 328p chips. We’ve had IC sensors fail under pressure before (even when potted in epoxy ) Although it’s possible the encapsulation itself was converting the pressure into other torsional forces that wouldn’t have occurred if the pressure was equally distributed.

Again we moved in 5 psi increments up to 80 psi – which is the limit of what I can generate with my little bicycle pump. At 50psi some mineral oil seeped from the bag and at 70psi the ~1cm of air I’d left in the 50mL tube caused similar leakage. On future tests I will spend more time to get rid of all the bubbles before sealing the housings.

At 70psi the 50mL tube dented & sank and the lid started seeping oil (but did not crack)

The loggers continued blinking away for several days at 70, 75 & 80psi, but eventually curiosity got the best of me so I terminated the run. We were also getting uncomfortably close to the 90psi maximum test pressure on that polycarbonate filter housing. I was hoping to have some weird artifacts to spice up this post but no matter how hard I squint there really were no noticeable effects in the data at any of the pressure transitions – basically nothing interesting happened. I thought the resistive sensors would be affected but the RTC & NTC temperature logs have no divergence. The LDR looks exactly like a normal LDR record with no changes to the max/mins outside of normal variation. The battery curves are smooth and essentially indistinguishable from ‘dry’ bookshelf tests on the same cells. But I guess in this kind of experiment success is supposed to be boring… right? With mineral oil these little guys can go anywhere I can dive them to – even if the ‘housing’ is little more than a plastic bag.

One thing of note did happen after I removed the loggers from the chamber: I accidentally dropped the 30ml logger on the counter while retrieving it from the chamber and a thin white wisp of ‘something’ started swirling around the clear fluid inside the logger. This developed slowly and my first guess was that the capacitor had cracked and was leaking (?)

By the time I managed to capture this photo, the fine ‘smoke’ seen earlier had coalesced into a larger foam of decompression bubbles.

After emptying that oil, the logger itself went into a red D13 flashing BOD loop for a while but by the time I’d cleaned it up enough to check the rail, the battery had returned to it’s nominal 3v. My theory is a similar off-gassing event was happening inside the battery – briefly causing a droop below the 2.7v BOD threshold. So it’s possible that while the loggers are not depth limited per se using mineral oil, components like the separator in a battery may still be vulnerable to ‘rate-of-change’ damage. After more than two weeks at depth, I had vented the chamber in less than a minute. Of course when retrieving loggers in the real world I’d have to do my own safety stops, so this hazard may only affect loggers that get deployed/retrieved on a drop line.

I’ll run these loggers on the bookshelf for a while to see if any other odd behaviors develop. After that it will be interesting to see how well I can clean them in a bath of isopropyl (?) as I suspect that the mineral oil penetrated deep into those circuit board layers.

Addendum: 2023-05-30

Although the units sleep current was the same as before the pressure testing, the battery in the 30mL tube barely made another twelve hours on the bookshelf before the voltage dropped again – well before the expected remaining run time. So it’s a safe bet that any deployment which exposes coin cells to pressure at depth is a one-shot run. Given how cheap these batteries are, that’s pretty much a given when deploying these little loggers even if they remain dry.

Addendum: 2023-12-01

Short 30ml tubes work well for single-sensor applications, but classroom labs needed to switch between different sensor modules easily. So we added 3D printed rails holding mini breadboards to provide this flexibility, and the 50mL centrifuge tubes provide the space for these additions. They may not have the same depth range, but they are robust enough for most student experiments.

It’s also worth noting that these tests were done with the standard ‘plug-style’ caps that come with the NUNC 50ml centrifuge tubes. A few companies make tubes  with an O-ring integrated into the cap (made of silicone or ethylene propylene) which gets compressed when the threads are tightened. Those would provide another layer of moisture resistance at that seal, although they wouldn’t do much to prevent the crush-failures. Unfortunately the Nalgene Oak Ridge high-speed polycarbonate centrifuge tubes that could resist those forces have necks pinched-in to a diameter too small for the modules in our logger.

“Too Ugly to Steal & Too Heavy to Carry” : Insights from a decade of rain gauge deployment

A typical climate station from our project with other sensors protected from the direct sun under the bricks. Those loggers get checked carefully because scorpions are particularly fond of these brick stacks.

Most experiments require weather information to put environmental trends into context. So even though the majority of our sensor network is under ground, or under water, each study area includes a climate station on the surface. Our field sites are rarely close enough to government stations for their data to reflect local conditions because the official stations are spatially biased toward population centers and coastlines. As a result, we operate about ten weather stations and of the sensors they contain, tipping bucket rain gauges (TRGs) can be challenging to maintain at stations that only get serviced once or twice a year.

Where to spend your money

A fieldwork photo from early in the project when we were trying many different rain gauge designs. The aluminum funnels at the back are field repairs after the originals became brittle & cracked. Over time, this happens to all of our plastic funnel gauges. It’s worth noting that those aluminum funnels also corrode with organic acids from debris, but that takes 3-4 years instead of just months.

EVERYTHING exposed to full sunlight must be made of metal if you want it to last more than a year. I know there are plenty of tempting rain gauge designs at Thingiverse, but we’ve yet to see even hardened 3Dprints stand up to tropical conditions. This is also true for Stevenson screens, where I’d recommend a stack of metal bowls on stainless threaded rods (like that used by the Freestation project) over most of the pre-made ones on the market. Local varmints love using climate stations as chew toys.

A typical station ready to deploy: Left: Hobo/Onset RG2 and right is the older 6″ Texas Electronics gauge it was based on. The separate loggers recording each TRG also record pressure & temp. The central logger records RH%, but RH sensors are so prone to failure that we no longer combine them with anything else. During installation, washers can be added for leveling where the gauges are bolted to the brick.

If you need one, then you actually need two. So long as you follow that first rule, it’s better to install two medium quality gauges rather than a single new one that eats your budget. When you’re replacing four to six gauges per year, lighter six inch diameter units are much easier to transport your the luggage. Be sure to have a receipt ready for import duty and even if you only paid $100 for that used gauge on eBay you can should expect an additional $100 getting it into another country. (and significantly more for some shiny new gauge that doesn’t have any scratches or dents on it yet) Another reason to double up is that you can pack them into different suitcases. When the airline loses a bag – which happens more often than you’d expect – you still have at least one to deploy. Finally, if you install dual TRG’s from the start of your project, you then have the option of temporarily re-allocating to singles if a tropical hurricane destroys half your stations.

A low budget hack that you can maintain is better than an expensive commercial solution that you can’t. Avoid any system with special unobtainium batteries or connectors that you can’t buy/repair at your fieldwork destination. That sweet looking ultrasonic combo you were drooling over at AGU was probably engineered for the US agricultural market, and may not work at all in Costa Rica. If you do start testing acoustic or optical rain sensors, then have a second low tech backup on the station beside it. Most methods have some sort of ‘blind spot’ where they generate inaccurate data and the only way to spot that is to have data from a different device to compare. Reed switches also have the advantage that they require no power to operate.

A new gauge with a funnel full of standing water after only six months.
The debris snorkel plugged because it was designed for fine mid-west field dust, rather than the soggy leaf debris blowing around in a tropical storm. Pine needles cause similar headaches for researchers in northern climates.
Watch out for siphon mechanisms at the bottom of funnels designed to improve accuracy.
Anything that makes the flow path more convoluted will rapidly clog – so I cut them out.

Location, Location, Location

Installation guidelines for weather stations usually make assumptions that only apply only in wealthy first world countries. This is hardly surprising given that even mid-range kit will set you back $1,000 and pro-level equipment can top $10,000 when you include the wireless transmitters & tripod mounting system. But our research almost never happens under such genteel conditions, so here’s my take on some of those serving suggestions:

This station has never been disturbed.
A brick stack used to raise the funnels above the roof edge walls. These are bound with construction adhesive and industrial zip ties. Rooftop stations are still affected by high winds and falling branches, but just as often the disturbance is from maintenance people working on the water tanks, etc.
  1. Place the weather station in an open area, free from obstructions such as trees or buildings, to ensure proper air flow and accurate wind measurements.
    So what do you do if those open areas only exist at all because someone cut down trees to build? And anemometer measurements are only possible if your kit can stand being hit by several tropical storms per year. Not to mention the amount of unwanted attention they draw. Wind data is one of the few things we rely on government & airport stations for.
  2. Choose a location with a stable and reliable power supply, or consider alternative power sources such as solar panels or batteries.
    The expectation of reliable electricity / internet / cell phone reception is as humorous to a field scientist as the expectation of getting a hot shower every day. For more giggles, why not pop over to the next geo-sci conference in your area and ask them how long their solar powered station in Michigan ran before it was riddled with buckshot. Batteries are your only option, and the system should be able to run at least twice as long as your expected servicing schedule because things never go according to plan.
  3. Locate the weather station in an area that is easily accessible for maintenance and repairs.
    Even in areas that regularly get pummeled by hurricanes, vandalism/theft is our biggest cause of data loss. Any equipment within reach of passers-by will be broken or missing within a couple of months – especially if it looks like a scientific instrument. So it’s worth a good hike through dense jungle to protect your data, even if that makes the station harder to access.
  4. Choose a location away from any artificial sources of heat, such as buildings or parking lots.
    Rooftops are the only locations where we’ve managed to maintain long term stations because they are persistent, hidden from view, and the surrounding trees have been cleared. And in an urban environment…isn’t that, you know, the environment? Yes the thermal data is off because those rooftops go well over 45°C, but temperature is the easiest data to get from tiny little loggers that are more easily hidden at ground level.
  5. Consult with local authorities and meteorological agencies to ensure that the location meets any necessary standards or regulations.
    A solid long-term relationship with the land owner, and your other local collaborators is vital for any research project, but don’t expect local authorities to make time for a friendly chat about your climate station. NGO’s are usually run by volunteers on shoe-string budgets so they’ll be grateful for any hard data you can provide. However, those same groups are often a thorn in the paw of the previously mentioned authorities. Threading that needle is even more complicated when some NGO’s are simply development blockers for large landowners waiting for property values to rise high enough for their own development project to become profitable. In addition to significant amounts of paperwork, public lands suffer from the problem that legislation & staff at the state/territory level can change dramatically between election cycles, sometimes to the point of banning research until the political wind starts blowing in a different direction.

Maintenance

The best maintenance advice is to have separate loggers dedicated to each sensor rather than accumulating your data on one ‘point of failure’ machine, especially when DIY loggers cost less than the sensors. We try to bring enough replacement parts that any site visit can turn into a full station rebuild if needed.

After six years in service I’m surprised this rooftop unit hasn’t been zapped by lightning.
Even with zip-tie bird spikes this gauge still accumulates significant poop each year. This passes through the main filter screen which stops only sticks, seeds & leaves. Chicken wire is another common solution to the bird roosting problem that’s easy to obtain locally.
Funnel & screen after the annual cleaning. This stainless steel kitchen sink strainer works far better than the commercial solutions we’ve tried because it has a large surface area with a section in the middle that rises above most of the debris. It is installed at a slight angle and held in place by wads of plumbers epoxy putty. This has become a standard addition to ALL of our rain gauges even if they already have coarse screens.
You’d think name brand gauge makers (here a Teledyne ISCO) would use stainless steel parts – and you’d be wrong. Sand & coat those internal screw terminals with grease, conformal, or nail polish. This also applies to pipe clamp screws which will rust within one year even if the band itself is stainless.

Like bird spikes and debris snorkels, there are several commercial solutions for calibrating your gauge but you can also find 3d printable models for constant flow Mariotte bottle rigs in the open source literature. In a pinch your can do a field check simply by poking a tiny pin-hole in a plastic milk jug or coke bottle filled with 1 litre of water from a graduated cylinder. Placing this on the funnel of a rain gauge gives a slow drip that generally takes about 30 minutes to feed through. The slower you run that annual test the better, and ideally you want an average from 3-5 runs. Of the many gauges we’ve picked up over the years, I have yet to find even new ones that aren’t under-reporting by 5-10% and it’s not unusual for an old gauge to under-report by 20-25%, relative to its original rating. Leveling your installation is always critical, but this can be difficult with pole mounted gauges. In those cases you must do your calibration after the gauge is affixed. I rarely move the adjustment stops on a gauge that’s been in place for a couple of years even if the count is off, because that’s less of a problem to deal with than accidentally shearing those old bolts with a wrench.

Here a leaf-cutter ant colony has completely encapsulated the loggers in one of our climate stations. Temperatures showed this process took only a few days and the humidity sensors were no longer producing valid data. We were lucky it wasn’t fire ants…

The Data

Rain gauges have large nonlinear underestimation errors that usually decrease with gauge resolution and increase with rainfall rate – especially the kind of quick cloud-burst events you see in the tropics. Working back from the maximum ranges, you’ll note that few manufacturers spec accuracy above two tips per second. So that’s a reasonable ‘rule of thumb’ limit for small gauges with plastic tippers that will plateau long before larger gauges with heavier metal tipping mechanisms. Gauge size is always a tradeoff between undercounting foggy drizzles at the low end (where smaller tippers are better) or undercounting high volume events (where larger gauges generally perform better). Even if you hit the sweet spot for your local climate, storms can be so variable that a perfectly sized & maintained gauge still won’t give you data with less than 15% error for reasons that have little to do with the gauge itself.

This adds 5-10 ms hardware de-bounce to the reed switch. Most gauges have switch closure times between 100 to 125ms with 1-2ms of bounce either side. After the FALLING trigger, sleep for ~120msec before re-enabling the interrupt. You can eliminate the 5k pull using the 25k internal pullup on D3, but your rise time increases from 10ms to 25ms and the resulting divider only drops to 15% of Vcc rather than zero.

All that’s to say your analysis should never depend on rainfall the way you might rely on temperature or barometric data. More records, from more locations, always gives you a better understanding of site conditions than ‘accurate’ data from a single location. Of course, that gives you the “man with two watches” problem when one of the gauges is in the process of failing. The most difficult situation to parse is where something slowly plugs one of the funnels but both gauges are still delivering plausible data. A signature of this kind of fail is that one gauge of a pair starts delivering consistent tip rates per hour during events while the other gauge shows larger variation. An alarm bell should go off in your head whenever you see flattened areas on a graph of environmental data:

Wasps & termites are particularly fond of rain gauges because they naturally seek shelter underneath them – where the drain holes are.
Daily Rainfall (mm) record from the gold funnel TRG at the top of this post showing before (green) & after (red) the storm that clogged the filter. Failure is indicated by prolonged curving descents followed by a long tail of low counts as the trapped water slowly seeps through the blockage. Normal rainfall data looks spikey because it can vary dramatically in as little as 15 minutes with long strings of zeros after each rain event.
Did I mention snakes? Yep, they love our climate stations. My guess is they go in after residual water left in the tipper mechanism.

These problems are much easier to sort out if both of the gauges at a given station are calibrated to the same amount of rainfall per tip (usually 0.01inches or 0.2mm) and disappear entirely if you have three records to compare.

While I’ve been critical of the cheap plastic tippers you find in home weather station kits they still have a place for budget EDU labs, and I’ve more than a few in my back garden feeding data into prototypes for code development. A new crop of metal & plastic hybrid gauges have started appearing on Amazon/eBay for about $150. The build quality seems a bit dubious, but we are going to give them a try this year anyway to see if they can serve as backups to the backups. As they say in the army: “Quantity has a quality all it’s own”. I wonder if any citizen science projects out there could adopt that motto?

Addendum: 2023-04-17

As luck would have it, that cheep Chinese gauge arrived from Amazon the day after I made this post. I wasn’t expecting much from a $150 rain gauge, but this one turned out be such an odd duck that I’ll include it here as a warning to others. On the right you see a photo from the listing, which made me think both the body and the funnel were made from brushed metal. What actually arrived made it clear the whole listing was carefully crafted to hide some pretty serious designs flaws.

Another dented delivery though, to be fair, the metal is tissue paper thin. At least this one didn’t get stolen from the front porch. Aluminum spray paint was used to disguise the crappy plastic funnel in the listing photos.
You could snap any part of this mechanism with finger pressure. And I wouldn’t take bets on how waterproof that junction box is either. There were no photos of this mechanism in the listing, which should have stopped me right there.

The thing that makes this such a good example of bad engineering is that they first optimized production cost with cheap brittle plastic that will likely fail with a year. As a result, the tipper ended up so light that they had to add a second funnel & tipping mechanism to deal with the momentum of drops falling from the main funnel. That upper mechanism is so small it’s guaranteed to plug up with the slightest amount of debris – causing the unit to stop working even before the plastic starts to crack. If they had simply added that extra material to a larger, heavier bottom tipper the upper mechanism wouldn’t have been necessary.

What the heck?

What takes this from merely bad to actually funny was the inclusion of an “Intelligent rainfall monitoring system for data upload via Ethernet, GPRS and RS485”. I presume that was intended to connect with ‘industry standard’ meteorological stations but who’d tack a cheap sensor like this onto one of those $1000+ loggers? Even stranger to me is the idea you’d waste that much power on a simple reed switch. Fortunately there is a terminal block where you can bypass that all that baggage, though that’s also fragile to the point of single-use.

In the current political environment, the last thing I’d do is put something like this on my ethernet.

Bottom line is that you are better off buying a used unit from a quality manufacturer than you are getting a new one from a company that doesn’t have a clue what they are doing. For comparison, here’s how the mechanisms inside decent gauges look:

While the tipper inside a Texas/Onset gauge is made of plastic it is extremely tough. The needle point pivots are hardened and we’ve yet to see one fail. The magnets however do rust, but like the reed switch they are easily replaced with a bit of CA glue and baking soda. Magnets have fallen from tippers on gauges from several different companies because differential expansion in tropical heat cracks the epoxy.
This High Sierra was built like a Russian tank and you see similarly rugged components inside older gauges from brands like Vaisala. After retiring the other components of gauge, we repurpose these virtually indestructible innards for drip monitoring in caves. You can 3d print a new base, or mould feet from nylon bolts and plumbers putty.

Waterproofing your Electronics Project

We’ve been deploying our loggers under water since 2013 and although we’ve posted many detailed build tutorials along the way, it’s time to gather some of that distributed material into a summary of the techniques we use. This post will focus on options available with a modest budget and also include a few interesting methods we haven’t tried yet for reference. To put all this in context; we deploy our DIY loggers to typical sport diving depths and usually get solid multi-year operation from our underwater units.

Jump links to the sections of this post:

Arielle Ginsberg examines the sponges covering a flow sensor deployed in a coastal outflow canyon.

Sealants

No matter what coating you use, everything must be scrupulously clean before it’s applied. Corrosion inducing flux is hydroscopic and there’s always some left hiding underneath those SMD parts – especially on cheap eBay modules. That means scrubbing those boards with alcohol and an old toothbrush, drying them with hot air & cotton swabs, and then handling by the edges afterward. Boards with only solid-state parts (like the ProMini) can be cleaned using an ultrasonic cleaner and 90% isopropyl but NEVER subject MEMS sensors or RTC chips to those vibrations. Polymer based RH sensors like the BME280, or MS5803 pressure sensors with those delicate gel-caps, also get careful treatment. After cleaning, let components dry overnight in a warm place before you coat them with conformal. I clean new modules as soon as they arrive, and store them in sealed containers with desiccant.

This $25 jewelry cleaner gets warm during the 5 -10min it takes to get the worst parts clean so I run this outside to avoid the vapours.

MG Chemicals 422-B Silicone Modified Conformal Coating is the one we’ve used most over the years. Even with a clean board, adhesion to raised ICs can be tricky as surface tension pulls it away from sharp edges. Like most conformals, 422-B fluoresces under UV-A so a hand-held blacklight lets you check if it’s thin at some corner, or if you simply missed a spot. The RC/Drone crowd regularly report on many of the other options on the market like Corrosion-X, Neverwet, KotKing, etc. I’ve never seen a head-to-head test of how well the different conformals stand up over time, but the loggers we’ve retired after 5-6 years in service look pretty clean even though silicone coatings are not water vapour proof. I like the flow characteristics of 422 for our small scale application, though the vapours are nasty enough to make you wonder how much brain damage your project is really worth. You can also just burn the stuff off with a soldering iron if you need to go back for quick modification after its been applied. Conformals can be made from other compounds like acrylic or urethane, and at the top of the market you have vacuum-deposited coatings like Parylene.

Nail polish gets mentioned frequently in the forums and it’s usually a type of nitrocellulose lacquer. While it’s non-conductive and non-corrosive, acetate chemistry is not far off acetone which solvates a lot of stuff. So nail polish may soften some plastics and/or the varnish protecting your PCBs. It might also wipe the lettering off some boards. So the trick is to start with the thinnest layer possible and let that harden completely before applying further coats. Nail polish softens somewhat when heated above 200°C with a hot air gun enabling you to scrape it away if you need to rework something after covering. Overall it’s a good low-budget option that’s less complicated to apply than a UV cured solder mask solution.

One of our many early failures before we decided to use only transparent epoxies. The outer surface of this epoxy was intact; giving no hint of what was happening below.
Some epoxies permit slow water vapour migration leading to corrosion at points with leftover flux. Like the white example above, this potting was still OK at the surface. Both of these two failures pre-date our use of conformal on everything.

You never get 100% coverage so the areas underneath components usually remain unprotected. But coatings really shine as a second line of defence that keeps your logger going when the primary housing suffers minor condensation or makes the unit recoverable after a battery leak. Even when we intend to pot a circuit completely, I still give it a thin coat of conformal to protect it during the week long burn-in test before encapsulation. (If you are using cheap sensors from eBay, expect ~20% infant mortality) Be careful not to let coatings wick onto metal contacts like those inside an SD card module or USB connector and remember to seal the cut edges of that PCB so water can’t creep between the layers.

The delicacy of application required when working with IC sensors means that spray-on coatings are usually a bad idea, but there are exceptions. Paul over at Hackaday reports success using clear acrylic spray paint as a kind of poor man’s Parylene after “comparing the MSDS sheets for ‘real’ acrylic conformal spray coatings, and acrylic paint. All that’s missing is the UV indicator, and the price tag.” He uses this technique in outdoor electrical boxes but the first thing that comes to my mind is coating the screw terminals inside most rain gauges (see photo at end of post), and the exposed bus-bars you see in some climate stations.


Potting / Encapsulation

Hot glue is a quick way to seal one side of pass-through so you can pour liquid epoxy on the other.

Hot-melt Glue: Glue sticks come in a variety of different compounds. But it’s hard to know what’s in the stuff at your local hardware store so my rule of thumb is to just buy the one with a higher melting point. If you are gluing to something with a high thermal mass or a surface that can transfer heat (like copper PC board) the glue will freeze before it bonds. So preheating the item you are working on with a hot air gun before gluing is usually a good idea. I’ve used glue sticks for rough prototypes more times than I can remember, sometimes getting several months out of them before failure in outdoor locations. Cheaper no-name sticks tend to absorb a lot of water(?) and have more trouble sticking to PCB surface coatings. So it’s a temporary solution at best unless you combine it with something more resistant like heat shrink tubing. Add glue to what you’re sleeving, and it will melt and flow when you shrink – effectively a DIY adhesive lined heatshrink:

Here I used leather gloves to squeeze the hot-melt glue inside adhesive lined heat-shrink until it covered the circuit without bubbles. This one lasted ~8 months and then we switched to epoxy fills.

Hot glue is also quite handy for internal stand-offs or just holding parts together if they are too irregularly shaped for double-sided mounting tape to do the job. Isopropyl alcohol helps remove the glue if you need to start over.

Superglue & Baking Soda: These dollar-store items are perfect for sealing & repairing the polymer materials that most waterproof kit is made from. Adam Savage has a great demo of this on YouTube. That gusseting build-up technique is so fast it now accomplishes many of the things I used to do with hot glue. CA glue & spray-on accelerant can also be used to improve the strength of 3D prints, as demonstrated by the ever-mirthful Robert Murray-Smith. The sealed surface of your print can then be written on with a sharpie marker without the black ink bleeding into the PLA layers, although I also use clear mat-finish nail polish for this labeling.

At this scale the viscosity of your encapsulating material is as important as any vapours it might give off. To avoid wicking problems, a ring of ‘dry’ plumbers putty can secure a filter cap over the sensor after the liquid potting compound sets.

Silicone Rubber comes in two basic types: ‘Acid cure’ which smells like vinegar and ‘Neutral cure’ which gives off alcohol while it hardens (often used in fish-tank sealants). Never use acid curing silicone on your projects. Hackaday highlighted a method using Tegderm patches to give silicone encapsulations a professional appearance although you can usually smooth things well enough with a finger dipped in dish detergent. In another Hackaday post on the subject, a commenter recommends avoiding tin-cured RTV silicones in favor of platinum cured which has longer lifespan and less shrinkage. Really thick silicone can take several days to cure but accelerants like corn-starch or reptile calcium powder can cut that to a few hours. It’s also worth knowing that silicones expand/contract significantly with temperature because this can mess with builds using pressure or strain sensors.

The $5 3440 Plano Box housings we use on the classroom loggers stand up to the elements well enough in summer months, but rarely have an adequate seal for the temperature swings in fall or winter. Judging by this post over at AVRfreaks, this is a common issue with most of the premade IP68 rated housings on Ebay/Amazon.

While silicone is waterproof enough for the duration of a dive it is NOT water-vapor proof. I often use GE Silicone II (or kafuter K-705) to seal around the M12 cable glands we use on student projects. However, water vapor eventually gets in when the housings “cool down & suck in moist air” causing condensation on the upper surface. Any container sealed with SR will eventually have an internal relative humidity comparable to the outside air unless your desiccants prevent that from happening. Always use desiccants with color indicator beads so you can see when they need to be replaced. Silica gel desiccant beads bring the air above them down to about 20% RH in 24-48 hours but only if there is enough mass for your volume. The best way to determine how much your build needs is to do test runs logging an RH sensor like the BME280 inside the box with different amounts of desiccant. Old desiccant pouches can be ‘recharged’ overnight in a food dehydrator and used ones can usually be found for ~$10 at your local thrift shop. Dehydrators are also great for reviving old filament if you have a 3d printer.

Liquid Epoxy: If money is no object, then there are industrial options like Scotchcast but many come in packaging that dispenses volumes far too large for a small batch of loggers. The best solution we could find at the start of this project was Loctite’s line of 50mL 2-part epoxies designed for a hand-operated applicator gun. Used guns can be found on eBay and there are plenty of bulk suppliers for the 21-baffle mixing nozzles at 50¢each or less. Loctite E-30CL has performed well over years of salt-water exposure on our PVC housings though it does fog & yellow significantly after about six months. Check the expiry date before buying any epoxy because they harden inside the tube when they get old. I’ve often received epoxies from Amazon that are only a month or two from expiring, so don’t buy too much at one time. And they don’t last long once you crack the seal, so I usually line up several builds to use the entire tube in one session.

A background layer of black EA E-60NC potting compound was used to improve the visual contrast. Once that set a clear acrylic disk was locked into place over the OLED with E-30CL epoxy – taking care to avoid bubbles. The acrylic does not yellow like the epoxy and can be thick enough to protect relatively delicate screens from pressures at depth.

My favorite use of liquid epoxy combines it with heat shrink tubing to make long strings of waterproof sensors:

A short piece of adhesive lined heat shrink seals one end of the clear tube to the cable. Epoxy is added to fill about 1/3 the volume. Then gentle heating shrinks the clear tube from the bottom up until the epoxy just reaches the top. Another adhesive lined ring seals the epoxy at the top of the tube. Then gentle heating of the clear heatshrink contracts it into a smooth cylinder. Extra rings are added to strengthen the ends.

We’ve deployed up to 24 DS18b20 sensors on a single logger running underwater for years – failing eventually when the wires broke inside intact cable jackets because of the bending they received over several deployments. This mounting takes a bit of practice, so have a roll of paper towels nearby before you start pouring and I usually do this over a large garbage can to catch any accidental overflow.

This image shows the typical appearance of E30CL after several months in seawater. The brown dot is a marine organism that bored into the epoxy, but they have never tried to drill through the housing itself… which says something about the toxicity of polyvinyl chloride.

The 2-Part fiberglass resins used for boat repair are another good potting option though they are often opaque with unusual coloration. Low viscosity mixes can be applied with precision using disposable syringes. It’s important that you transfer the stirred resin into a second container before pulling it into the syringe because there’s often a poorly mixed layer stuck to the sides of the first mixing cup. 3D printed shells are often used as casting molds but if all you just need is a rectangular shape then I’d use a LEGO frame lined with plastic food wrap. You can make single-use molds that conform to unusual shaped objects with sheets of modeling clay. When encapsulating large volumes you can make that expensive epoxy go farther with ‘micro-balloon’ fillers made from tiny phenolic or glass spheres. I’ve used old desiccant beads for this many times. Other inert fillers like talc power are sometimes used the lower peak temps during the curing process because fast setting epoxies get quite hot – sometimes too hot to touch. And speaking of heat, all encapsulation methods open the possibility that high power components could cook themselves. So avoid covering any heat sinks when you pot your boards.

Filler / Paste Epoxies: J-B weld is good low-budget option for exposed sensor boards. This two part urethane adhesive bonds well to most plastic surfaces and the filler it carries gives a working consistency somewhere between peanut-butter and thick honey. This is helpful in situations where you want to mount something onto a relatively flat surface like the falcon tubes we use with our 2-part Mini Loggers:

This BMP280 module already has a coating of conformal.
Shift the epoxy to the edges of the sensor with a toothpick

Although the original grey formulation gets it’s color from metal filings it is an electrical insulator. The older style JB weld that comes in two separate tubes is slightly thicker than that sold with an applicator syringe. It’s also worth noting that the stuff really needs at least 24 hours to set – not the 6 hours they claim on the package. There is also a clear version that can be used to protect light sensors, but I’ve yet to field test that in harsh enough conditions to see how it ages:

JB can also be used to secure delicate solder connections.
PTFE tape is a good diffuser if light levels get to high.
Unlike E30CL, clear JB-weld retains all those tiny bubbles.
A JB-weld coated DS18b20 after 6 months in the ocean. Specks of iron-particle rust can be seen, but when I broke away the coating the can underneath was still clean & shiny.

Wax: I haven’t tried this yet but it sounds like it could be fun: Refined paraffin can be purchased in food grade blocks for sealing jars, etc. at most grocery stores and it flows well into small component gaps. It’s also removeable, however the 45°C melting point which makes this possible is too low for outside deployments where I’ve seen loggers reach 65°C under tropical sun. A tougher machinable-wax can be made at home by mixing LDPE (plastic grocery bags) or HDPE (food containers) into an old deep fryer full of paraffin wax. The general recipe is a 4:1 ratio of paraffin to LDPE/HDPE and this raises the melting point enough to withstand summertime heat. Or you could try Carnauba wax which has a melting point above 80°C. You probably want to do partial pours with any wax based approach as shrinkage can be significant. If I had to make something even more heat resistant I’d consider an asphalt-based roofing cement. That’s a one-way trip, but it should last quite a while outside.

If you’re spending company money, it’s worth noting that many professional potting compounds like those from 3M are sold in hot-melt glue stick formats [usually 5/8″(16mm) diameter rather than the more common hobby market 1/2″]. This dramatically reduces waste & mess compared to working with liquid epoxies. Of course, it’s unlikely a DIYer will be able to use them as the applicators alone can set you back $300 to $600 USD. Another factor to consider is the different expansion rates of the circuit you are trying to protect vs the compound you are using for the encapsulation: hard epoxies may cause electrical failures by subjecting components to more stress when the environment is cycled between extreme temperatures. In those cases it is probably better to use softer compounds.


Housings & Connectors

Although 3D printers are now affordable, we still use plumbing for our underwater housings so that others can replicate them with parts from their local hardware store. The design has changed significantly over time but this tutorial video from 2017 still stands as the best overall description of the ‘potting wells’ method we use to mount sensors on those PVC housings. It also shows how to make robust underwater connectors using PEX swivel adapters:

Smooth surfaces on the inside of those wells are scored with a wire brush or rough grit sandpaper before pouring the epoxy. After solvent welding, leave the shells to set overnight before adding epoxy because bad things happen when you mix chemistries. In fact, that’s a good rule for all of things listed in this post. Otherwise that expensive potting compound could turn into a useless rubbery mess. Another important thing to note is that we break the incoming wires with a solder joint that gets encapsulated before the housing penetration. This is more reliable than cable glands because water can’t wick along the wires if the jacket gets compromised. The shell shown in that video uses a Fernco Qwik-Cap as the bottom half of the housing and quite a few Qwik-cap housings have survived years under water although the flexing of that soft polymer limits them to shallower deployments. So these wide-body units get used primarily for drip loggers & surface climate stations. It’s worth noting that water vapour slowly migrates through the plastic knockout cap on the upper surface of our drip counters. So they require fresh desiccants once a year even though the logger could run much longer than that. A reminder that over the time scales needed for environmental monitoring, many materials one thinks of as ‘waterproof’ are not necessarily vapour proof.

For underwater deployments we developed a more compact screw-terminal build that would fit vertically into a 2″ cylindrical body. After many struggles with salt water corrosion we gave up on ‘marine grade’ stainless steel and started using nylon bolts to compress the O-ring. But these need to be tightened aggressively as nylon expands in salt water (we usually pre-soak the bolts overnight in a glass of water before sealing). Nylon expansion has also caused problems with the thick 250lb ties we use to anchor the loggers. In a high humidity environments, cheap nylon zip ties become brittle and break, while expensive industrial ties stretch and become loose. We’re still looking for better options but when you are working under water, you need something that can be deployed quickly.

We’ve tried many different epoxy / mounting combinations on the upper cap of those housings, but with the exception of display screens we stopped using the larger wells for underwater units because the wide flat disk of epoxy flexes too much under pressure. This torsion killed several sensor ICs on deployments below 10m even though the structure remained water-tight.

As our codebase (and my soldering skills) improved we were able to run with fewer batteries – so the loggers became progressively smaller over time. Current housings are made from only two Formufit table leg caps and ~5cm of tubing. The same swivel adapter used in our underwater connector now joins sensor dongles to the housing via threaded plugs. Sensor combinations can be changed easily via the Deans micro connectors we’ve used since the beginning of the project. Though the photo shows two stacked o’rings, we now use shorter bolts and only one. See this post for more details on the construction of this housing.

EPDM O-rings lose much of their elasticity after a couple of years compressed at 20-25m, so for deeper deployments I’d suggest using a more resilient compound. And there are now pre-made metal housing options in the ROV space that didn’t exist at the start of this project. With the dramatic size reduction in recent models, you occasionally find a good deal on older Delrin dive-light housings on eBay. Another interesting option is household water filter housings made from clear acrylic. They were too bulky for our diving installations, but this Sensor Network project at UC Berkeley illustrates their use as surface drifters.


Other Protection Methods

Mineral oil: PC nerds have been overclocking in tanks of mineral oil for ages, so it’s safe at micro-controller voltages. It’s also used inside ROV’s with a flexible diaphragm to compensate for changes in volume under pressure. Usually a short length of Tygon tubing gets filled with oil and stuck out into the water, or the tube can be filled with water and penetrates into the oil-filled housing. We use a similar idea to protect our pressure sensors from salt water:

The MS5803 pressure sensor is epoxied into a 1/2″-3/4″ male PEX adapter and a nitrile finger cot is inserted into the stem of a matching swivel adapter.
The sensor side gets filled to the brim with mineral oil
The two pieces are brought together
Then tighten the compression nut and use a lubricated cotton swab to gently check that the membrane can move freely.

Moving those membrane-protected sensors onto a remote dongle makes it much easier to recover the sensor after a unit gets encrusted with critters. Oil mounts have worked so well protecting those delicate MS58 gel-caps that I’ve now started using this method with regular barometric sensors like the BMP280. This adds thermal lag but there’s no induced offset in the pressure readings provided there’s enough slack in the membrane. Silicone oil is another option, and I’ve been wondering about adding dye so that it’s easier to spot when those membranes eventually fail. I avoid immersing any components with paper elements, like some old electrolytic capacitors, or parts that have holes for venting.

Bio-fouling on one of our loggers deployed in an estuary river. We only got three months of data before the sensor was occluded.
We remove calcareous accretions by letting the housings sit for a few hours in a bucket of dilute muriatic acid. Many of our loggers get this treatment every season.

Cable Protection: For the most part this comes down to either strain relief, or repairing cuts in the cable jacket. Air curing rubbers like Sugru are fantastic for shoring up worn cables where they emerge from a housing though I usually use plumbers epoxy putty for that because I always have it on hand for the housing construction. Sugru is far less effective at repairing cables than something that’s cheaper but less well known: self-fusing rubber electrical sealing tape (often called ‘mastic’ or ‘splicing’ tape). This stuff costs about $5 a roll and has no adhesive: when you wind it around something it sticks to itself so aggressively that it can not be unstuck afterward, yet remains flexible in all directions. This makes it perfect for repairs in the middle of a cable and we’ve seen it last months under water though it quickly becomes brittle under direct sun. And it does the job in places you can’t reach with adhesive lined heat shrink. I usually slap a coat of plasti-dip or liquid electrical tape over top of those repairs. This improves the edge seal and makes the patch look better. Self-fusing tape is also great for bulking out cables that are too thin for an existing cable gland, or combining several wires into a water-tight round-profile bundle for a single gland.

However the best advice I can give is to simply avoid the temptation of soft silicone jacket cables in the first place. Yes, they handle like a dream under water, but you will pay for it in the long run with accidental cuts and hidden wire breaks due to all that flexing. Another hidden gotcha is that silicone compresses at depth which brings the wires closer together – potentially increasing the capacitance of a long bus enough to interfere with sensor handshakes. Our go-to after many years at the game is harder polyurethane jacketed cables (like the ones Omega uses for their thermistors) It’s a pain in the arse to strip & solder, but you can pretty much drive a truck over it. And somehow that kind of thing always happens at least once during a field season.

Lost count of how many times ants/wasps have bunged up our rain gauges. And I should have coated those screws…

Double housings: Instead of sealing the housing to block out humidity, control the point where it condenses by surrounding an inner plastic housing with a second outer shell made of aluminum. Then let everything breathe naturally with the idea that condensation will happen first on the faster cooling aluminum, thereby protecting the inner components. I’ve heard of this being used for larger commercial monitoring stations but I’ve never been brave enough to try it myself. You want some kind of breathable fabric membrane over any vent holes to keep out dust (to IP6) and especially insects because if there’s a way into your housing they will find it and move in. Another simple but related trick is to fill any void spaces inside your housing with blocks of styrofoam: this minimizes the total volume of air exchanged when the temperature swings.

Addendum: Testing Underwater Housings

People reading this post might also be interested in the DIY pressure chamber which we’ve been using to test our little falcon tube loggers. It’s made from a household water filter canister, with a total cost of about $70usd. The domestic water pressure range of 40-80psi overlaps nicely with sport diving depths. The 30mL tubes are stronger for single sensor builds, but the 50mL tube provide more space for our 2-Module classroom data logger. This model uses two mini breadboards for convenient sensor swaps.

Addendum: 3D printed housings

PLA (or poly-lactic acid) is made from glucose that is converted to lactic acid with an H2O molecule removed to trigger the polymerization process. While water doesn’t degrade most printable polymers PLA slowly gets brittle when wet because it recaptures the H2O. But there is an energy barrier that requires the right temperature, pH, or UV conditions. Bacteria can also accelerate that chemistry and just anecdotally we’ve seen biofilms grow much faster on prints deployed to wet environments compared to our PVC housings. But it’s impossible to distinguish if it’s the polymer or some other lubricant/additive in the mix that they are attracted to. We’ve also seen ‘compression/tension’ mechanisms in PLA fail because of reduced strength even though there was no visual indications that the parts had degraded. This has motivated of our increasing conversion over to PETG for installations although I still use PLA while a new design is being developed because it prints faster. Most polymers are about 1.25 grams per cubic centimeter, so around 85% infill gives neutral buoyancy in water. Nylon can absorb a great deal of water and swell making submerged prints unusable.

The first thing to do when printing a housing is to make sure your filament is bone dry before starting, but all 3D prints are still going to be porous to some extent. There’s an interesting article on 3-d printed underwater housings over at the Prusa Research blog. The initial strategy is to increase the flow rate and temperature so less air gets trapped between the polymer lines that get laid down by the nozzle. Then I’d try a coating of CA glue with spray on accelerant to seal the outer surfaces. Or you could switch to SLA resin printing like RCtestflight – even then they still filled the space around their servos with silicone grease. Our little loggers work fine immersed in mineral oil which is relatively easy to clean up later with alcohol. Ironing produces smooth flat layers that you would think are more water resistant, but this Reddit contributor found that once bubbles are in the print, they can not be removed by ironing. ‘Brick layers’ would help reduce the air gaps but unfortunately that technique is tied up with patent issues. CPS drone had excellent results making prints waterproof by treating them with Dichtol AM Hydro which is very low-viscosity specifically for impregnation and sealing. This makes me think about testing the many waterproofing sealers at my local hardware store. Multiple thin coats of an epoxy should create an external seal if they get sanded between coats, but the underlying print would have to be strong enough to resist deforming & cracking. CPS also created interesting epoxy & print combination endcaps. Pass throughs are critical weak points in any design because water under pressure can rapidly wick between multi-strand wires if the outer insulation gets cut. Stripping to raw copper and embedding in the epoxy is usually required and you need to add soldered break-point or even a solid wire bridge through the housing because there is no way to get the epoxy to fill all the spaces between the strands without a vacuum chamber. Gyroid fills form continuous tubes that you can pour something like glass fiber-filled epoxy into for strength but heat from the curing resin can cause deformation. Re-melting the prints with powdered salt also seems to work for both water and gas hardening. Even if you eventually get all the bubbles out, the polymers themselves still have a vapour penetration rate. This is an issue in labs where you can’t do isotopic analysis on samples that have been left in poly centrifuge tubes too long. And it’s not unusual for 15ml Eppendorf’s to loose 1/3 of their volume in 8 months even if they are sealed well. If you have the budget for SLA printing, Formlabs have posted an interesting design where the o-ring seals are directly printed into the parts and the enclosure is sealed using a hand-screwed bezel. This is much like the seal you find in PVC plumbing parts like non-glued unions.

Slant3d demonstrated an interesting idea for enclosure boxes that keep water out without a seal although in our project condensation of ambient humidity is equally damaging in the long term. 3D printing is also handy for making angular connection joints for complex protective structures or custom sensor mounts that have to last underwater without rusting. But sometimes in the field you are better off using plumbers putty for those PVC tripods. I’ve lost count of how many times I jury-rigged something on site with plumbers putty that then lasted for years of outdoor exposure.