Smart Home Assistant

How to 3D Print an ESP32 Enclosure (Step by Step)

SepehrBy Sepehr· 19 October 2026· Updated 19 October 2026· 7 min read
✓ Independent — no paid placements✓ UK-tested in real homes✓ Cited sources
Black and white photo of an ESP32 development board with header pins resting on grid paper

Key takeaways

  • Design an ESP32 enclosure around your own board: measure it with calipers and add roughly 0.2 to 0.4 mm of clearance per side.
  • Espressif recommends at least 15 mm of clearance in all directions around a PCB antenna inside a housing.
  • PLA softens at roughly 55 to 61 °C, while PETG typically holds to around 75 to 85 °C, so PETG is the sensible default.
  • Print a thin test-fit piece first, and compare Wi-Fi signal strength with the board in the open and sealed in the case.
On this page[tap to expand]

An ESP32 enclosure is easiest to 3D print when you measure your exact board, keep the antenna clear of the walls and print in PETG rather than PLA. Allow an evening and one test-fit print. The mistake that bites most people is boxing the Wi-Fi antenna in.

If you already run ESPHome sensors on bare dev boards, a printed case is the cheapest way to make them safe to leave on a shelf, in a cupboard or by a window. It also stops cats, dust and stray fingers shorting the pins. The steps below work with any printer; nothing here needs an enclosed machine.

What do you need before you start?

  • The board itself: in hand, not just a product listing. ESP32 dev boards vary between brands and revisions, so a case designed for one clone often won't fit another.
  • Digital calipers: a cheap pair is plenty. A ruler won't get you close enough for snap-fit lids.
  • A 3D printer and a slicer: if you are new to printing, the guide to slicing a 3D model for the first time covers the bit between a model file and a finished part.
  • CAD software or a ready-made model: see Step 3 for both routes.
  • Your firmware plan: know which sensors and cables the box has to expose. If you haven't flashed the board yet, start with ESPHome for Home Assistant: a beginner's guide and the ESPHome Device Builder walkthrough.

Step 1: Measure the board and everything on it

Put the board on a flat surface and record length, width, the height of the tallest component and the position of every mounting hole. Measure the USB port too: its centre height from the board and its opening width decide where the cut-out goes. Espressif's own ESP32-DevKitC V4 guide lists a micro-USB port as the default power and programming connector, but many clone boards ship with USB-C instead, so check yours.

Write the numbers down in a small table so you can reuse them when you change boards:

MeasurementWhy it matters
Board length and widthSets the inner cavity size
Tallest component, with headers fittedSets the cavity depth. Pins on the underside add height if you use headers.
Mounting holes (if any)Many dev boards have none, so you need standoffs or rails instead
USB port position and widthPosition of the cable cut-out
Antenna end of the moduleThe area to keep clear (Step 2)

Add clearance in the model rather than in your measurements. A starting point is 0.2 to 0.4 mm of gap per side, tightening or loosening after your test print, because every printer and filament shrinks a little differently.

Step 2: Plan where the antenna, USB port and sensors go

Does a plastic case block ESP32 Wi-Fi?

A plastic case does not meaningfully block Wi-Fi, but a tight one can still hurt range. Espressif's hardware design guidelines recommend a clearance of at least 15 mm in all directions around a base board's PCB antenna inside the housing, and say to test throughput and range on the finished product. Treat that as the number to design to: leave the antenna end of the module overhanging empty space, with no screws, wires or metal next to it.

Practical consequences:

  • Put the antenna end at one end of the box and keep the cavity there empty, rather than centring the board.
  • Keep cables away from the antenna. Route sensor wires out the far end.
  • Avoid metal screws, magnets and foil near it, and don't mount the case flat against a metal surface.
  • Mount the box high and away from large metal objects like a fridge or radiator, if you can choose.

Next, decide what has to be reachable. The USB port needs an opening if you will reflash it in place, or you can power it over a header and leave the case sealed once it's working. Buttons, LEDs and sensors each need a window or a standoff. A light sensor needs a clear opening; a PIR or motion sensor looks through a window sized to its lens; and a temperature or humidity sensor wants airflow.

That last point matters because a powered board warms the air in a closed box. A temperature sensor inside the case will read higher than the room. Give it vents on two opposite faces, or mount it on a short lead outside the box, and place it away from the regulator and the module.

Step 3: Model the case (or download one)

You have three realistic routes, in order of effort:

  1. Download and adapt a model. Printable cases exist for the popular dev boards on Printables, Thingiverse and MakerWorld. Check the listing states which exact board it fits, and compare its internal dimensions with your Step 1 numbers before you print anything.
  2. Use a parametric box generator. Several free tools let you type in the inner dimensions and get a box and lid. This is the fastest route to a case that matches your measurements.
  3. Design your own. A box with a lid is a simple first CAD project. NozzleNotes compares the free options in FreeCAD vs Fusion 360 vs Tinkercad; Tinkercad is the quickest for a rectangular case.

Whichever route you take, build in these details:

  • Wall thickness of about 2 mm or more, so the part doesn't flex.
  • Screw posts or a friction-fit lid. Screw into plastic with self-tapping screws, or use heat-set inserts if you plan to open the case often. Snap-fit lids are neat, but fatigue after a few openings, especially in a brittle material.
  • A strain-relief path for the USB or power cable so tugging it doesn't pull on the board.
  • A mounting method: keyhole slots for screws, a flat back for double-sided tape, or a magnet pocket (kept away from the antenna).
  • Vent slots where a sensor or regulator needs airflow. Short slots usually bridge fine without supports; test a small one first.

Orient the model so the lid and base each print on their flattest face. That avoids supports and keeps the visible surfaces clean.

Step 4: Choose a filament and print settings

For a case that sits near warm electronics, material matters more than looks. PLA softens at roughly 55 to 61 °C, which a box in a sunny window or next to a radiator can reach. PETG's glass transition is typically around 75 to 85 °C, which makes it the usual sensible default. For a hot location or outdoors, step up to ASA or ABS.

MaterialHeat tolerance (approx.)Best for
PLASoftens around 55–61 °CPrototype fit-checks and cool indoor spots
PETGSoftens around 75–85 °CGeneral indoor cases, sensor boxes, cupboards
ASA / ABSHigher than PETGSunny windows, garages, outdoor or hot locations

Figures are typical values; always check the datasheet for your own spool, as formulations vary. NozzleNotes has a fuller comparison in ABS vs PETG.

For print settings, there is no magic recipe: three perimeters and a moderate infill (around 15 to 25 per cent) give a rigid case without wasting plastic. Print the base and lid flat, and slow the first layer for good bed adhesion. If your lid will be a push-fit, print it in the same filament as the base so both shrink the same way.

A note on the chip itself: Espressif's datasheet gives an operating temperature of –40 to 125 °C for ESP32 chips without in-package flash, with –40 to 85 °C for variants with in-package flash or PSRAM. The plastic around it, not the silicon, is the weak link in a warm room.

Step 5: Print a quick test fit first

Before you commit hours to the full case, print a thin test piece: just the floor of the box with the posts, or the lid's lip. Drop the board in. If it's tight, add 0.1 to 0.2 mm to the cavity; if it rattles, take it back. This one small print saves a failed overnight job.

When the test piece fits, print the real case. Check the USB cut-out with the actual cable you use. Chunky cable ends often need a bigger opening than the bare port.

Step 6: Assemble, flash and test in place

Seat the board, route the cable through the strain relief, close the lid and power the board up. Then test the thing that the case could have affected: signal strength. Add a Wi-Fi signal sensor to the board's ESPHome config so the reading (in dBm, where values closer to zero mean a stronger signal) shows up in Home Assistant:

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 60s

Compare the Wi-Fi signal reading with the board sitting out in the open and then sealed inside. If it drops noticeably, move the board so its antenna end has more empty space, or reprint with a longer cavity at that end.

Leave it running for a day and look at the temperature readings if the box holds a sensor. A steady upward drift compared with a thermometer in the same room means the sensor needs vents or a lead outside the box.

Common problems and fixes: why won't it fit, or why is Wi-Fi weak?

The board won't go in: the usual cause is printed holes coming out smaller than modelled. Add 0.2 mm to the cavity and re-measure with the calipers.

The lid is loose, or a snap tab cracked: snap tabs are weakest across the layer lines. Orient the tab so the layers run along it, or switch to screws.

Wi-Fi range dropped: check the antenna clearance against the 15 mm guidance above, move cables away from it and keep the case off metal surfaces.

The case warped or sagged near the board: that is the sign of PLA in a warm spot. Reprint in PETG, or ASA if it is somewhere hot.

Sensor readings are too high: add vent slots, or move the sensor out on a short lead away from the regulator.

What should you make next?

Once one case works, keep the board measurements as a template and reuse them for the next project. A wall-mounted version of the same box, with a window for a presence sensor or an e-paper screen, is a natural follow-up. If you want to add infrared or radio control to a board like this, our guide to Home Assistant RF devices covers the ESPHome IR/RF proxy option.

Buy the picks in this guide

Recommended for Home Automation

See all devices →

Frequently asked questions

Can you 3D print an ESP32 enclosure in PLA?
Yes, you can print an ESP32 enclosure in PLA, and it is fine for a prototype or for a cool indoor spot such as a shelf or a cupboard. The caveat is heat. PLA softens at roughly 55 to 61 °C, and a box in a sunny window, above a radiator or in a loft can get there, after which the case sags and the lid stops fitting. A powered board also adds a little warmth inside a closed case. For anything permanent, PETG is the safer default, and ASA or ABS suit hot or outdoor locations. Use PLA for your test-fit print, check everything lines up, then print the final case in the tougher material.
How much space does an ESP32 antenna need inside a case?
Espressif's hardware design guidelines recommend at least 15 mm of clearance in all directions around a base board's PCB antenna inside the housing, and they advise testing throughput and range on the finished product. In practice that means placing the antenna end of the module at one end of the box and leaving that part of the cavity empty, with no screws, magnets, metal or cables beside it. A plastic wall on its own does not block Wi-Fi in any serious way. If signal strength drops after boxing the board, compare readings with the board out in the open, then lengthen the cavity at the antenna end or move the cables away.
What is the best filament for an ESP32 case?
PETG is the best all-round filament for an ESP32 case. Its glass transition is typically around 75 to 85 °C, comfortably above what a living room, cupboard or shelf reaches, and it is tougher than PLA, so screw posts and clips survive being opened more than once. Choose ASA or ABS for a sunny windowsill, a garage or any outdoor box, since they tolerate more heat and sunlight, though they print less easily. Check the datasheet for your own spool, because formulations differ between brands. If the case will hold a temperature sensor, add vents regardless of material, because a powered board warms the air inside a sealed box.

Sources

Sources verified 2026-10-19

  1. Espressif — ESP Hardware Design Guidelines: PCB Layout Design (ESP32)
  2. Espressif — ESP32-DevKitC V4 Getting Started Guide
  3. Espressif — ESP32 Series Datasheet (operating temperature)
  4. ESPHome — WiFi Signal Sensor
  5. Snapmaker — PETG Glass Transition Temperature Explained
  6. Wevolver — PETG temperature resistance: heat limits and practical insights
›How we researched this

Claims in this article are checked against primary sources — manufacturer specifications, official documentation, Which? research, Ofgem guidance, or gov.uk — rather than forum threads or video reviews. Where the author has direct hands-on experience with a product (most Home Assistant, Zigbee, and home-networking gear is running in his own homelab), that is stated explicitly in the text.

For categories outside that personal setup — such as boilers, heat pumps, and other areas that are traditionally a heating engineer's domain — verdicts are built from cross-referenced manufacturer data, published lab results, and vetted expert and owner reviews rather than a claim of personal hands-on testing. See the editorial policy for the full methodology.

Sepehr

Written by

Sepehr

10+ years hands-on with Home Assistant & networking · Research-backed elsewhere · No brand deals

Smart home specialist with 10+ years running a self-hosted Home Assistant setup — Zigbee2MQTT, Frigate NVR, and local-first automations. Independent coverage for UK homes, no brand deals.

LinkedIn →

Citing this page? Please use a dofollow link back to the original article — it helps us keep the data on this page accurate and up to date.

Related reading