I have a simple farm gate monitor which I'd like to put in a rugged waterproof enclosure to keep it dry enough to operate outside for approximately ten years with no maintenance other than the occasional change of battery.
Electronically, it's a reed switch connected to a GPIO pin on a TI CC1110 wireless MCU (I'm using the excellent Ciseco XRF module as a prototype). Those parts want to live inside some sort of box which can be mounted on a gatepost adjacent to a magnet on the gate. My CC1110 is programmed to wake up from sleep and broadcast a message when the gate is left open for longer than a threshold interval. Such messages are of interest to farmers for obvious reasons.
My hunch is that the biggest challenge will be keeping the electronics safe from the elements:-
What do I need to worry about? What are the subtle failure modes which I won't discover until the device has been sitting in a field for five years?
The advice on the internet on how to keep things dry is largely fragmentary and sometimes self-contradictory. There doesn't seem to be a definitive online guide to waterproof enclosure design, and I couldn't find a good book on the subject either.
There appear to be two schools of thought. The first believes that a waterproof enclosure is one that leaks faster at the bottom than at the top, the second believes that if you buy a suitable NEMA or IP rated enclosure then you can rely on it to keep the water out.
The naysayers worry that if your device is user-serviceable (changing batteries, for example), then it's very likely that bits of grit and soil will find their way onto the seal while the farmer fiddles about with it in the middle of a field and any waterproofing will come to an abrupt halt.
The Goretex corporation also tells us that changes in atmospheric pressure will create a pressure difference sufficient to push moist air past the seal and that condensation will ensue. They'll happily sell you a breathable membrane which you screw into an opening in your enclosure.
Other people (perhaps assuming there's a more substantial power source available) suggest accepting the internal humidity but trying to keep the temperature above dew-point by using a resistor or a light bulb as an ohmic heater.
Other guerrilla approaches involve filling the enclosure with mineral oil, silicone sealant, or hot glue to displace any moisture from the circuit. It's unclear whether any of these compounds will chemically attack any of the components over a long enough time period.
There are a number of manufacturers who will sell conformal coatings for the circuit board as well as a range of potting compounds. Potting RF components seems to be a complex problem (perhaps I just need to experiment with a few different potting compounds to see if it works). I've also never quite been sure what to do with the battery connector. Should I solder wires to the board and have them poke out of the potting compound? Will water wick through stranded cable? Should I worry about the warnings that the flexing of the battery cable will damage a conformal coating? Would rigid header pins on the board protruding out of the coating (or potting) be a better choice?
How long will a battery clip last in a humid enclosure full of condensation? They're generally nickel plated. Is that good enough, or do I need to protect that too? I understand you can't pot batteries because they expand and contract slightly as they charge, and that sounds a bit drastic anyway as they're going to have to be replaced.
Alternatively, should I subscribe to the second school of thought that it's possible to achieve a hermetically sealed enclosure in the real world if you buy the right kit?
Who manufactures enclosures with reliable seals? How long should I expect the seals to last? Do they need replacing or oiling periodically? Would putting some silica gel in such an enclosure be sensible?
Alternatively should I use a transparent enclosure, put a small solar panel inside it to trickle charge a battery or super-capacitor, permanently glue or weld the thing shut and declare that there no user-serviceable parts inside?
Keep the device super simple and as low power as possible, to keep battery changes infrequent.Then, put it all inside a waterproof polycarbonate box with a gasket (there are tons of these - I've used ones from Gainta a couple of times). Design your mounting system carefully with a sort of "eaves" made of plastic. The box can send a "keep alive" chirp once in while, as a sort of fail warning - you could use that to trade off a little bit of reliability. My answer assumed this is not a production run - that would change things drastically.