Designing 3D Printed Enclosures for Electronics: PCB Mounts, Vents and Cable Entry

A good enclosure for electronics is designed from the inside out. The board decides where the box is fixed, where the openings go, how much heat has to get out and where the cable comes in. This guide goes through those decisions in the order we take them, with three enclosures we designed and printed ourselves: an ESP32 development board, an NVIDIA Jetson Orin Nano and the PDL-1 data logger.
Start from the board, not the box
The best starting point is a STEP export of the assembled PCB from your ECAD tool (KiCad, Altium, Fusion and others can all export one). It carries the board outline, the mounting holes and every component in 3D, so connectors and tall parts land in the CAD model exactly where they are. Without one, the board outline with its mounting holes and the heights of the tallest components is enough for a first concept. If you only have the physical board, we can measure it and model it.
Before drawing a single wall, write down four more things:
- Where it will be used: indoors or outdoors, on a desk, on a wall or in the hand, and the highest temperature around it.
- What has to be reached: USB for programming, buttons, an SD card, a battery to change, displays and LEDs to see.
- How often it is opened: once at assembly, or every time someone services it. This decides between screws, inserts and clips.
- How many you need: one prototype, a small batch, or a design that will later go to injection moulding.
Keep functional walls at 1.5–2 mm minimum; under 1 mm, FDM walls are unreliable whatever the material (rule 1 of our ten design rules). Add ribs where a large wall or the lid must stay stiff, instead of making every wall thick.
1. Fixing the PCB
Use the board's own mounting holes: they are where the board designer expected it to be held, and they keep the screws away from the components. A screw into a printed boss under each hole is the default. What goes into that boss depends on how often the enclosure is opened.
Heat-set brass inserts are our choice for anything opened more than a few times. In our screw boss worked example an M3 thread-forming screw in PETG could be reused only about five times, while an insert keeps the same thread and clamp force every time. The ESP32 enclosure below has brass inserts in its four corners for exactly that reason.

The boss itself needs as much thought as the screw. In the same example, the first M3 boss held 513 N; with an insert and three small ribs it held 1,517 N. The weak point of a printed boss is its base, where it can tear along the layer lines, so a fillet at the base and ribs to the nearest wall help more than a thicker boss. Our free screw boss designer gives the hole and boss sizes for inserts and screws in each material.
With more than one board, give each one its own standoff height. In the PDL-1, every post in the body has a defined job: some carry bosses for the M2.2 × 6 PCB screws, some are plain standoffs, and some guide the boards into place during assembly. Each board can then be removed without disturbing the others.
Check the temperature of the plastic, not only the air. In our heat-rise example the hottest wall of a sealed PETG box reached 63 °C, close to PETG's 69 °C heat deflection temperature. At that point bosses and clips keep only about 42 % of their stiffness and screws can loosen.
2. Connector openings, buttons and displays
Place the openings from the PCB model, not from a datasheet drawing: the connector's position on the real board and the board's height on its standoffs both move the opening. The PDL-1's rounded side cut-out lines up with the USB-C connector on the main board, and both displays sit behind their own windows in the cover.
Three details decide whether a connector opening works the first time:
- Size it for the plug, not the socket. The moulded body of the plug is much bigger than the socket. If the wall is thick, the body hits the wall before the contacts engage. Thin the wall locally with a pocket, or bring the connector closer to the wall. Measure the cable you will actually use.
- Allow for tolerances. The board can shift inside its mounting holes, and printed holes come out slightly small. We start from 0.15–0.3 mm of clearance on faces that touch (rule 7) and leave connector openings a little larger, then check the fit on the first print.
- Make holes in side walls printable. A round hole in a wall that stands upright while printing has an unsupported top that sags. A teardrop shape (a 45° point at the top) or a flat top that bridges across prints cleanly.
When a wall carries many ports, it is often better to make it a separate panel. On the Jetson Orin Nano enclosure the whole front I/O panel is its own part, fixed with screws. It prints flat on the bed, so every port opening is a clean hole through a flat plate, and if a port changes we reprint only the panel, not the whole enclosure.

3. Vents and heat
Plastic is a poor conductor of heat, so electronics in a printed box run hotter than most people expect. In our worked example a Raspberry Pi 4 drawing 6 W in a sealed 120 × 90 × 40 mm black PETG box heated the air inside to 65 °C in a 30 °C room, 15 °C over its limit.
The most effective fix was vents, placed low on one side and high on the other: cool air comes in at the bottom, is warmed by the board, rises and leaves at the top. With 1,500 mm² of slots low and the same high, the air settled at 47 °C; with a 40 mm fan, at 34 °C. Two points from that example are easy to miss:
- A printed grille is only about 60 % open, so it needs a larger area than plain slots for the same effect.
- Pressing a thermal pad from the board into the plastic wall looks like an easy fix, but it would heat that spot of the wall to about 98 °C, far too hot for PETG.
Run a heat check early, while the box size is still open: in the same example, a box 25 % bigger in each direction ran about 10 °C cooler, and small feet under it about 5 °C cooler. Our free enclosure heat-rise calculator does this in a minute.

Openings reduce protection against dust and water. For a device used somewhere dusty or wet, add a mesh or a hood over the vents, or use a sealed design with a membrane vent (section 5).
4. Cable entry and strain relief
A cable that is pulled, even once, should load the enclosure, not the connector or the solder joints on the board. Three simple measures handle this:
- A smooth entry: a rounded hole edge, a grommet or a cable gland, so the cable cannot be cut or worn by the wall.
- Something inside that takes the pull: a cable tie around a printed anchor post, a small clamp, or the gland itself.
- Some slack between that point and the board, so the lid can be opened and the connector unplugged without stretching the cable.
For a wall-mounted or outdoor device, bring the cables in from below, so water running down the cable drips off instead of following it into the box.
5. The lid, sealing and assembly
The lid is closed with screws or with snap-fits. Screws into heat-set inserts are the reliable choice for a lid that is opened for service: the PDL-1 cover is held by M3 × 8 screws in four brass inserts. Snap-fits save the screws but must be sized for the material and the number of openings. In our snap-fit worked example a PETG lid clip went from 219 % to 58 % of its allowable strain in three changes. Check yours with the free snap-fit calculator. A lip around the edge of the lid locates it on the base and closes the gap at the seam.
For wet or dusty places we design for an IP target, with gaskets, seals and pressure-equalising membrane vents. In the PDL-1 a membrane lets the BME280 sensor read true outside air pressure while dust and moisture stay off the board. A rating such as IP65 or IP67 can only be certified by testing at an accredited lab, so we design for it and you have the final product tested.
Finally, plan the assembly order and access: which part goes in first, where the cables run, and how someone reaches the battery, the USB port for programming or the SD card without taking everything apart.
6. Choosing the material
We use PETG for most indoor prototypes, ASA for outdoor parts exposed to the sun, and polycarbonate where more heat resistance is needed. The heat check above tells you which one you need: if the walls will get close to the material's heat deflection temperature, choose the next one up or improve the cooling.
Checklist before you print
- PCB model (STEP) placed in the enclosure, with tall parts and connectors clear of the walls and the lid
- Walls 1.5–2 mm or more, ribs on large flat walls and the lid
- Bosses on the board's own mounting holes, sized for inserts or screws, with a fillet at the base
- Connector openings sized for the plug, with the wall thinned where needed
- Holes in side walls as teardrops or flat tops, or ports on a panel printed flat
- Vents low and high, sized with a heat check, and the wall temperature checked against the material
- Cable entry with a smooth edge or gland, a strain relief inside and some slack
- Lid fixing chosen for how often it is opened; sealing if the device lives outdoors
- Access for the battery, programming and service planned
Want a second pair of eyes on your design? Our electronics enclosure design service starts from your PCB file and ends with a printed prototype you can test, or CAD ready for injection moulding.