Email us

Este artículo está en inglés. Ver el sitio en español

Cet article est en anglais. Voir le site en français

Dieser Artikel ist auf Englisch. Website auf Deutsch ansehen

Este artigo está em inglês. Ver o site em português

本文为英文。 查看中文网站

Waterproof enclosure for an ESP32 project: size, glands and sealing

Short answer: a manufacturer-rated IP66 stainless box around 6 x 6 x 4 in [150 x 150 x 100 mm] holds an ESP32 dev board, a charge board and two 18650 cells. Bring every cable in through a rated gland - an M12 cord grip with a 12.5 mm [0.49 in] hole suits a 3-6.5 mm sensor lead. Skip hot glue and uncoated 3D prints, and either fit a breather rated IP68 or change the desiccant; a tight box fogs from breathing, not from leaks you can see.

NEMA4 Enclosure engineering team · Published November 25, 2026 · 8 min read

Short answer: put the ESP32, its 5 V charge shield and the 18650 cell in a stainless box rated IP66, around 6 x 6 x 4 in [150 x 150 x 100 mm]. Bring every cable in through a compression gland - an M12 gland in a 12.5 mm [0.49 in] hole seals a 3-6.5 mm sensor lead. Leave the printed shell and the hot glue out of the weather: FDM walls weep along their layer lines, and glue peels off smooth stainless within a season. Then spend a minute on the vapor you sealed in, because a tight box fogs at night until you fit a breather or desiccant. Our wall-mount boxes are rated NEMA 4X / IP66 by the manufacturer, not UL listed, and they arrive with your cutouts in 10 business days.

What the box has to survive

Outdoors on a wall, water reaches your electronics three ways. Rain and hose spray hit the box as liquid, and geometry handles them: glands facing down, a drip loop, a door gasket in good compression. Humid air is the second front, and it condenses on the coldest surface the moment the box cools below the air's dew point. Third comes everything that crawls, because dust and insects hunt the same gaps water does.

The enclosure itself is the easy part, since a rated box shrugs off a hose. Your project actually leaks at the four openings you create: the sensor cable, the charge feed, the mounting fixings and the door seal. Spend your effort there, and buy the box to a rating that covers the worst jet it will ever see.

The rating to order

Pick the second digit by the water the location can deliver, and keep the first digit at 6 so dust stays out of the terminals.

Where the box mounts Order What the test throws at it
Under an eave, splash only IP65 6.3 mm nozzle, 12.5 L/min
Open wall, garden hose, washdown splash IP66 12.5 mm nozzle, 100 L/min
It can sit in a puddle or flood IP67 1 m of water for 30 min

IEC 60529 tests the second digit 6 with a 12.5 mm nozzle delivering 100 L/min from 2.5 to 3 m for at least 3 min. Digit 7 is immersion: 1 m of water for 30 min. IP66 is a jet rating, never an immersion rating, so a box that can be flooded needs IP67. For a project on a wall above grade, IP66 is the rating to order, and it is what our stainless line carries.

In US terms that level of protection is a Type 4 or 4X enclosure, and the conversion sits in the NEMA 4 vs 4X vs IP66 guide. NEC 110.28 says an IP code is not a substitute for an enclosure type rating in US installations, so a spec sheet that calls for Type 4X needs the type marked on the box. Many enclosures, ours included, carry both: rated NEMA 4X-type / IP66 by the manufacturer, not UL listed.

Why the printed shell and the hot glue lose

FDM prints come out porous. The nozzle lays a 0.2 mm bead, and the round bead leaves a void at every layer line, so an uncoated shell weeps the first time water sits on it under pressure. You can rescue a small print with two coats of epoxy on the inside and outside faces, and that will serve on a bench or a sheltered porch. For anything facing weather, use an enclosure whose seal someone type-tested.

Hot glue fails differently. It wets stainless poorly, and a cable that flexes in the wind works the fillet loose within a season. Keep it for what it does well, which is forming a gasket bed behind a screwed cable plate. For a sensor you want outside permanently, bed it in slow-curing silicone on a screwed stainless plate; that joint stays elastic for years, and you can cut it out with a knife when the sensor needs replacing.

Size: the board, the cell and a spare third

Count the parts before you pick the box. An ESP32 dev board is about 52 x 28 mm [2.1 x 1.1 in], and an 18650 cell is 18 mm in diameter and 65 mm long [0.7 x 2.6 in] by its own name. That set, plus a terminal strip, fits a 6 x 6 x 4 in box, which measures 6 x 6 x 4 in outside and gives you about 5.9 x 5.9 x 3.9 in [150 x 150 x 100 mm] of nominal inside room. Two cells, a relay board and room to wire call for the 8 x 6 x 4 in size, which measures 8 x 6 x 4 in outside with about 7.9 x 5.9 x 3.9 in inside. Leave about 25 % of the panel clear, the usual panel-builder margin, because the next sensor always arrives.

Fix the box through its wall-mount feet so no screw pierces the sealed volume; screws through an outdoor enclosure shows the patterns. On grade: 304 serves inland walls, and 316L wins where salt spray, pool chlorine or washdown chemicals reach the box. The wall-mount stainless line runs both grades from 6 x 4 x 4 in upward.

Worked example: heat in the 6 x 6 x 4 in box at 35 C ambient

Inputs:

  • Box: 6 x 6 x 4 in outside (H x W x D), stainless, the catalog size above.
  • Heat load: about 0.6 W for the board with WiFi active, plus about 0.5 W lost in a 5 V, 3 A charge shield charging at 1 A. These are typical figures for this hardware; measure yours at the 5 V input and scale.
  • Wall coefficient: 3.7 W/m2K for a stainless wall, the reference value our cooling guides use.
  • Limit: 40 C inside, the ambient most electronics are built to.

Rule in words: a stainless wall passes 3.7 watts per square metre for every kelvin of temperature difference, so the temperature difference equals the heat load divided by coefficient times wall area.

Arithmetic:

  • Wall area: 2 x (0.1524 x 0.1524 + 0.1524 x 0.1016 + 0.1524 x 0.1016) = 2 x (0.0232 + 0.0155 + 0.0155) = 0.108 m2.
  • Heat path: 3.7 W/m2K x 0.108 m2 = 0.40 W/K.
  • Rise: 1.1 W / 0.40 W/K = 2.7 K, so the inside sits at 35 + 2.7 = about 38 C.

Result: 38 C inside at 35 C ambient, 2 C of margin under the 40 C limit. In shade at 25 C ambient you would see about 28 C. The decision: seal it, with no fan and no vent. At 35 C ambient this box carries up to about 2 W, which is your 5 K of margin times 0.40 W/K. A 10 W supply would raise 25 C and land the inside at 60 C, over the limit, so then you step up a size or move heat out as removing heat from a small sealed IP66 enclosure shows. A wall in full sun adds roughly 10-15 C to the metal, and an ESP32 in a sealed box in a hot attic works that case in detail.

Cables in, rating kept

Every hole drops the box to that hole's rating, so make each opening a bought part. Metric cord grips cover hobby and industrial leads; the values below are typical catalog figures, and M20 gland hole sizes covers the biggest size in depth.

Gland Seals a cable of Panel hole
M12 3-6.5 mm [0.12-0.26 in] 12.5 mm [0.49 in]
M16 4.5-10 mm [0.18-0.39 in] 16.5 mm [0.65 in]
M20 6-13 mm [0.24-0.51 in] 20.5 mm [0.81 in]

Mount glands on the bottom face or low on a side, always facing down. A gland pointed up funnels water straight into its own seal, and glands facing up on an outdoor box shows what that costs. Hang a 100 mm [4 in] drip loop below every entry so water leaves the cable before it reaches the gland. Your 4 mm sensor lead goes through an M12 and the 5 V feed through an M16. If the sensor lead ends in a pre-moulded connector, passing a connector through a gland gives you the hole size that needs.

Order the holes with the box in the cutout designer. A field-drilled and resealed hole is where most DIY boxes lose their rating, while a punched hole with a torqued gland nut keeps it. If you prefer NPT cord grips, UL 50 Table 71-1A ties fitting dimensions to standard knock-out diameters, so the grip you buy matches the pre-formed hole. For the full assembly sequence, walk through making an enclosure waterproof with glands.

The fog you sealed in

Closing the door traps about 2.2 L of air, and air at 25 C holds up to 23 g of water per cubic metre, which is 0.05 g in your box. Cool that air to 10 C, where it holds about 9 g per cubic metre, and 0.03 g condenses onto the window and the board. That is one night of fog, and it comes from air you sealed in yourself, which is why a box can fog with perfect glands. Sealed against water, not against vapor makes the same point on a sensor pod.

The long-term source is breathing. The box warms in the sun and air expands past the weakest seal; at night it cools and draws humid air back in. A few cycles a week moves more water over a season than any sachet expects.

Handle it one of two ways. Fit replaceable desiccant: a 10 g sachet of silica holds about 3.5 g of water, roughly a third of its weight, and in a humid climate you replace it every 3-6 months, so date the sachet. Or fit a membrane breather rated IP68 high on the door, which equalizes pressure so the box stops pumping. The assembly keeps its IP66 because the vent's rating sits above the box's; the lowest-rated part always sets the rating. One diagnostic: a sachet soaked within weeks means a gland or gasket is breathing, so fixing condensation at the cable entry is your next job, not a bigger sachet.

What to put on the order

Item What to order
Enclosure 6 x 6 x 4 in 304 stainless wall-mount, manufacturer-rated NEMA 4X / IP66, not UL listed
If it grows 8 x 6 x 4 in for two cells, a relay and terminals
Where corrosion finds it 316L in the same 6 x 6 x 4 in size
Cutouts 2 x 12.5 mm holes for M12 glands in the bottom face, 1 x 16.5 mm for the M16 5 V feed, laid out in the cutout designer
Cable hardware Cord grips rated IP68, with stainless locknuts
Inside A dated 10 g desiccant sachet, or an IP68 membrane breather high on the door
Delivery 10 business days, counted from your order; custom layouts from your approval of the drawing

The decision by where it hangs: a wall above grade takes IP66, glands facing down, desiccant or a breather, done. Under an eave with no hose in reach, an IP65 box with the same glands holds. Anything that can sit in standing water, such as a ground-level pod for the sensor, takes IP67 on that pod while the electronics stay in the IP66 box above it. For a second pass at the same assembly, sealing an outdoor junction box walks it step by step.

Enclosures in this article

EnclosureMaterialOutside H x W x D / displayRating
6 × 6 × 4 in304 stainless6 x 6 x 4 inRated NEMA 4X / IP66 by the manufacturer; not UL listed
8 × 6 × 4 in304 stainless8 x 6 x 4 inRated NEMA 4X / IP66 by the manufacturer; not UL listed
6 × 6 × 4 in316L stainless6 x 6 x 4 inRated NEMA 4X / IP66 by the manufacturer; not UL listed

Questions

Can I charge the 18650 cell without opening the enclosure?

Yes. Run a 5 V feed through an M16 gland and charge inside, or fit a panel-mount USB socket rated IP67 with its cap fitted, and the box then holds about the socket's rating. A small 6 V solar panel feeding the same charge shield comes in through a second M12 gland; a 5 W panel covers a 0.6 W average load with margin for cloudy weeks.

How do I keep the temperature sensor outside the enclosure?

Pass its 4 mm lead through an M12 cord grip, which seals a 3-6.5 mm cable in a 12.5 mm hole, and hang the probe in free air under a drip loop. Gluing the probe to the wall makes it read the wall instead of the air, and a sunlit wall runs well above air temperature. Sensors at ground level get their own IP67 pod, with the electronics box above grade.

How often do I change the desiccant sachets?

Plan on every 3-6 months in a humid climate and write the date on the sachet; orange indicating gel turns green when it is spent. A 10 g sachet holds about 3.5 g of water. If it is soaked within a few weeks, the box is breathing through a gland or the gasket, so fix that joint rather than adding sachets.

Is IP67 worth the step up over IP66 for a garden project?

Only if it can be submerged. IP67 tests 30 min at 1 m of water, while IP66 already survives 100 L/min from a 12.5 mm nozzle, which is far beyond a garden hose. A box on a wall above grade never sees immersion, so IP66 is the right rating there; anything at ground level gets the IP67 rating on its own pod.

Does a stainless box with only 5 V inside need grounding?

Not with battery-only electronics - a 5 V project can stay unbonded. The moment a mains power supply shares the box, bond the door and body to the grounding bus, because NEC 250.96(A) treats a metal enclosure serving as a grounding path as a part that must be bonded. Keep mains and low voltage apart on the panel with a barrier.

Checklist before you order

Specify it once, built to your drawing

  • Environment and NEMA type: Type 1, Type 3R, Type 4, Type 4X, Type 6P, Type 12, Type 13 (manufacturer ratings, not UL listed)
  • Material: 304 stainless steel, 316L stainless steel, Powder-coated carbon steel, Aluminum, Polycarbonate, Fiberglass (FRP)
  • Size: inside or outside height, width and depth, with the depth your deepest component needs
  • Cutouts, glands and windows, dimensioned from one datum on each face
  • Mounting and access: wall, pole or stand, hinge side, mounting panel
  • Quantity: from one piece

Delivered in 10 business days, anywhere in the world. Counted from your order; for custom work, from your approval of the drawing.

Build it from 6 × 6 × 4 inRequest a custom quote

Check the heat load in the calculator · NEMA 4X enclosures: sizes for this job

Keep reading

More on layout and installation

All articles

Buying guides

The guides behind this answer

All guides