Category Archives: DIY UNDERWATER housings

The housing must go to at least 30 meters water depth, for at least a year, and be made from inexpensive PVC fittings & parts that can be obtained anywhere.

A DIY Underwater Housing for Arduino Data Loggers made from PVC pipe

Doodles are a fundamental part of the process...

Doodling is a fundamental part of the process…

I spent a great deal of time cutting, sanding and gluing my underwater housings last year. And I learned a heck of allot about adhesives, O-rings, hull penetrations, and potting circuits.   But mostly I learned that I like soldering more than I like cutting…sanding…and gluing PVC. Holiday travel left me with a wicked stomach flu on New Years, so I had a few bedridden days to contemplate all this and think about how I could simplify the design. I was already cutting up Formufit 2″ table caps to provide bolt supports on the 3″ housings, and I just had this sense that I was missing a trick by taking those table adapters apart just to glue the pieces back together again.  Perhaps, if I made the build more compact, I could just use the Formufits as the were?

In all, I probably spent a week, staring into space and sketching ideas, and another week assembling prototypes. But I think I have finally sorted the new Cave Pearl underwater housing design for 2015. The taller unit here has six AA batteries, while the “mini” has only three:


My wife dubbed these “Stormtroopers” because the black details against the white PVC reminded her of those Star Wars characters.  Given how important actual storm events are to data they will be gathering, I’m cool with that 🙂

Boards are held in place with double sided tape

Boards are held in place with 3M double sided tape and the RTC breakout is inverted on 12mm M2 standoffs. This makes it easier to replace the coin cell on units where I power the RTC from a pin on the Arduino, since they will be in battery powered ‘timekeeping’ mode most of the time.

This assembly requires a small number of 2″ pipe cuts,  and only two surfaces need to be wet-sanded for the o-ring seats. Putting all those sensor breakouts under epoxy in the single ring on top lets me juggle the them around, and is more forgiving of different board dimensions than my older designs. I would not have put that much faith in the Loctite E30CL if I had not already seen last years units survive for so long under water. This design requires a very tight build for the electronics, and I don’t think I could have tackled soldering like this when I created the original housings in 2014. Aside from the new 32k eeproms, this is still just a variation of the basic three component logger that I published in July last year. I am simply putting it together on both sides of a .060″ ABS sheet that I bend into shape with a heat gun.

Of course this new design will have to go through the usual round of underwater tests, and I hope that the long nylon bolts act as spoilers for the vortex shedding I am bound to see in the higher flow systems.  I will add some rounded baffles if that becomes too much of a problem.  Even if this design does not prove suitable for the flow meters, it is so quick to assemble that some version of this style will become the standard housing for my other underwater sensors.  There are more variations coming off the bench, and I will post a few of the better ones as they come together, especially ones that let me flexibly extend the housing to hold more batteries for really long deployments.

 Addendum 2015-02-06

This post has only been live for  a few days, and I have already had several offline requests for more information. So here are some details on how I put these housings together, starting with an exploded view of the parts:

Only 2 surfaces (arrows) need to be wet-sanded down to 800 grit for the O-ring seats.

Only two surfaces (arrows) need to be wet-sanded for the O-ring seats. I take it to 800 grit, but 600 would probably be ok. Examine your parts before buying, as brands vary considerably in the number of casting seams & ID information they place on the rims.  To do the least amount of sanding possible, buy the ones with the smoothest finishing, and flip your parts around so that you are not sanding down any edge cuts for o-ring seats.

The pipe is schedule 40 PVC, and the center piece is a standard 2″ coupling. The pvc ring bordered by the arrows is only glued on the coupling side, and it extends into the upper cap only far enough to provide a backer for the o-ring, and to hold the top cap in alignment. The top cap is not glued, but is held in place by the five inch 1/4-20 nylon hex bolts. These bolts are slightly wider than the holes in the Formufit endcaps, so you need to drill them out a bit. But I would suggest that people start their builds with threaded rod, rather than fixed length bolts, as this gives you the freedom to experiment with different lengths of pipe. The o-ring pictured here is a 3/16″-322, and its diameter extends slightly outside the PVC (pressure at depth will push them inwards…). A smaller diameter 1/8″-229 also works, and fits inside the seats. I am still trying to find an affordable supplier for 5/32″ cross section o-rings, which would probably be the best size to use. I use Loctite Hysol E-30CL to pot my electronics.  I use the clear epoxy is so that I can see my indicator LED’s and keep track of how the epoxy is aging. But if you replaced that epoxied well of sensors with a clear acrylic disk, you could make camera & light housings for other interesting projects. The only limitations are that everything has to fit inside 2″ PVC pipe, and that those flat Formufit cap ends are only 4 mm thick, affecting the maximum depth they can with withstand.  For now I am expecting these housings to go to at least 100ft/33m safely.

Addendum 2015-02-07

And here is the extendable version of the design:

Just wait till you see what

Each bank of batteries is isolated with a 1N5819 Schottky.  Just wait till you see what I need all this power for . . .

In this version the lower ring of struts (where the white nuts are attached to the 3.5 inch bolts) has the flat surface of the Formufit table cap removed with a hole saw. This turns it into a freely moving slip ring which applies pressure to the bottom of the glued coupling, and thus to the o-ring above it. This build uses a slightly shorter coupling than the initial builds, and the PVC tubing that leads to the rounded end-cap at the bottom can be any length, making room for more boards, etc.  For multi-year deployments, I will probably make stand alone battery compartments this way, connecting them to a separate mcu & sensor housing via my diy underwater connectors.

Addendum 2015-07-23


The black zip tie (upper left) provides a handle so I can pull the carrier out of the housings.

I have discovered that the long temperature strings really did not need that 12 x AA whopper pictured above, and I now mount the batteries in a power pack module that is physically separate from logger itself. This gives me the added benefit that the batteries can be located further away from the sensor caps, hopefully reducing their influence on the magentometers I use in the flow sensor builds. If I suffer from battery leaks again, I can simply replace the carrier in the field. Should I end up needing a large number of batteries for something in the future, I will just whip up a “Y” adapter cable to connect a couple of these modules in a parallel configuration. The Schottky’s on each bank will keep them from fighting with each other.

Addendum 2015-07-26

And here is the exploded view of the parts for the extendable housing:

Once again only the indicated surfaces need to be sanded. The short 1cm ring and threaded adapter in the lower right corner are optional, depending on how you want to mount your sensors to the top of the unit. I usually put at least one threaded connector on so that I can attach some sort anchor cables to my loggers so that they don't get carried away.

Once again only the indicated surfaces need to be sanded. The short 1cm ring and threaded adapter in the lower right corner are optional, depending on how you want to mount your sensors. I usually put at least one threaded connector on the body so that I can attach some sort anchor cables to my loggers at that point.  The  1/4 – 20 nylon bolts are just a wee bit bigger than the holes in the Formufit caps – so you will have to drill them out a bit to let the cap slide freely. The PVC coupling is 4cm wide, and if your couplings are longer the bolts will be too short, and you will need to switch to threaded rod.

Addendum 2016-03-10

As more projects adopt this housing design, many have been asking me about the maximum depth they can withstand, though I have not yet had enough ‘spare’ units to put any through destructive testing. My back of the envelope guess?  The 2″ schedule 40 pvc has a rated operating pressure around 150 psi, so nominally those parts are good to somewhere around 300 feet. So I am confident that we could deploy to about half that, expecting failures to occur first at the solvent welds & epoxied hull penetrations. (see pg 69 of the Loctite Plastics Bonding Guide for more info on shear strengths) You would probably need a harder o-ring compound for those depths, as the EPDM I am currently using is pretty soft, and would compress significantly below 100ft.  For really deep deployments, you could fill the housing with oil like they do to the motors on ROV’s. Some of those add an ‘external bladder’ with extra oil to balance the internal and external pressure.

A researcher over in Europe contacted me while ago when I was using the 3″ end-caps, for a project tracking daily krill migration.  But I have not heard back from him if he was able to go deeper with those thicker, rounded hulls…

Addendum 2016-07-31

I just stumbled across an interesting ROV build based on PVC pipe over at that shows just how far you can take this pipes & wires approach. PVC has been a go-to material in the DIY crowd for ages.

Addendum 2016-11-18

Just a quick note about those nylon bolts in that photo above.  They expand from their dry length of 94mm to about 96mm when they are fully wet. This is just enough for them to become loose over  a long underwater deployment, and we retrieved several loggers where the bolts that were very tight when the units were dry, but could be spun freely when then logger came out of the water.  Fortunately the O-rings were held shut by the pressures at depth and that seal saved us from data loss.  If your sensors are not sensitive to the presence of metal, I’d suggest you use stainless steel bolts to hold the housings together.  Or at least soak those nylon bolts in water for a few days before deployment. Note that the nuts also expand and are hard to release due to the increased diameter of the bolt when everything is wet – give them a day or so to dry out and they become much easier to undo.

A Simple DIY Underwater Connector System made from Plumbing Parts

Up to this point, the Cave Pearls have been self-contained units. But this means that the sensors must be mounted directly on the housings, and the batteries must fit inside.  I already have ideas for new sensors that would require me to overcome these two limitations, so I need to address the issue of how to make electrical connections that are not merely IP68 waterproof, but rugged enough to withstand pressure at depth for a year or more.

I wet-sand the ends (indicated by the red arrows) of that nipple with 600 & 800 grit to smooth away any casting seams.

Wet-sand the ends of that nipple (arrows) with 600 & 800 grit to remove any casting seams. Smooth all o-ring seats.

Use a couple of sizes of heat shrink tube to seal the cable to the pex adapter

On 1/2″ barbs, use a couple of sizes of heat shrink to step down (from Ø12/6 tubing) to the diameter of the cable you are using before sealing the connection with epoxy. Adhesive lined tubing  helps the seal. You can also buy 1/2 NPT x 3/8 PEX adapters for thinner cables, but for some reason they cost twice as much as the larger diameter 1/2 x 1/2″ adapters (?) 

As a diver, I had already seen debates about which connectors are the best on the scuba forums, and a quick Google search quickly finds many suppliers for that market. Most of these are “wet-plugable” connectors encased in delrin/rubber, and they are workhorses in many industrial and military applications. High profile companies like Seacon making a bewildering array of solutions, but their cheapest ones come in around twenty five dollars per socket, so a complete connection will set you back at least $50.



Remove the cone washer before filling adapter with epoxy

Remove the cone washer before filling with epoxy. Score the inside with a wire brush, or tap them if you can, to promote bonding.

Many of these commercial connectors are rated for deep ocean deployments, able to withstand thousands of psi – far more than I will subject them to in the shallow cave systems. And they often give you a short little pig-tail under the assumption that you will be using it with a cable gland , or a bulkhead connector on a nearby housing ( or at the very least a couple of layers of marine grade adhesive lined heat shrink tubing)  I needed some decent cable runs so I went looking for other applications with longer lines at shallower depths . The pool & underwater lighting folks often use  Bulgin electrical connectors, and the 400 series   Buckaneers  (rated to 10m) occasionally come up on eBay in the $10 range, But again you need to buy two sockets (male&female), and you need to buy the pins which are sold separately. So you still end up around $25 per connection.


Make sure your wires are long enough to extend past the nipple, or you wont be able to make the connection!

Make sure your wires extend all the way through the nipple, or you can’t make the connection! And use soft flexible silicone wires so they fold back into the connector easily.

With all that as background, I went hunting once again through the plumbing section at the local hardware store.  I reasoned that anything that could hold water in, could also hold water out, right?  And I think I have come up with a solution using pex swivel adapters that is pretty cheap and can be adapted to many different applications. These plumbing adapters are rated to withstand 100 psi, which is roughly equivalent to 230 feet under water.  And that is pressure from the inside out, so my gut feeling is that these things will be able to withstand slightly greater pressure in the other direction, where the forces act to increase the compression of the cone washer.  The thing I like about the swivel adapter mechanism is that it applies pressure to a hard plastic lip on the other side of the washer, so as you tighten the nut there is no rotational force being applied to the parts forming the water tight seal.

And it even looks good!

~$6 for parts, and it looks good too.

These adapters come in a variety of larger & smaller diameters allowing you to use different cable thicknesses, and you can change the length of the pvc riser pipe in the middle to make more space for the internal connectors. This also gives you a way to adjust the amount of air/buoyancy along the run and with a string of connectors this might be a good way to reduce strain on the cable.  I suspect that the schedule 80 tubes in the middle are the weakest point in the system, but filling the internal space with mineral oil would get these connectors to significant depth, as would a filling of paraffin wax, though that would have to be heated again to undo the joint. 


After building a few of these, I realized that it was possible to make them even simpler if the electrical connectors were small enough.  In the picture here, one side has a Nibco PEX swivel adapter, while the other has a male thread NPT to PEX  adapter. These are both polymer, though it is hard to find an epoxy that will bond to it with an applicator fine enough to put the adhesive into the barb cavity. These fittings are also available in brass for the same price, and the o-ring seats are much cleaner on those than the polymer adapters because there are casting seams on the plastic parts. But I don’t know how well the brass will fare in marine environments. Some of my sensors have stainless shells, so I worry about galvanic effects in salt water?  

In the photo below I’ve used a three wire PC fan connector, and it “just barely” fits inside the cavity of that m/m hose barb. I will use smaller JST connectors in future, or perhaps Dean’s Micro 3pin or 4pin for something more robust.  The internal diameter of the 1/2 pipe is a little over 12mm, so if you need to squeeze more connections in there you could try a couple of “mini micro” JST’s, but I find that soldering all those wires so close together is a bit irritating because it’s easy to accidentally melt the plastic, loosening the tiny pins. 


Don’t forget to smooth the seat on that male hose barb side if it has bad casting seams. You want that connection to be as clean as possible. You need to use small connectors for this M-F design.

After this, pull the cable through so the

Pull these joins into the connector so they are embedded in the epoxy.

I also found that the wire inside my cables were too stiff to fold neatly into this much smaller space, so I had to add some flexible 26 AWG silicone wires to the ends. After the jumpers are attached, pull the cable through so that the solder joins get embedded in the epoxy. This has the added benefit of providing a break in the insulation around the wires, so that if you do get a cut in the cable, water can’t make it’s way into the connector by wicking along the copper strands.  I am still hunting for a good supplier of multi-conductor 22-24 awg cable with flexible silicone insulation & jacket that has a good “handling weight” for underwater applications. It’s hard to shop for something on the internet when what you are really after is something that “feels right” when you hold it in your hands.

I should add all the usual provisos here about this being another one of my completely experimental ideas.  I am posting it early because I know there are plenty of other people out there looking for something like this.  Until my underwater tests are done, you are throwing caution to the wind risking your own kit with this DIY solution.

Addendum 2015-01-30

I just stumbled across a different solution to the expensive underwater connector problem. His method for waterproofing connectors using 3D printed silicone molds is beyond my current capabilities, but its nice to see it explained with such clear documentation.

Addendum 2015-02-01

If those pex adapters don’t have enough room for your cables, I found another great underwater connector project which might do the job for ya 😉

Addendum 2017-01-23

As time goes on I am reducing the number of interconnects, but even with longer chain segments I will probably stick with only 24 sensors per logger.

As time goes on I am reducing the number of interconnects, but even with longer chain segments I will probably stick with only 24 sensors per logger.

Just though I should add an update to mention that quite a few of these connectors have been in service for more than a year on temperature chain logger deployments. None of them have failed on relatively shallow deployments from 5-15m depth. The only problem I’ve had  is the length of the connector itself can be challenging when you are trying to pack one of those long strings into the mesh bag, for an underwater deployment.


Addendum 2018-12-05

I’ve posted a video showing how I build those underwater connectors as part of our 2017 screw terminal logger series: 

Field Report 2014-08-26: Old Flow Sensor Inspection

The drip sensor deployments left me with an couple of hours free time that evening, which gave me a chance to take a closer look at the flow sensors we pulled the day before.

From the same batch?

Different corrosion  although nuts & bolts were identical

The most obvious impact of the near marine exposure was the rust that had accumulated on the stainless steel bolts and ballast washers. (no spec on the bolts, but the lock nuts were 18-8) While they fasteners were all purchased at the same time, they showed dramatic variation in the amount of oxidization they sustained. I can only presume these are the result of the manufacturing process leaving scratches which acted as nucleation sites. Even the fasteners that suffered significant oxidization remained secure and they were relatively easy to remove once the surface rust had been brushed away.

Still clear, and nothing growing on the surface.

E-30CL still  clear, with nothing growing..

Some pitting on the JB weld surface.

Some pitting on the JB weld surface. I had some concern that the iron particles in the J-B weld might induce galvanic corrosion on the other metal parts.

Both epoxies proved to be far more robust than the manufacturers testing indicated, with the Loctite showing some surface fogging on two units, while remaining perfectly clear on the other one. The grey JB marine weld changed from a smooth surface to one with significant grit (~400 grit sandpaper?). I suspect the pitting is a result of the iron particles in their formulation rusting out of the the matrix, and I will try to get these puppies under a microscope later.  The rubber 0-rings were still in pretty good shape although they had a significant layer of bacterial slime on the exposed surfaces which I cleared off with a touch of isopropl alcohol. I suspect that any material with suflur in it is a banquet for critters the low energy cave environment, but the O-rings certainly look like they will survive for at least a year. (something for me to keep in mind with the bungee anchors though, as the older one’s are at 9 months submersion now)

Three of the four units pulled their 6 x AA power supplies into the 3.3 volt range (as read by the Atmel internal 1.1 vref trick) ; more power drain than my earlier tests had indicated for a 5 month run. But those bench-top tests were done too fast to include self discharge, without isolation diodes, and the real world batteries had been exposed to a relatively high humidity for the duration. (I have added 10 gram desiccant packs to the current crop.)

Perhaps the most interesting power consumption result was from the one unit that included a voltage regulator in the power supply module. I was unable to measure the cell voltage directly till a few days after the units were disconnected, but after the rebound period the AA’s supplying the NCP1402-3.3V Step-Up regulator were at 1.35v, while identical cells that had powered the unregulated Tinyduinos were at 1.4 v.  That’s a pretty small difference given that the nominal efficiency of the regulator is around 75%.

I will have to analyze the rest of the data later because the little net-book I have with me doesn’t have the gumption to chew on data sets of nearly 34000 records. So now we have the three older model Cave Pearls (and a pressure sensor!) cleaned up and in working condition… I think it’s time to put some thought into our next experiment!

Field Report 2014-08-25: Retrieve & Deploy New Flow Sensors

We started the day with breakfast at Turtle Bay Cafe, and once I had enough caffeine in my bloodstream to engage more than two brain cells at the same time, I reviewed the data on the SD cards from the overnight test runs. They all looked good.  Over breakfast we met up with Monika Wnuk, a multimedia journalist and documentary photographer from Northwestern University, who wanted to interview Trish for a water & development story she was working on. Yesterday, when she heard about our abbreviated schedule, she volunteered to help with the sensor preparation, and to provide shore support for our deployment dive. I was glad for the assistance, as two scheduled days were now being merged into one single operation.

Pre-dive planning with Bill, Trish, Monica & Jeff.

Pre-dive planning with Monica, Bil, Trish & Jeff.

Our diving field work almost always begins with a visit to Speleotech in Tulum, to see our long time friend Bil Phillips. Bil taught me to cave dive many years ago, and I still have much to learn from that remarkable man, who is without doubt one of the most dedicated cave explorers in the world. We also had the good fortune of meeting another good friend, Jeff Clark, who loaned me some equipment I needed for the days dive. The dive community in Tulum has always been generous to visiting researchers because they understand, more than most people, what is at risk with the rapid development that is happening in the region.  We all share a passion for protecting the caves as both a vital water resource, and as areas of natural beauty & wonder.

Checking for rotation, damage, etc.

Inspecting the old units for rotation, damage, etc.

With the kit sorted, we headed out to our main deployment site where I began to adjust the buoyancy of the new sensor units. With the new internal copper ring of ballast mass (45g), and heavier
aluminum battery holders, it only took 2-3 external washers to bring each unit to my target of 15 grams negative. This is slightly heavier than the last deployment but I am expecting any reduction in the tilt angle to be more than compensated by the 14bit 1g resolution of the new BMA180 accelerometers.  With
calibration out of the way,  Trish and I set off on the dive. High tide at the coast meant the system was experiencing very low flow, so we had a relaxed swim, with three new pendulums and a pressure sensor stowed neatly in the mesh bag by my side.

Old vs. New

New  vs. Old

Once at the site, the first task was to do a general inspection of the old units, noting anything unusual in my dive notebook.  After almost five months of submersion, there was plenty of rust on the stainless steel bolts and one of the units needed it’s anchor plate replaced.  Using the checklist I had prepared earlier, we swapped each unit in succession with it’s replacement.  In the calm conditions, percolation obscured our view a bit as our bubbles meandered around the ceiling of the cave, but it was still a very simple operation to exchange flow sensors.

Once the new units in place, we did a final inspection swim:

…checking that the new units were secure, with the X axis of the accelerometers oriented toward north.  While this is not strictly necessary with magnetometers inside the units,  I can use it as a rough confirmation of the compass bearings when I get the chance to do some proper data analysis later. I gathered the old sensors into the mesh bag and we made our way out of the cave.  I am not sure I can fully express the excitement that an inventor feels returning from a dive like this, but it’s very, very cool.

I think there is an ocean and a sunset in this picture. But at the time, we did not even notice it.

There is an ocean and a beautiful sunset in this picture. But at the time, I don’t think we even noticed it. (photo courtesy Monika Wnuk)

Back at the surface we had a chance to do a better visual inspection of the old units, which all appeared to be intact. I had some concern about the hull penetrations, as none of the epoxies were rated for long duration marine exposure. But the indicator LEDs were still piping on schedule, telling us that they were all still running.  Back at the dorms, we were equally thrilled to find complete data sets recorded on the SD cards.  (I will post more on the actual data after we have a chance to work on it.)

 <— Click here to continue reading the story—>

Building your sensors & underwater housings from scratch

I reviewed my build journal recently, and found enough themes in there for another bit of bloggy catharsis.  No one should mistake this as the advice of an expert in anything, as I have a long way to go before I start collecting karma points at the playground. But at least I can claim that these ideas are well tested, because as the saying goes, I never make the same mistake twice – I make it 5 or 6 times… just to be sure.


Only RTC & interrupt lines get soldered to the mcu.

Only RTC, SD, & interrupt lines soldered to the mcu.

Join the forums: Everyone says read the datasheets first….well from this beginners perspective that’s B.S.  Even when I started to understand all the terms I was reading, it was still a major leap of understanding to realize what the information in the data sheet implied… (and I still go through it with each new sensor)  If you want to get rolling on something start with the discussion forums, because it’s likely that someone there has already walked down your path, or one very close to it. Thirty minutes Goggling Sparkfun, Stack Exchange, or searching through places like the Arduino Playground, will get you farther than several hours reading the datasheet. Of course you will eventually end up doing that too...just don’t start there.  Often the forums lead you to some well commented GitHub code examples.  It is so much easier to understand the data sheet, when you have a piece of relevant code in front of you at the same time. Datasheets are written solely for corporate electronics engineers, because unless you represent the 10 to 100 thousand unit MOQ,  you simply don’t show up on company radar.

( Sometimes it even seems that a company deliberately tries to hide the functions built into their own ICs from the maker community.  For example: the mysterious Digital Motion Processor (DMP) functions of the invensense 9150. I have yet to find a single example of an Arduino script accessing these features though the 9150 is commonly used in quad copters. I’d have thought that having Euler angle & 9DOF quaternion calculations done for free, would have drawn some serious attention from those those guys.)

You need one completely “trusted” set of kit:  Which you will pay dearly for, but you need it to test out each new component you are thinking of adding to your project. (I still haul out my original Uno for this from time to time, because the darned thing is virtually indestructible…)

More than a few of the cheap eBay boards are D.O.A.

About 1 in 10 of the cheap eBay boards are D.O.A. This  ADXL345 board had a pretty typical alignment skew: X & Y axes were ok, Z did not read.

Connect new parts one at a time:  Do not add to your grief by connecting two new untested pieces of equipment to each other at the same time. (like, for example, a new FTDI board, and an Arduino clone of off eBay….grrrrr….) I am slowly learning what it is that you are paying for when a given sensor module sells for $20 from a trusted source like Sparkfun and $2 from China.  It’s probably not the components (although I hear there are fake IC’s out there) but something else that’s just as important.  If you watch the Tiny Circuits promo vid, around the 5 minute mark you see a person manually re-positioning the components that the pick and place machine laid down, and then around 7:15 you see someone testing each board before shipping. At this point I have seen enough of the eBay stuff that I am pretty sure that these two steps are never done on the clone boards. So If you go down that route, you are implicitly agreeing to do those jobs yourself (in addition to cleaning off all the excess flux left on the boards…)  This is not a problem when I am just hacking something together, and then testing it on the bench (or in the bathtub…) but not a risk I will take lightly for the fieldwork units.

And while we are on the topic of those cheap modules, they almost always arrive with connections broken out for both SPI and I2C, but you will likely use them as one or the other, meaning that you often need non adjacent pins soldered onto the breakout. I used to fiddle with crappy metal “helping hands” things (now replaced by a far more effective Panavise Jr)  to get those single pins soldered into place, but now I simply use a bread board to hold the pins in the correct locations before soldering:

Many thanks to my bother Mike for showing me this soldering technique!

Many thanks to my bother for showing me this soldering technique!

Modularize your designs:   Breadboards were never very practical for me because most of my projects get bashed around, and are supposed to run while the whole thing is in motion. But even after the prototype stage my sensors are not usually soldered directly to the data loggers. Yes, it’s a pain constantly making custom all those custom interconnect cables, especially since I color code everything – I2C bus, interrupt lines, …everything. And once you get an early prototype working, immediately build another one, and do all of your tests, etc., on the second unit, with the first working unit just sitting on the shelf.  Then if something stops working, you can use process of elimination with the known good modules to isolate the cause of the problem quickly. Often this technique helps me identify that the problem is actually in the software, and not with the hardware at all.  But I am still wading my way through the wonderful world of crimp connectors for ones that will prove robust enough for fieldwork. (note: I’ve adopted Deans Micro Plugs for my current builds…)


Hit the verify button often, even when you make “simple” changes:  Don’t wait till you have been working for half an hour because humans can only remember 7±3 things (for this human, even less than that…)  You will be backtracking allot and error messages in the AVRc programming environment are usually about as helpful as a baby crying. You know something is wrong, but often you cant figure out what the problem is from the feedback it give you.  Something as simple as: “Hey man,  you left out a semicolon at the end of line 17” can be reported with anything from a one line “Expected X before Y” error to twenty (or more…) lines of cryptic compiler faults. Sometimes Google is your only friend when this happens.

The utility of a piece of code is directly proportional to how dangerous it is to use: For example: Global #define statements are tricky…especially when you are using libraries, because you never know when you have tried to “re-define” something hidden in one of those libraries. Interrupt handling is another example of something tremendously useful, and really easy to screw up when you have more than one sensor generating interrupts in the same piece of code, at the same time.

Software faults almost always show a repeating pattern of behavior: At least that’s been my experience so far. Bad wiring, or some other issue with the physical build, (like a v. regulator thermaling out…) hangs the system in a way that is much more unpredictable.  Of course, finding those patterns is a heck of a lot easier when your project is a data logger in the first place…

Physically putting “stuff” together:

Third time’s a charm:  If your alpha works at all; that’s a great success. The holes will be in the wrong place, you will use too much epoxy, and it will be a clunky octopus of dodgy wiring. But even if it only runs for a single day, it has done the job of showing if the idea will work. (and they make such stylish book-ends…right?) The second build lets you sort out the right physical locations for all the components, and eliminates that hour of laborious hand-sanding that you really did not need to do.  This is also the model that lets you work out most of the software bugs, because it is usually much easier to open & close without breaking fragile jumpers all the time.  But for me at least,  it’s the third build that usually comes together in a way that feels right.

This type of bench vise is worth finding. I picked this used one up for $10, and it has been fantastic for holding parts together while epoxies cure & solvents weld PVC parts.

This type of bench vise is handy. I picked this one up for $10, at a garage sale and it has been fantastic for holding parts together while epoxies cure & solvents weld.

Adhesives & epoxies can be one of the most expensive components in your physical build:  (I wasn’t expecting this one) I go through a fair bit of Loctite E30-CL  (or E00CL for better PVC bonding) for my hull pen-etrations, and I love the fine control of the applicator gun.  But the mixing nozzles alone are more than a buck each, and they are elegantly design to waste a large volume of that precious epoxy with every use, which then solidifies inside the nozzles turning them into expensive single use devices.  That irritated me enough to start experimenting, and it turns out that Goof-off  (mainly xylene, and 2-ethanol) cleans out those applicator nozzles relatively easily. (Acetone would also work) I usually buy my adhesives from Zoro Tools. (note: their product search function is terrible, I use Google Shopping to hunt for stuff on Zoro’s site)  There are plenty of cheap Loctite sellers on eBay, but many are hawking expired lots.  In a pinch, I fall back to good old JB weld, and I use PlasticWeld putty absolutely everywhere because it nicely adheres sensor boards to both PVC & ABS in a way that is strong, but still removable (sort of..) if you have to repair something. Be careful not to bridge contacts with your adhesives on really sensitive sensors.  Most of these epoxies do not conduct electricity, so I use JB weld to shore up weak jumpers on I2C lines all the time. I have had problems with some sensors not working after gluing, probably because the cured epoxy added capacitive effects to the circuits. I have also started experimenting with 3M’s VHB double sided tape (for low surface energy plastic & acrylic substrates) to see if that is easier to work with. (Note: after testing the VHB did not work as well on the pvc as the standard 5lb mounting tape)

(…and if paying an “arm and a leg” for your adhesives wasn’t bad enough, those cheerful, brightly colored labels hide some fairly dire warnings about skin contact literally causing cancer, or vapors so dangerous that use of the product anywhere other than a open field is guaranteed to give you brain damage & significantly harm your … uhhh … “reproductive capacity”. Don’t believe me? Get a 200x microscope and read that fine print for yourself… just make sure you do it some place far away from stoves, heaters, electric motors and all other sources of ignition…like soldering irons 🙂 )

The shop course that you only took in high school to boost your marks will finally start to come in handy:  Turns out that working with PVC is almost the same as working with wood, so I was surprised by how much time I spent scoping woodworking forums while figuring out how to cut weird angles and then re-assemble things.


An angle grinder pulls the rust off of old school tools in short order.

You can build anything with three pieces of  “iron”: A good soldering iron, a drill press, and a 13″ bench top scroll saw (which cuts PVC and trims circuit boards beautifully).  I have not regretted for one second putting down $100 for my little Haiko from Adafruit. (Wish I had bought the thing at the very start of this adventure.) But my other two irons are vintage Sears Craftsman models which cost next to nothing because when I bought them, they looked like flea-market clunkers from the days before plastic was invented. Cleaning them up was worth the effort because they weigh a ton, and are rock solid stable. In fact, these days I actually go out of my way to get old tools for my workshop. So if you see me one morning, at yet another garage sale, don’t be surprised if my hands are full of weird drill bits,  strange clamps, and other rusty lumps of metal that are even older than I am.

And last but not least:

I know everyone has their own taste, but I find that Pandora’s “Chillout” channel (in the Dance/Electronic genre section) just has a really good vibe for working on the bench. Spacey electronica wallpaper-music smoothly delivers the hyper focus I need to sustain a long soldering session, especially when the clock ticks on into the wee hours… .

Addendum 2014-07-29 

I have another one to add to this list but it stands outside of any category because it seems to apply equally. I call it the ‘Principal of Equivalent Annoyance’, and it’s just the observation that the dumb little things on a project take up at least as much time as the big important things. For example: when you connect allot of parts together, the physical behavior of your wires matters more than you’d expect because the difference between good insulation and stiff hard plastic puts quite a bit of pressure on the wires when you fit everything into the housing. Once and a while I am left with some excess lead wire from a sensor and when I open up the left over multicore cable I sometimes find a meter or so of the perfect wire.  Soft silicone insulation, 12 or more strands, no tinning… the stuff is fantastic to work with and is so flexible that it doesn’t stress the connections. Of course it never has any identification marks on it that might lead me to the source.  So I am slowly working my way through every brand of hook-up wire on the market, searching for this holy grail, and wasting more time on it than I even want to think about.  I suspect this is kind of thing happens on every project.

Addendum 2014-09-13

There are a few contenders so far in my ongoing search for “the perfect wire”: 

Adafruit sells 26AWG in multiple colors. This is my current favorite wire because they sell it in easy to handle packages (~0.95/2m) and they have the only grey & orange colored stuff I have found so far. It probably sounds silly to mention the packaging, but from other vendors like Hobby king, or eBay, you can expect to spend at least an hour untangling the spaghetti when your wire arrives. Their 30AWG is 0.70/2m, and is very handy for running jumpers across the surface of a breakout board.

Sparkfun sells their red & black silicone hook up wire at a good price, I just wish they had more colors.

Cal Test Electronics CT2956 Test Lead Wire:  (24awg $9 for 10 m, green, white) It is soft multi-strand bare copper and there is some variability in the stiffness as they seem to use different stranding depending on the color you order, but all of it is much more flexible than pvc insulated wire.  The insulation is nice and thin, so it crimps well into the standard 0.1″ connectors, and it is a bit stiffer than the Turnigy, so it will hold a bend you put in the wire.

Turnigy Soft Silicone Wire: (24awg $.60-$1 per meter, red, black, yellow blue) which is popular in the RC plane/Quadcoper crowd. Multi-strand “tinned” copper, with lots of colors. The very soft insulation is about twice the thickness of the Cal Test, but it still crimps nicely. (note: Hobby King does not let you mix warehouses on orders…)

There are two drawbacks to to using really soft silicone wire: You can not push the female crimp connector ends into the housings as you normally would with jumper wire. You have to dig in and pull the connector through the enclosure with tweezers.  The other issue is that because the silicone conducts heat so much faster than pvc, you will burn your fingers more often while soldering if you are not careful. In return,  you can stuff as much spaghetti as you want into a very tight housing without putting pressure your the solder joints in the process.  The wire stripper from Pololu, works well on both types of wire.

Addendum 2016-03-11

More eBay vendors for silicone jacket wire are appearing over time, and they are a great place to find a wider selection of colors like brown, purple, & pink. With module & jumper builds like mine, you need as many different colors as you can get your hands on. 

Addendum 2015-01-09 

I received a 10″ craftsman 21400 band saw for Christmas this year. And just like the night & day transition that occurred when I went from a crummy soldering iron to the lovely Hakko, my cuts have now become more accurate and virtually effortless.  No more risking my fingers trying to cut pipe on the table saw! And free-handing with a band saw accomplishes 90% of what I could do with the the jig saw as well.  If you can only afford to own one cutting machine, then I am now convinced it should be a bench-top band saw. Wish I had it from the beginning…

Addendum 2015-01-16

Looks like I am not the only one who is irritated by the waste generated by the Loctite 50ml nozzles. The folks over at RCuniverse confirm that acetone makes a good solvent for cleaning out the mixing tubes, and that its easier to do if you remove the white plastic mixing baffles first. They also mention that putting the nozzles in bags in the freezer will prevent the epoxy from setting, so I might try this trick to see if I can get the tubes to “self clean” by gravity. Looks like All-Spec is the cheapest source for the nozzles, but I keep finding “generic” mixing nozzles on eBay that claim they work with both 3M and Loctite adhesives. Haven’t tried them yet though.

Addendum 2015-02-02

I bought some of the cheep MA5.4-17S 17 element mixing nozzles, and although the fit perfectly onto the 50ml dispenser, they were much shorter than the 15cm, 20 element, Loctite 98623 nozzles I usually use:


I thought this was a good thing, as I hate wasting all the epoxy that is left in the dispenser after every use and these smaller ones only retained 1.68ml in the barrel. I did some test pours under nearly identical conditions, and the smaller nozzles left a significant “swirly” pattern when the cured epoxy was examined close up a few days later:

Left side: Loctite Nozzle Right Side: Short Generic Nozzle

Left side: Loctite Nozzle                                                   Right Side: Short MA5.4-17s nozzle

I am interpreting this as a density gradient formed by inadequate mixing in the shorter nozzles. The epoxy has still set hard as a rock so I am not sure if this compromises the integrity too much. There are also listings for MA6.3-20S and MA6.3-21S nozzles, and I will try some of those next time.

(Note: the MA6.3’s worked great, as did the $10 applicator guns on eBay)

The new fleet of flow sensors is ready to sail!

Hi everyone. I wrote most of this entry on a plane today, as it was almost the first free time I’ve had “away from the workbench” since the initial proof of concept loggers were deployed last year. I have redesigned the Cave Pearl data loggers into a more modular platform that should be flexible enough for quick field repairs, while enabling future development with more sensors.  (I want at least CTD, and my wife has an infinte supply of other suggestions  🙂

The loggers are now assembled in four interchangeable components, which from top to bottom are:

1) Upper housing

It was too cold in the basement for the epoxies to set properly...

It was too cold in the basement for the epoxies to set

Lots of lessons have been learned here about sealing the hull penetrations thanks to the diy ROV crew. Sort lengths of 3/4 pipe form “wells” to protect the sensors, with JB Plastic Weld putty wrapped around the wires as they initially pass through from the inside of the housing. The putty sets on the roughened surface, pluging the hole and holding the sensors in position, but I found that the silicones I tested flex quite a bit after curing, so they are too easily “sheared” away from the pvc surface. As a result,  the current builds use JB weld around the DS18B20 thermal sensors, and Loctite E-30CL to for a transparent seal over the “heartbeat” LEDs which pip when the samples are taken. Experience has shown me that you must have some way of knowing your units are working happily (or if they are in an error state…) before you dive them into the cave.

2) Main electronics platform

The LED is an Octopus Brick because they had a good buckled connector, and the RTC is a cheap DS3231 module from eBay because I wanted the AT24C32 it had on board.

The LED is an Octopus Brick because they had a good buckled connector, and the RTC is a cheap DS3231 module from eBay because I wanted to use the AT24C32 eeprom it also had on board.

I am still quite happy with Tinyduino, as the package integrates the mcu, accelerometer, and now digital compass, with the smallest footprint and the least amount of extraneous wiring. I put riser pins on their new overhanging protoboard, and this jumps out to a grove I2C hub as a central interconnect system allowing me to interchange the logger platform with housings that will sport different sensors in future.  All of the electronic components have had a good bath of conformal coating this time around, so hopefully they will be a bit more robust. (I might try Rustoleums Neverwet next time)

3) Power supply

The gap between the two shells provides room for the interconnect, and some filtering caps, etc. if needed.

The gap between the two shells provides room for the interconnect, and some filtering caps, etc. if needed.

Physically it’s just two pvc knockout caps held together with four bolts & a 1cm “hold down ring” to keep it in place in the lower housing. Electronically there are two versions. The first is an unregulated supply uses two banks of 3 AA batteries, through Shottky diodes to prevent the banks from draining unequally. This supply will drop from 4.5 volts down to a lower cutoff of 2.8 volts before the system stops logging, so it needs fairly robust sensors. The second power supply uses three banks of 2 AA batteries (with three Shottky’s) feeding into an NCP1402 3.3 volt boost regulator which then powers the logger. Several of the sensors I want to use have a strict 1.8-3.3v input range, so they can not be used with an unregulated system. It will be interesting to see if the greater “draw-down” enabled by a boost regulator compensates for the power it wastes (here about 25%). This deployment will hopefully be some months long, so I will find out how the regulated VS unregulated systems actually perform.

4) Lower housing & external weight system

This series needs about 100-150 grams of ballast mass to be neutral.

This series needs about 100-150 grams of ballast mass to be neutral.

The buoyancy troubles we had on the initial deployment showed me that I needed some form of external system to compensate for changes in battery mass, cable buoyancy, salinity, etc. So I have a simple solution using a bolt through a threaded end cap which holds a number of washers as ballast. All stainless steel, but I am curious to see how long they actually last in the near marine environment. The buoyancy mass will be spit evenly on the top & bottom of the units to prevent rotational torques which which would affect the angle readings.

The battery run down tests are still looking very good for one year + deployments!

The battery run down tests are still looking very good for one year + deployments!

So this is the new fleet: Four pendulum units and one high resolution temperature &  pressure sensor that will remain stationary.  Hopefully they will all be underwater logging in a few days. Looking back at the build journal, I should add that there has also been a fair bit of coding, but I will post details on all that later, after I have integrated support for the HMC5883L digital compass & MS5803 pressure sensors into the main logger script.

BUT before we deploy these new units,  we need to go and retrieve Beta’s 1&2 which we left in a cave last December.  My fingers are crossed that they have survived these last few months under water…

<—Click here to continue reading—>

Addendum 2015-01-07

For the DIYers out there, I should mention that this housing style proved quite robust through several deployments in 2014, and probably could go to substantial depth due to the thickness of the 3″ end caps.  But in early 2015 I came up with a new design built with Formufit table caps, which is much easier to assemble provided you can squeeze your electronics package into 2″ pipe.

Field Report 2013-12-06: The moment of truth…

A couple of days into the UNAM research, there was break in the schedule, so we had the opportunity to go back and retrieve the units. When we arrived at the installation site, everything looked exactly as we had left it, with no apparent leaks or other damage to the housings.  But on closer inspection, we did observe that the two units were not exactly behaving the same way:

After catching a little more video, we spent a few minutes collecting the sensors. A short while later we finished the dive, and soon I was carefully cradling the loggers on my lap as we drove back to the CEA dorms. Once there I made sure that the units were absolutely dry before I opened them up to retrieve the SD cards.  I could see from the size of the files that both units ran smoothly, and had logged data. But what had they recorded?

Once the files were on the laptop, my wife, an Excel virtuoso, took over.  Within moments we were starting to see bumpy graphs displaying the three axes of the accelerometer.
A little more adjusting, a few labels, and we were looking at this:

3 days of raw data from the very first deployment.

Raw data from the first deployment: x,y&z axes, but with different orientations relative to flow direction.

“Is that good?” I asked. I could barely contain my excitement.

“Yes,” she replied with a big smile, ” for uncalibrated, first run data, this is pretty good.”

“Why two peaks per day?” I thought there might be a problem with the sensors.

“Actually.” she added, “That’s normal.  This area has semi-diurnal tides, and the velocity curves are often asymmetrical like that.”

“Yaayyyy!” I whooped, “We did it!” And I think I even started dancing.  Months of noodling around in the basement, and combing through forums, had just been transformed from “another one of Ed’s crazy projects…” into two real working prototypes!

It was well into the evening by this point, so we headed out for a late dinner, and a couple of celebratory ‘cervezas’.  We discussed where we might put them next, so that we could learn more about the quality of the data they were generating. I wondered about how we might calibrate them against some commercial units, and Trish said that even without ‘absolute’ velocity numbers, the information would still be useful to her research. But for me,  the real bottom line was the moment when she asked:

“How soon can you make me some more of these things?”

<—Click here to continue reading—>