Short answer: yes — box it, and stop worrying about fire. An ESP32 with its radios dissipates about 1 W. A sealed 6 x 6 x 4 in [150 x 150 x 100 mm] stainless box sheds that watt for a 3 °C rise inside. Even a 50 °C [122 °F] attic with the hot roof radiating onto the box then lands the board near 58 °C [136 °F]. That is below the 70 °C line where PSRAM memory errors begin to matter, and far below the ~100 °C thermal shutdown. Two choices deserve your judgement: the antenna, which stays outside any metal box, and the roof's radiant load, which a foil shield blocks. The arithmetic below lets you check your own attic.
The three temperatures that decide it
Judge the job in die temperatures, not air temperatures. Under WiFi load the chip's own sensor typically reads 10-20 °C above the air around the board. A box that holds 55-60 °C inside therefore puts your die right at the line that matters. Three numbers govern everything:
| Die temperature | What happens | Basis |
|---|---|---|
| 70 °C [158 °F] | PSRAM bit errors grow; enable ECC in firmware above it, and electrolytic capacitors age twice as fast as at 60 °C | Working line for PSRAM builds |
| 85 °C [185 °F] | Documented maximum operating temperature; above it expect reboots and faster flash wear | ESP32 rating |
| ~100 °C [212 °F] | Thermal shutdown: the chip halts and restarts once cool | Chip protection, reported just under 100 °C |
Fire is the easy part. A 1 W board cannot heat its FR-4 laminate to ignition, and that laminate is UL 94 V-0 self-extinguishing anyway. What heat really buys you is reboots and a shorter life for the power supply — both fixable, neither dramatic.
How much heat a sealed box sheds
A sealed box rejects heat through its walls, and the whole calculation is one line: inside rise = watts ÷ (k × exposed area). Use 3.7 W/m²K for stainless, 3.5 W/m²K for plastic and 5.5 W/m²K for painted steel — the same reference values the enclosure sizing guide uses. The face sitting on a rafter sheds almost nothing, so count five faces of your box.
| Wall-mounted box | Exposed area | Rise per watt inside |
|---|---|---|
| Plastic IP65, 4 x 4 x 2 in [100 x 100 x 50 mm] | 48 in² [0.031 m²] | 9 °C [16 °F] |
| Stainless 6 x 4 x 4 in (catalog) | 104 in² [0.067 m²] | 4 °C [7 °F] |
| Stainless 6 x 6 x 4 in (custom) | 132 in² [0.085 m²] | 3 °C [6 °F] |
Double the wall area and you halve the rise. The little plastic box therefore runs about three times hotter per watt than the 6 x 6 x 4 in stainless one, which is why a board that cruises in steel can reboot in plastic under a roof. The 6 x 4 x 4 in box, the smallest in the stainless size finder, is already a 4 °C-per-watt box — comfortable for any sub-watt board outside a furnace.
The roof above it is a radiant heater
Attic air at 50 °C is only half of the load. A dark shingle deck in full sun runs about 70 °C [158 °F], and it radiates down onto everything below it. Between a 70 °C roof and a 50 °C surface the blackbody exchange is about 170 W/m²; after emissivity and view factor, roughly 60-70 W/m² arrives. Over the 36 in² [0.023 m²] top of your 6 x 6 in box that is about 1.5 W — half again the board's own heat, arriving for free.
Block your box's line of sight to the roof and those watts disappear. A foil dome, or mounting on a wall the roof cannot see, reflects nearly all of it, because bright aluminium has an emissivity under 0.1. Brushed stainless helps before you do anything: at an emissivity near 0.3 against plastic's 0.9, it absorbs about a third of the same radiant load. Outdoors the identical trick is a sun shield, and the outdoor enclosure guide shows how a sun shield cuts the solar load.
An ESP32 with two radios in a 6 x 6 x 4 in box at 50 °C attic air
Inputs — board figures from the field, thermal values from this site's reference set:
- ESP32 plus two radio modules, an inverter-monitoring build: peak draw about 0.2 A at 5 V (1 W), averaging near 0.5 W under WiFi duty.
- 5 V supply module at about 80% efficiency: ~0.25 W lost inside. Budget 1 W continuous — the round figure with margin.
- Attic air on a worst summer afternoon: 50 °C.
- Roof deck in view of the box: 70 °C, delivering ~70 W/m², about 1.5 W onto the box.
- Box: 6 x 6 x 4 in stainless on a rafter, five faces exposed = 132 in² [0.085 m²]; k = 3.7 W/m²K.
Rule: inside rise = watts ÷ (k × area). Feed the roof's radiant watts through the same surface as if they were generated inside; that lumped treatment reads a degree or two conservative, which is the safe direction.
Arithmetic:
- Own heat: 1 ÷ (3.7 × 0.085) = 1 ÷ 0.315 = 3.2 °C.
- Roof radiant: 1.5 ÷ 0.315 = 4.8 °C.
- Inside air: 50 + 3.2 + 4.8 = 58 °C [136 °F].
- Die, adding the typical 10-15 °C over local air: 68-73 °C.
- With a foil shield, radiant falls to ~0.2 W, worth 0.6 °C: inside ≈ 54 °C, die ≈ 64-69 °C.
Result and decision: unshielded, the board sits on the 70 °C PSRAM line — run ECC on and expect a supply swap about every three years by the capacitor rule below. Shielded, you hold about 6 °C of margin under the line and 27 °C under the 85 °C rating, so install it. As a cross-check, the same sum on the 4 x 4 x 2 in plastic box gives 9 °C of own heat and 8 °C of roof, for 67 °C inside and a die near 77-82 °C — the 76-82 °C that small sealed boxes under hot roofs actually measure. Keep inside air at or below 60 °C and every limit clears with room to spare.
Metal or plastic: the radio decides
The board's own radios settle the box material for you. Through a plastic wall the sub-GHz link to the inverter loses a fraction of a decibel, and 2.4 GHz WiFi loses 1-3 dB, so an internal antenna simply works. A stainless wall is a Faraday cage at these frequencies and costs tens of decibels, stopping your WiFi just as dead as it stops any other wireless signal.
If you want stainless anyway — cooler, tougher, rodent-proof — the antenna goes outside. Use a module with a U.FL socket and a bulkhead antenna bolted through the face, or pass a patch antenna's cable through a gland tightened on the cable's diameter. The cutouts and glands guide lists the hole sizes and sealing parts for exactly this job.
What actually fails first
The ESP32 outlives its neighbours. In long-running sealed installs the repeated pattern is a board still fine after years while a metering module beside it drifted, its regulator sagging until the readings went wrong. Heat ages the aluminium electrolytics in the 5 V supply you choose. The working rule: a capacitor rated 1,000 h at 105 °C lasts 2^((105 − T)/10) times that at T °C. At 60 °C that is 2^4.5 ≈ 22,600 h, about 2.6 years of continuous duty; at 70 °C it is 11,300 h, about 1.3 years. Buy a supply specified with 105 °C capacitors, mount it low in the box where the air is coolest, and treat it as the one maintenance item.
Sealing does the rest of what you bought it for. A dust-tight box keeps spiders and glass-wool fibres off the board, and one 10 g desiccant sachet at closing absorbs the moisture in the trapped air. The genuine fire risk in an attic is the mains joint: land the supply's line and neutral on rated terminal blocks, with the breaker locked out while you wire.
What IP65 means in an attic
IP65 is more rating than your attic will ever deliver, which costs you nothing. Digit 6 is dust-tight — that is what keeps insects and insulation dust out — and digit 5 already means jets from a 6.3 mm nozzle at 12.5 L/min. IP66 raises that to a 12.5 mm nozzle at 100 L/min, a washdown figure; the IP rating chart spells out the difference jet by jet. IP codes, like NEMA types, are manufacturer ratings — our enclosures are manufacturer-rated NEMA 4X-type / IP66 and not UL listed — so buy from a maker who actually tests the gasket.
What to specify
| Your build | Specify |
|---|---|
| Plastic box, antenna inside | IP65, at least 4 x 4 x 2 in; foil shield or out of the roof's sight; PSRAM ECC on; supply with 105 °C capacitors |
| Stainless box | 6 x 4 x 4 in or larger 304, one gland hole for the antenna; shield and ECC as above; manufacturer-rated 4X / IP66 |
| Roof in direct view | Add the foil shield either way: it removes about 4 °C of the load |
A custom stainless box with its antenna hole and gland cutouts already made is delivered in 10 business days, counted from your approval of the drawing. Start from the enclosure selector if you want size and mounting checked, or the stainless size finder if you already know the outside dimensions. Before ordering, run the one-line heat sum — watts ÷ (3.7 × exposed area), added to your attic's worst afternoon — and the three temperatures above tell you the rest.
Enclosures for this job
Catalog sizes that suit the job this article answers, picked from its subject; open one for its full specifications.
| Enclosure | Material | Outside H x W x D / display | Rating |
|---|---|---|---|
| 6 × 6 × 4 in | 304 stainless | 6 x 6 x 4 in | Rated NEMA 4X / IP66 by the manufacturer; not UL listed |
| 6 × 4 × 4 in | 304 stainless | 6 x 4 x 4 in | Rated NEMA 4X / IP66 by the manufacturer; not UL listed |
| 16 × 12 × 8 in | 304 stainless | 16 x 12 x 8 in | Rated NEMA 4X / IP66 by the manufacturer; not UL listed |
| 24 × 20 × 8 in | 304 stainless | 24 x 20 x 8 in | Rated NEMA 4X / IP66 by the manufacturer; not UL listed |
Questions
Can an ESP32 start a fire inside a sealed enclosure?
Practically no. The board dissipates about 1 W, the chip halts itself near 100 °C, and the FR-4 laminate is UL 94 V-0 self-extinguishing, so the realistic failure is a reboot loop or a heat-soaked regulator browning out. The one component with a real thermal hazard is a lithium cell: if you charge a battery in the box, charge it only between 0 °C and 50 °C.
Will WiFi work from inside a stainless steel enclosure?
Only with the antenna outside. A plastic wall costs about 1-3 dB at 2.4 GHz, but a stainless wall costs tens of dB and typically kills the link. Fit a module with a U.FL socket and a bulkhead antenna on the outside face, or pass the antenna cable through a gland, and the metal box costs you almost nothing.
What inside temperature should I design to for an ESP32?
Hold the air inside at 60 °C or less. That keeps the die below the 70 °C line where PSRAM bit errors grow, with the chip's typical 10-15 °C offset over its surrounding air already counted. The documented operating maximum is 85 °C and shutdown sits near 100 °C, so 60 °C inside leaves honest margin at every limit.
Is IP65 enough for an attic, or do I need IP66?
IP65 is already more than an attic delivers. Digit 6 is dust-tight, which is what keeps spiders and insulation fibres out, and digit 5 means jets from a 6.3 mm nozzle at 12.5 L/min. IP66's 12.5 mm nozzle at 100 L/min is a washdown number, not a rafter one.
Should I add vents to cool the board?
Skip them. At 1 W the sealed wall already holds the rise to about 3-9 °C depending on box size, and any vent or drain drops the whole assembly to that part's rating while reopening the door to insects. Above roughly 5 W in a small box, move up to a bigger box or an external heat path instead.





