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 they 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 #332 3/16″width 2 3/8″ID x 2 3/4″OD, 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  bolts are just a wee bit bigger than the holes in the Formufit caps – so you will have to drill them out with a 1/4″ bit to let the cap slide freely, and only use nylon if your sensors are sensitive to nearby metal – otherwise go with SS.  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 & 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 well, 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.

We no longer use those large surface area potting – rings shown at the beginning of this post because as you go deeper the epoxy begins to flex, and this ruined some of our temperature sensing IC’s. So keep the diameter of your sensor mounting wells as small as possible, and try to mount the sensors/leds etc. 10mm or more below the epoxy surface.

Bio fouling on estuary unit after 6 months. As you might expect, critters usually kill our pressure sensors before salt water corrosion does.

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. Our experience is that the PVC housings are unaffected by salt water, and although marine critters will grow on the surface, even boring organisms would rather drill into the loctite epoxy than go through the PVC housings.  We often have to soak the loggers overnight in a muriatic acid solution to dissolve the encrustations before opening the housings.

Addendum 2016-07-31

I just stumbled across an interesting ROV build based on PVC pipe over at instructibles.com 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

“Marine-Grade” 316 stainless steel washers after five months exposure to salt water – after scraping away the ball of brown rust. Whatever the company claims about it’s durability, always cut that number in half.

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 wet. This is just enough for them to become loose over  a long underwater deployment unless you over-tighten them considerably going in. We’ve retrieved several loggers where the bolts that were tight when the units were dry, but could be spun freely when then logger came out of the water.  Fortunately the sliding cap design means the O-rings were held shut by the pressure at depth so that seal saved us from data loss.  Our magnetometer flow-sensors are sensitive to the presence of metal, but if your sensor combination is not limited by that I’d suggest you use stainless steel or titanium bolts to hold the housings together.  Or at least soak those nylon bolts in water for a few days before deployment so they are already expanded. 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.

Even stainless bolts corrode in seawater eventually, so lately we’ve been using SS bolts, with nylon nuts. That way even if the bolt threads are shot after a year (or two) in salt water, you can open your logger by cutting away the nut with a pair of clippers. Replacement bolts cost less than a fresh set of batteries, so you should probably add a new set of bolts whenever you change the AA cells. 

Addendum 2020-03-01

A quick up date on the progress wrt hull pass-throughs: We’ve been using the sensor pigtails (described on the waterproof connector page) for quite a while now with connector dongles that are potted in E30CL epoxy on the housing body. But that’s overkill for shallow water & surface deployments.  In those cases you can solvent weld threaded NPT connectors to the housing and attach the sensor dongle directly to the housing: (click to enlarge)

For deeper deployments where pressure is significant the hull pass-throughs are hardened with a thick well of epoxy.

For shallow/surface deployments: 1/2 inch threaded NPT connectors can be drilled allowing wires from the sensor dongle to pass through the bulkhead.

Smaller housing made from only two caps (April 2020)

We do observe some pressure-bowing on the flat end-caps below 20m depth even when the wells are filled with epoxy. And since the 1/2 holes necessarily weaken the bulkhead I won’t be deploying direct-connect loggers past 10m if they are made from schedule 40 PVC. With recent advances in power management we’ve also been able to decrease the size of the entire housing.  (w details at @ DIY data-logger Housing from PVC parts)

9 thoughts on “A DIY Underwater Housing for Arduino Data Loggers made from PVC pipe

  1. Barry Perkin

    Hi there Edward: I just wanted to tell you that your notes and website have been a absolute goldmine of information for sourcing supplies, use of materials/glues and the proving various designs. I wonder how you manage to cram that many extra hours into a 24 hour day as it seems you are an extremely busy person.
    My own ongoing project was to build an fully automated AUV, I actually built one 20 years ago, but never finished it because of various seemingly insurmountable technical problems, but with the advances in technology since then, especially in electronics (which has been my career,) it appeared that the problems I had on the earlier (ancient?) project might very well be solvable. So I have re-opened that project. My earlier big concern was diving and rising to a pre-selected depth, as well as automated obstacle avoidance, – maintaining neutral buoyancy and stable depth is the end goal. This time around, I think I have solved it by using a small geared down motor assembly, on a rack and gear which drives the plungers on (multiple) large plastic hypodermic type syringes which have their tips exposed to the open water, that way they would suck in and empty water as needed and thus maintain a buoyancy neutral condition, plus the added benefit is keeping the AUV interior dry. Another solved problem (like you,) had been sealing the dry core unit from leakage, I (like you,) realised on my original effort that using a stainless threaded rods running its total outside length would compress the end cap O rings and solve the leak problem, but finding a way to mount them successfully without bending or breaking the holding “L” mounting brackets became a problem, it was not until I came across your website (by accident), that I found out about the Formufit table sockets. One question I have, how strong are they, I’m thinking about mounting two on each end, tab to tab (one upide down to the other) hoping that the double mount will make them strong enough to prevent breaking. Two questions, how did you bend the 2 inch diameter cut socket to fit a 3 inch diameter end cap on your earlier style containers, -Heat? Also, do you not use the SCH40 primer when using the PVC glue?
    On a seperate subject. I am curious about why you don’t use Li-Ion batteries, the six AA batteries you talk about in the above article (very good btw,) are heavy and phyisically large compared to Li-Ion, which can supply you with more current than you need – and for a much longer time period, they can be easily and successfully waterproofed and a big plus for you is they would be smaller, (depenging on your current requirements), My background in electronics has bought me a lot of info about Li-Ion and their various “recipes”, so if I can help out, please let me know.
    One comment if I may, I found your site by accident while surfing for some other information. Your site is not easy to find. If you google “The Cave Pearl”, or just “Cave Pearl”, Google will give up results on everything regarding caves and pearls, but without your site being mentioned anywhere. You site is too valuable not to be noticed by people with similar interest’s. I now have you in my favorites list. Thank you again for your hard work on this site. Barry Perkin.

    1. edmallon Post author

      Wow! That’s alot to chew on, but here goes:

      1) Buoyancy: It sounds like you are using the same method as the underwater gliders, which I think is pretty cool. I have stuck with hard ballast for my buoyancy adjustments, as my sensors need to spend months under water, and I don’t know how deep you could go with those hypodermic syringes, or how many weeks they would go before they gave out. Obviously someone has solved this problem because there are quite a few research projects with ocean gliders that both go deep, and run for a long time.

      2) How strong are the Formufit table caps? I have not tested them to failure, but I can say that they easily withstand enough force to compress a 1/4″diameter EDPM o-ring to 50% before they start showing deformation, which is more than I need to keep the units water tight. Keep in mind that with metal bolts you don’t need to squash your o-rings too much, because at depth, water pressure does the job for you. In fact some of my early buoyancy control problems were produced by this effect, as I had not considered how much the internal volume was going to change as the water itself compressed my o-rings. The bolts only need to keep pressure on the orings in the last 5-10m as you surface, because the water pressure alone will not hold the housing together at those shallow depths. So your bolts don’t really have to apply tons of pressure, just enough to maintain a 20-25% compression on the o-ring. An important exception to this is when you are using nylon bolts which expand in length by 2-3mm after a week under water. With those I over-tighten the bolts until I see some deformation of the struts to compensate for the increased bolt length.

      3) On the older rounded 3″ endcap housings, I cut the brackets off of the formufit caps, and increased their interior circumference with a 3″ sanding drum on my drill press, which allowed me to glue them onto the larger diameter pipe. I always use primer before gluing, and then use a “high strength” pvc glue. I also roughen any surfaces that I want epoxy to bond to.

      4)Li-ion batteries: You invest too much on a fieldwork trip to risk having the work delayed because you ran afoul of some airline regulations. Then there is the self discharge issue. In tropical environments I am lead to believe that Li ions self discharge at >10% per month. For environmental monitoring, this alone would drive me back to alkaline batteries just to reach my one-year operation lifespan target. Then there is the simple idea of designing something that can be serviced with local parts, and AA batteries are easy to get your hands on just about anywhere in the world.

      5) You are right, “Cave Pearl” might not be great on a Google search, but the name has been with the project for quite a while now, and as a caver myself, I just dig it. If people look for “Underwater Arduino Datalogger”, the site places reasonably well, and that’s probably a more common way for folks to find the project.

      And also, check out the Homebuilt Rov Forum, and the forum over at OpenROV.com. You will find tons of really helpful stuff there too.

  2. GKM

    Hi Edward
    Thank you for all the valuable information that you post on this site. I am working on developing a turbidity sensor, and housing for it. I have tried to borrow your ideas on this, and I have made some great progress on my design but with some flooding issues that seem to recur. I was wondering what size of the pipe you used for the middle section in the taller of the “stormtrooper” housings ( the first photo in the blog post). Perhaps the supplier too. The middle piece sits flush with the 2 inch table cap, but I have not been able to locate a schedule 40 pipe that does that. The problem for me seems to stem from water leaking in between the walls of the caps and the pipe. If I can find a pipe piece that sits flush, and between O-rings, that might solve my problem.
    I also have used 2 inch table caps, and 2 inch schedule 40 pipe ( from Formufit). I have used stainless steel threaded rods, with washers, bolts and wingnuts to tie down the pipe with o-rings on both sides. I found McMaser-Carr to have a good selection of threaded rods and accessories.


    1. edmallon Post author

      The part between the two formufit end caps actually consist of three parts: a section of 2″ pipe which varies depending on the body length you want : a 2″pvc coupling : and another short section of 2″ pipe that only serves as a backer for the oring. Look at the exploded view of the extendable design (later in the post) and you will see those parts laid out. The couplings and pipe are off-the-shelf standard, but sometimes you need to cut & sand down the length of coupling due your bolt length limitations (which is why I suggest using threaded rod instead). Those central parts are solvent welded together, and I am VERY careful with my welds, taking time to clean, prime & glue those critical joints with heavy duty cement. And you also have to be careful not to get the solvent onto the pre-sanded oring seat in the process.

      I now use the extended body type for all of my builds because it gives me more room for batteries, and I am concerned that expansion from water absorption into longer nylon bolts will weaken the seal on the old storm trooper style builds. Those longer bolts also twist significantly, so if your nylon nuts are also wet (& expanded), it can be really hard to get them off.

      But drilling out the formufit caps into a slip-ring is hard to do safely because the pvc melts and then binds to the hole saw bits if you go too quickly. So be careful there.

  3. GKM

    Hi Edward
    Thank you so much for the info. I get it now, it is a PVC coupling, that I was getting confused about.
    I am only beginning to figure out the importance of sanding , O-rings, their size and compressibility.
    Thank you for the writing about these things. I hope to make some progress on the issues I have.

    1. edmallon Post author

      The epdm 332’s I’ve been using are closer to 5mm diameter which overhangs the oring seat a bit, but the 3.5 & 4mm diameters should both work, and at $0.99 for ten I would get the 3.5mm ones just to try them out. The reason I like thicker orings is that the nylon bolts increase their length by a couple of millimeters over a deployment after they have had a chance to absorb some water, so a thicker oring that is compressed a bit more at the start provides more bounceback to absorb that expansion. If you use stainless steel bolts, then you don’t have to worry about that issue and the thinner orings should be fine. I have not tried Nitrile o-rings yet, so would love to hear how they perform after you have had your build under water for a while. So far the critters have not degraded the epdm too much, and they have been holding up well to sites with alot of hydrogen sulfide.

  4. Justin davis

    Just curious, did you ever try using a PVC union? Seems like it would be easier than dealing with the bolts. I am thinking about using them because I want to use 3″ pipe.


    1. edmallon Post author

      I didn’t try them, but only because they seemed prohibitively expensive at the larger sizes. They would probably work fine for shallow-ish work – say to 20-25m?

Comments are closed.