3D printing housings for underwater electronics projects

My my, it is loooong time since I have added anything to this Blog. It seems even Covid wasn’t enough to remind me that it was languishing in a corner! But, part of a current project feels like it would be useful others, so …

TL;DR – if you want to make complex cases for electronics that can handle tens of metres, for a few tens of £/$, then I have done some trials that may be of use. Includes using SLS Nylon or machined Acrylic for cases, clear acrylic windows with compact O-ring seals, and button and cable choices.

I’m working on a pet project that needs electronics within a waterproof housing that can handle typical diving depths – mechanically similar to a dive computer, though for other things, not managing decompression. At 40m that is a pressure difference of 4 bar, or roughly double that for a car tyre, so needs much more care than typical ‘waterproof’ hobby type enclosures that might handle a metre or two, for 10 minutes or so, but couldn’t handle deeper or longer.

There are some pretty good examples of techniques that can work, for example milling from sold blocks of Delrin (like the Shearwater Petrel and others) or aluminium or plastic castings (e.g. camera housings). But, although these are very doable, they need an expensive CNC mill or expensive contract manufacture. There are also reports of other techniques like 3D printing, but with more variable results, or with limitations that didn’t suit me.

So, part through need and part through intrigue, I thought I’d experiment with ways that were much more maker friendly. As a slightly self imposed set of limits, that means that router style CNC machines (e.g. the typical 3018, though at the more ‘Pro’ end that can at least work at good tolerance, and on engineering plastics) are OK, as are FDM printers (aka filament based), and SLA (aka UV cured resin). But not the bigger ‘hobby’ CNC mills that are typically a few thousand quid. And, I also allow for contract 3D printing manufacture, which is pretty cheap and allows access to techniques such as SLS, but not contract milling (or at least not so far!). I make no claim that what I lay out is the best approach, its very much work in progress, and I’ve gone down a few routes that I thought made sense but later realised/read were dumb – i.e. the normal iteration process! So, there are bound to be some still here – I’ll update as I find them, but feel free to note any suggestions.

I’ll put some more details on the main case in this post, and then follow up with more info on buttons, cables, wireless charging through thick cases, pressure testing and other stuff in later ones.

Transparent windows

I’ll start with the window as quite a bit ended up driven by choices for this. Milling cast Acrylic sheet, was the first technique I tried, and has ended up being pretty good. I considered using a glass window (e.g. via waterjet cutting), and still could, but it would be more expensive, and Acrylic allows o-ring grooves and retention lips to be milled into the lid, which gives more options for the other face, for example to avoid milling both sides of a piece, which requires a good jig for alignment when the item gets flipped over.

I went for 6mm sheet, mostly by assuming that if it worked for Shearwater at depths of 100m++ then it would work for me, and much less would deflect too much which would be visually annoying even if it was watertight. Key learning was that it MUST be cast acrylic sheet (e.g. Perspex), not extruded. Extruded just melts on the milling bits. The other tip is that burr type milling bits seem to get slightly better surface finish which matters for the O-ring seals.

The more complex piece for windows is sealing them to the body. I thought the best option was probably O-ring seals as I understand them to be more forgiving than gaskets, and they are pretty ubiquitous. There are some pretty well established guidelines for use – e.g. here. And, of course, plenty of examples in things like camera housings.

For a pressure handling seal, it works much better if there is a properly sized groove, not just compression between two faces. That means the major mechanical loads are taken elsewhere and the O-ring is just being compressed for the seal. This becomes very important for switches and glands where the design on devices typically bought just isn’t effective for pressurised underwater use. I’ve been through a dozen or more trials for those, and whilst there are alternatives, I am moving to just using proper o-rings in grooves everywhere, as they ‘just work’.

It’s also worth noting that if you can’t get an O-ring of the right size, then using Nitrile cord and butt joining it with cyanoacrylate works well. The compression means there is still a good seal, especially if some silicon grease is used on the o-ring.

Something that has taken a few iterations is how to secure the window. My first trials used a bolt on each corner and one in the centre of each side, running into holes tapped directly into the acrylic, as you can see in the photo below. This was initially promising, but leaked when submerged a couple of metres, even when I made an 8mm thick lid that was stiffer. The reason was that the o-ring pressure distorted the acrylic of the lid as it got further away from the bolts. This could probably be solved by using larger diameter and softer o-rings, but that would also make the joint larger or limit design options.

The next trial used many more bolts, so dramatically reducing the space between them, as you can see below. This was rather hacked together to allow testing on a dive trip, and might well have used rather more than needed, but I wanted to first get it waterproof, and then optimise! This has been used to 20m for 30+ mins, with no leaks. However, it also required a rather wide face which was fine for a test, but made the whole device bulky.

In this version the tapping into the acrylic also needed more precision than I could achieve at the time using a hand tap, into blank holes cut using a mill (I didn’t have exactly the right drill bit). So I ended up using locknuts instead, which work but contribute to the size. In a separate trial I tested using a drill rather than a mill to cut the blank holes, and then a thread mill for the thread. This actually worked very well for high enough precision threads into cast acrylic – I’m not using it in the latest prototype, but it seems a reliable technique.

One other design feature that I think will be useful, and have kept, is that the edge is milled down about 0.5 mm outside the central window area. This means that when the window is put on the body, that small 0.5mm edge on the window goes just behind the case walls and dramatically reduces any inwards bending under pressure.

So, with water-tightness sorted, for the next major prototype version I tried a much more compact arrangement. In this case the o-ring groove is still in the window component, but the inside edge of the groove aligns with the case inside edge. This is mechanically fine as the wall is only pushing up, and the lateral force is taken by the window itself. The outside edge is only just inside the holes for the screws. I also used the minimum recommended curve at the corner which helped avoid the need for more space inside to allow for that curve.

I retained the high number of fasteners, with the logic that it reduced the load needed on each one, so made the mechanics much more forgiving. I also quite liked the steampunk look :-). The real case is made via SLS printed Nylon in this version, and I experimented with using thread inserts, which worked well, but in the end I have just used self-tapping screws which, as with the inserts, had a pull out force much much higher than I thought I needed. This allowed for a slightly thinner wall, saves a lot of time and hassle of precisely fitting the inserts, and a wide range of marine grade stainless screws (316 grade) are easily available. I was a bit concerned about whether repeated use would cause failures, but so far on this prototype I have removed and replaced the window 10 times whilst trying out button and gland seals and all screws are still holding very well. Since this technique allows the use of cheap SLS cases with minimal work I think up 10 or more uses is fine, and if there is an issue then its cheap to simply replace the entire case.

These choices allow the screws and the o-ring seal to fit into a 7mm case body wall width. This is hard to see in the real case as the case body is also black, but is fairly easily seen in the picture below, which was a trial fit using an FDM printed slice of the top of the case. This design for the window has been dry in 10 trials, including 20m depth for 30 mins. And, I suspect it would actually go a lot deeper, with a thicker case and window if required – I’ll test one to destruction at some point just to find out!

Case bodies

I mention FDM printers, and I’ve had some success with FDM 3D printed widgets that I’ve used at 100m depths, and many tens of dives, but these are not waterproof. Others have tried housings, but with limited success, even at shallower depths (though some have done much better e.g. see one that looks interesting here and makes me think I might try it out, though right now by SLS approach is feeling pretty good as it allows even more design flexibility ). So, I’ve not pursued FDM for real housings so far, though it has been very useful for rapid dry-land prototypes.

The first real prototype case body built on the window tests and used 6 milled Acrylic sheets, one for each face, bonded with acrylic weld cement. This allowed each face to be milled on a 3018 CNC with exact cutouts for buttons and alignment grooves so that pressure tended to push it all together rather than the welded joints taking load. I also made some bespoke FDM 3D printed spring jigs to aid alignment whilst bonding. The in progress view can be seen below, and end result in photos above. This worked very well though it was a fair amount of work to do – maybe 4 hours for each case (and much more the first time). The current design has moved away from this approach so I won’t expand further.

For the next prototype I wanted to try out a 3D printing approach like SLA or SLS that result in components that are solid rather than having the cavities and layer seams of FDM printing. I looked into getting an SLA printer as I quite liked the very high resolutions, and saw some examples of great results e.g. enclosures with 1000m ratings here. But, its a much more messy process than FDM, and there are good contract manufacturing options, so I thought I’d try it out that way first (I must be getting old – holding back from buying a new gadget!).

That also allowed me to try a Nylon case via SLS, which has better engineering characteristics than most SLA plastics, such as UV stability, and allowed easier use of things like thread inserts. The SLS process also gives very wide design flexibility as it does not need supports. Its also fairly cheap, with this prototype which is 107mm by 66m by 30mm and 7mm wall thickness, costing less than £30 including tax and delivery, and with options to refine to reduce that by probably 1/3 to 1/2 by optimising for the target depth and using a shell and ribs model rather than solid blocks of Nylon.

The one downside of SLS vs SLA is that the surface finish is a little rough – probably about what you’d get from 120 grit sandpaper. Its actually quite a nice texture, but not so useful for anything like O-ring seals that need a better surface. But, I found that I could design such that faces that need a smoother surface, notably where the window O-ring seal is, were on the outside and flat, so could be smoothed very quickly with emery paper (it took about 20 minutes for the four faces needed). And, since the body is normal Nylon12, rather than some more exotic UV cured plastic for SLA, it is possible to weld other nylon elements to it, such as cable glands.

The photo show the current SLS Nylon based enclosure. Whilst the reliable sealing of the buttons and glands is work in progress (hence the test #7 you can see on the leak source indication paper), the basic case body and window has worked in every test, so I think the the SLS based case body approach feels pretty promising.

Right, enough for this post. I’ll cover options for buttons, cable choices and cable entries, pressure testing and more in separate posts.

Posted in General | Leave a comment

Fettling the eSUN 3D Printing Filament Box

I keep meaning to buy a proper filament holder for 3D printing, ideally one that allows the filament to be dried before and during use. Whilst I could just build one, I saw the eSUN 3D Printing Filament Box Storage Holder on ebay that seemed to fit the bill, and provided spool weight too which is vwry helpful for understanding how much length you have left and whether it will do the print job contemplated. See https://www.ebay.co.uk/itm/eSUN-3D-Printing-Filament-Box-Storage-Holder-Keeping-Dry-Measuring-Weight-N1O7/113517683450

I bought it know that there was some slightly iffy feedback on heating / dehumidification / weighing, but I thought that at least it would be the right size for the spool, so I could fix the rest. That turned out to be wrong. A standard Colido 1kg spool was about 0.5mm too wide, so didn’t turn freely on the spindles. I found nothing on the internet about what to do about that, so thought I;d post my fix so future searches can find it.

The spool runs on rollers that are in bearings clipped into a plastic moulding that is in turn clipped to an aluminium base plate. To fix the issue I made the plastic plate about 1mm wider by cutting it in half and bolting directly to the baseplate using holes I drilled and tapped in it – see photo below. The bearings still run fine, and the spool now unrolls very cleanly.

In use I also found that the feed pipe came loose and the end tended to get dragged into the print head. So, I designed and printed a small widget that clamped the end of that pipe and held the filament so it fed cleanly into the printer. See below

Not tried actualy drying filament yet, so there may be more amends to come.

Posted in General | Leave a comment

DIY rubber gaskets via 3D printed moulds

A post for future web searchers who have complex gasket issues or want an example of a home 3D printer paying for itself in one use.

We have a multi-port valve on a pumped filter that we found had a leak. No biggie we thought, naively, we’ll just buy a new gasket for ~£20. So, er, no, turns out that unlike most other such valves the gasket for this is moulded into the rotor (the plastic water diverter). Well, ok, £60+ for a new rotor then? … no again. Might once have been a spare part, but not any more. Could put a new valve on at £120+, but looks like that needs plumbing changes and probably a new filter. So, inc. some hours of labour, not a lot of change from a grand. For one worn gasket. Sigh.

But, we thought, how hard can it be to create a replacement and stick it in? Worth a try.

Trial 1 – rubber sheet and cardboard template

The idea was to cut a new gasket from 5mm thick rubber sheet, using cardboard templates and a box cutter. Turns out to need much better knife control than at least I have.

Trial 2 – 3D printed cutting template

Logic was to provide much better guide for the knife by cutting around a template printed to the exact right size.

This turned out to also be very hard, with a knife slip only 70mm along the outside ruining the attempt.

At this stage I was thinking about just sending the CAD file to a water jet cutting service and having them cut it (which would work), but then had an even more cunning idea …

Trial 3 – cast in place using 3D printed shuttering

The idea was to print some small pieces of bespoke shuttering that allowed a gasket to be cast directly into the rotor, but also be levelled whilst proud of the rotor surface. Following photos show the first couple of elements in place, then all of them. I glued them in with PVA as its fairly low bond strength and water soluble, so later removal should be easier.

Then, as a further thought I used ordinary silicon sealant rather than ‘proper’ casting silicon. The surface was smoothed on application, knowing that the flexibility would mean minor bumps wouldn’t matter when used.

After a few hours to cure, I cut the printed shuttering away from the silicon. And the result …

This is basically as good as I could have ever hoped for. Total material cost was less than £10, plus to be fair quite a few hours, but then I like playing about with this sort of stuff. And the saving was as much or more than the cost of the 3D printer. Result!

Posted in General | Leave a comment

Using both transmitters on MAX3232 boards

As part of the gas analyser project I need some boosters for the ultrasonic transmitters. A common approach is to use MAX232 series of chips which are designed for converting from IC friendly voltages and currents up to RS232 line levels. The transmitter in the MAX3232 uses charge pumps to get from a 3.3 volt power supply to about -5 volts (for a zero) to +5 volts (for a one).

The chips have two or more transmitters, so using a pair of opposite signals, one on each side of the ultrasonic transmitter, allows double the voltage, or about 20 volts swing across the transmitter. I’m hoping that using this to drive a BPSK signal will allow pretty precise timing of the ping time in the sample gas.

These chips are easily available on tiny boards for only ~£1, for use (I think) in cables … but, despite having two transmitters and receivers, only one is brought out to connectors. But, the board is very handy as the capacitors are in place and keeping them close to the chip is helpful. And, both transmitters are there, so in case anyone else wants to use both transmitters on one of these boards … read on.

The photo shows a (very) zoomed in photo of the front and back sides. The TTL side is at the bottom and the RS232 side is at the top.

The two TTL inputs are on pins 10 (DIN2) and 11 (DIN1), and a quick probe shows that the TTL transmitter connection pad is connected to pin 10, and the RS232 transmitter pad to pin 7 (DOUT2). There appears to be no connection to pin 11, including any pull to ground or VCC, so it looks like using that second transmitter should be ‘simply’ a matter of taking a lead to pin 11 and 14 (DOUT2).

A moment or many later (my eyes, steady hands and level of practice don’t seem quite as good as when I was a teenager!) …

Time for a quick lash-up test …

Looks like 24 volts peak to peak (though with no load to be fair). I’ll settle for that 🙂

Posted in General | Leave a comment

disp_flush on Littlevgl / lvgl on Teensy 3.6

I am trying out a new embedded system called the Teensy 3.6, for the trimix analyser project, I have quite a bit to do on a screen, so thought I would use a library to help, with Littlevgl (normally called lvgl) seeming a good one to play with.

It has a neat screen buffer model that requires a local function, often named disp_flush, to write that back to the screen … and slightly surprisingly Google did not come up with any posts with just that bit of code I wanted, to allow it to fit with the optimised Teensy screen ILI9341_t3 library. It took me longer to work out what was required than it should have given it was in the end pretty easy, so for future travellers …

void disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t *color_p) {
  uint16_t * color_array_16 = (uint16_t *) color_p;
  screen.writeRect(x1, y1, (x2-x1+1),(y2-y1+1), color_array_16);
  lv_flush_ready(); /* tell lvgl that flushing is done */
}

I said it was easy! I may move it to a DMA model at some point, but at the moment it seems speedy enough as-is

Posted in General | 1 Comment