The CAD-to-Circuit Handoff: Designing Enclosures That Actually Fit Your Electronics
A practical guide for industrial design students on designing 3D-printed enclosures that fit real PCBs: USB ports, heat-set inserts, tolerances, cable strain relief and the draft-print workflow.
The first time you try to put a real circuit into a nicely modeled enclosure, you spend two hours on the CAD, forty minutes on the print and then realize the USB-C port on the ESP32 is sitting two millimeters behind the wall of the case. You can plug the cable in just fine. You just can't get it back out again.
You cut the wall open with a hobby knife, scar the print forever and learn something nobody teaches in a CAD class: the enclosure and the electronics are the same design problem. You can't finish one before you start the other. The people who do well on physical computing projects are the people who figure this out in their second year instead of their fifth.
This is a post about the boring, specific details that sit in between "the board works on my desk" and "the board works inside the object you made for studio." Most of them are not hard. They are, however, easy to forget until you're holding a ruined print.
Model the components. Actually model them.
A rectangle labeled "Arduino" is not a model of an Arduino. It's a placeholder and placeholders lie to you.
For every major component (dev board, battery, display, connector, speaker) find a real STEP file and drop it into your CAD. Most manufacturers publish them. If they don't, someone on GrabCAD usually has. The common ones:
- Arduino Nano / Nano Every: Arduino's own site has a STEP file under "Documentation"
- ESP32 dev boards: Espressif sometimes publishes them, otherwise GrabCAD
- Raspberry Pi models: Raspberry Pi publishes mechanical drawings and STEP files for every Pi and Pico variant on their docs site
- XIAO boards: Seeed publishes STEP files on each product page
- 18650 and LiPo cells: the vendor rarely publishes these, but the dimensions are standardized; model your own cylinder once, reuse forever
- USB-C connectors: Molex, Amphenol and JAE publish STEPs for their specific part numbers
Drop these into the assembly at their final positions before you model a single wall. You are not designing a shell. You are designing negative space around real objects.
If you skip this step, the rest of the post won't help.
The USB port sits further in than you think
Every single person doing this for the first time gets the USB-C or micro-USB port wrong. The port on a typical ESP32 dev board sits about 0.8 to 1.5mm inboard from the edge of the PCB. The connector itself is 2.4mm tall. You need a hole in the enclosure wall that's:
- Big enough for the cable boot, not just the plug. The plug is 8x2.5mm but the boot on a chunky cable might be 12x6mm.
- Aligned to where the port actually is (not where you think the edge of the board is).
- Surrounded by enough clearance that you can grip the cable and pull it out without hitting the wall.
Rule of thumb: if you can touch the metal of the plug with your fingernail when it's seated, you'll never pull it out under stress. Move the hole one millimeter further out.
Mounting bosses, heat-set inserts and the sad truth about glue
There are three ways to hold a PCB inside a 3D-printed enclosure and exactly one of them survives being opened and closed more than five times.
Glue works the first time and fails whenever you need to replace the board. Use it for demos you plan to throw away.
Printed bosses with self-tapping screws (like little PCB-mount wood screws) work okay for two or three open/close cycles. Then the threads chew through the printed plastic and the screw spins freely. If this is all you have time for, use M2 or M2.5 self-tapping screws, not M3. M3 splits FDM prints down the layer lines almost immediately.
Brass heat-set inserts are the right answer. You print a hole sized for the specific insert (e.g., 3.2mm hole for an M2.5 insert), heat it with a soldering iron at ~200°C and press it in. The insert melts the plastic around its knurls, cools and gives you a real threaded hole that lasts hundreds of cycles. A starter pack of inserts is about ten dollars. A bit for your soldering iron is another five. It is the single biggest quality upgrade you can make to your prototyping workflow for the money.
Once you've used heat-set inserts, you will never go back. Literally never.
Tolerances are a material property, not a CAD setting
A hole you model as 3.0mm will print at somewhere between 2.7 and 3.1mm on an FDM printer, depending on the material, the nozzle, the speed, the flow rate and whether the moon is full. You need to know which direction your printer errs and by how much.
The shortcut: before your project needs to print, print a tolerance test block. Holes from 2.0 to 5.0mm in 0.1mm steps. Slots. A few standard screw threads. Measure them with calipers (the cheap digital ones are fine). Write the offsets down somewhere you'll find them later. You now know that your school's Prusa prints holes 0.2mm small and slots 0.15mm small. Design around it.
Rules worth keeping in your head that have never steered anyone wrong on FDM:
- Holes: model 0.2 to 0.3mm larger than the shaft you want to fit
- Press fits: model with the target dimension exactly, sand or ream if tight
- Sliding fits: 0.3 to 0.4mm clearance
- Screw clearance holes: nominal + 0.3mm (so an M3 screw goes through a 3.3mm hole)
- Self-tap bosses: 80% of the screw's nominal diameter (an M2.5 screw self-taps into a 2.0mm hole)
SLA prints from a Form 3 or an Elegoo are a whole different story. They print more accurately but shrink differently depending on orientation and cure time. If you're using the SLA printer in the lab, ask whoever maintains it how much it shrinks, because nobody writes it down.
Cables need channels, not "space somewhere inside"
Here's the thing you realize the third time you assemble an enclosure: loose wires are the enemy. They get pinched in the seams. They put tension on solder joints. They pop out of JST connectors when you close the lid.
Model wire channels into the print. These are little troughs or slots or posts that route the cable along a specific path. They don't need to be fancy. A 2mm-wide slot along the inside wall is enough to keep a wire from flopping around.
Also give every cable a strain relief point: somewhere the cable is mechanically clamped, so that if the wire gets yanked, the yank goes into the plastic and not into your solder joint. A simple approach: print a small bracket that the cable snakes through in an S-curve. The friction alone is enough for low-force cables. For anything that will be pulled hard (USB, battery leads), add a tiny printed clamp with an M2 screw through it.
Heat: the thing ID students never think about
An ESP32 running WiFi at full tilt puts out a surprising amount of heat. A Raspberry Pi 4 running at full load needs real cooling. A buck converter pushing 2A gets warm. None of this matters for the first thirty seconds of your demo. It matters for the five-minute critique where the professor is asking slow questions and your chip is thermal-throttling inside a sealed acrylic cube.
You don't need a heatsink on most student prototypes. You do need:
- At least one vent slot near the top of the enclosure (heat rises; put holes where the heat goes)
- A corresponding intake slot near the bottom
- Not to seal the board against a wall that blocks airflow on its hottest side
If the object must be sealed for aesthetic reasons, budget for the chip to run 15–25°C hotter than it would on the bench and pick components accordingly. LiPo cells, in particular, hate being inside hot sealed boxes.
The serviceability test
Before you commit to a design, ask yourself: can you open this, fix one thing and close it again, without destroying anything?
If the answer is "it's glued shut," you have designed a disposable object. That might be fine for a final photo. It is not fine for the three weeks leading up to the final photo, during which you will open it eleven times to fix bugs.
The rule: every enclosure gets at least one access panel secured with screws (not glue, not snap-fits that you engineered in twenty minutes and can't take apart). Heat-set inserts on the main body, screws into the inserts from the panel. Done.
Snap-fits are wonderful. Snap-fits you designed without reading a proper guide on cantilever beam geometry will break on the second open. If you want snap-fits, print the test pieces from Autodesk's or Prusa's published snap-fit guides first. If you don't have time for that, use screws.
Print the ugly one first
The last piece of advice is the one somebody should have shouted at you in first year.
Print a draft version of the enclosure before you print the nice one. 0.3mm layers. No supports unless absolutely required. Thin walls. Use whatever filament is already loaded. The goal is to have a physical object in your hand within ninety minutes so you can:
- Verify the PCB actually fits
- Plug in the USB cable and see if you can unplug it
- Check that the lid closes with the wires inside
- Feel how it sits in the hand
You will find at least one problem. You will update the CAD, make a second draft, print it again. By your third print, the fit will be correct. Then and only then, do you print the real one in the nice filament at 0.15mm layers overnight.
The students who skip the draft prints are the ones who end up with a gorgeous final print that doesn't close.
None of this is glamorous. None of it shows up in the portfolio shot. The portfolio shot shows a clean object that looks like it was made by a real company.
It looks that way because the person who made it thought about the USB port at 1am on a Sunday, printed a test block on a Monday, put heat-set inserts in on a Tuesday and did three draft prints before the final one. Good industrial design is a stack of small decisions that nobody sees. Physical computing is the same, just with more wires and more opportunities to set yourself on fire.
If you want the actual shopping list for heat-set inserts, calipers and everything else in this post, the best tools for ID students building interactive prototypes piece is the one to read next.