3d printed enclosureraspberry pi casearduino housingelectronics enclosuresnap fit3d printing

How to Design and Print Custom Electronics Enclosures

Every electronics project eventually needs a home. Whether you are building a Raspberry Pi media center, an Arduino-based sensor node, or an ESP32 weather station, a well-designed 3D printed enclosure transforms a tangle of wires and bare PCBs into something that looks and functions like a finished product.

This guide covers the full workflow for designing and printing custom electronics enclosures, from measuring your board to designing snap fits, ventilation, and cable routing.

Why 3D Print Your Own Enclosures

Off-the-shelf enclosures rarely fit custom projects. You end up drilling holes in generic plastic boxes, leaving ugly gaps around ports, or zip-tying boards to surfaces they were never meant for. A 3D printed enclosure solves all of these problems because it is designed around your exact components.

With a basic FDM printer and free CAD software, you can produce enclosures that rival injection-molded cases. The iterative nature of 3D printing means you can test a fit, adjust the design, and reprint in under an hour.

Step 1: Measure Everything

Accurate measurements are the foundation of a good enclosure. Use digital calipers — not a ruler — to measure your PCB and all its components.

What to measure:

According to Formlabs' enclosure design guide, you should add approximately 2.0 mm of clearance all the way around each port opening to allow comfortable cable insertion and accommodate printing tolerances.

Pro tip: Many popular boards have official mechanical drawings available. The Raspberry Pi Foundation publishes detailed dimension files for every Pi model, and Arduino provides DXF files for its boards. Start with these and verify with calipers.

Step 2: Choose Your Enclosure Style

The enclosure style depends on how the device will be used and maintained.

Two-Part Clamshell

The most common approach. A top half and bottom half that connect with screws or snap fits. The PCB mounts to the bottom half, and the top half provides protection and access to controls. This style is easy to design, easy to print, and easy to open for maintenance.

Sliding Lid

A box with rails that accept a sliding top panel. Good for enclosures that need frequent access, like battery compartments or SD card slots. The rails need to be designed with 0.3 mm of clearance to slide smoothly.

Stacking Modular

Multiple layers that stack and connect with alignment pins. Ideal for projects with separate boards (like a Raspberry Pi with a HAT) or projects that might grow over time. Each layer can be reprinted independently.

Wall-Mount with DIN Rail

For industrial or home automation projects, design clips that attach to standard 35 mm DIN rails. This lets you mount your enclosure alongside commercial equipment in electrical panels.

Step 3: Design Snap-Fit Joints

Snap fits allow tool-free assembly and disassembly, which is ideal for enclosures that need occasional access. As explained by Formlabs, snap-fit joints work through elastic deformation — one part has a protruding hook that deflects during assembly and then locks into a corresponding recess on the mating part.

Design Parameters for FDM Printing

Material Matters

PLA snap fits work but are brittle over time. PETG is significantly better for snap-fit enclosures because it has more flex before fracture. If the enclosure will be assembled and disassembled repeatedly, PETG or even TPU living hinges are worth the extra effort.

Step 4: Plan Ventilation

Electronics generate heat, and enclosed heat kills electronics. The Raspberry Pi 5, for example, can throttle its CPU when temperatures exceed 85 degrees Celsius, which happens quickly in an unventilated case.

Passive Ventilation

Add vent holes or slots to the top and sides of the enclosure. Warm air rises, so place exhaust vents at the top and intake vents lower on the sides. A grid of 2 mm wide slots spaced 2 mm apart provides good airflow while keeping out most debris.

Hexagonal patterns look professional and are structurally strong. A hex grid with 5 mm openings and 1.5 mm walls prints cleanly on most FDM printers and provides excellent airflow.

Active Cooling

For high-performance boards, design a mount for a 30 mm or 40 mm fan. The Raspberry Pi Active Cooler uses a 40 mm fan and heatsink combination. Design your enclosure with a cutout that matches the fan's mounting pattern (typically M3 screws at 32 mm spacing for a 40 mm fan).

Heat Sink Clearance

If your board uses a heatsink, measure its height carefully and add at least 2 mm of clearance above it. Heatsinks need airflow over their fins to work, so do not press the enclosure lid directly against the heatsink surface.

Step 5: Add Mounting Features

PCB Standoffs

Design cylindrical standoffs that match your board's mounting holes. For M2.5 screws (common on Raspberry Pi), use a standoff with a 2.5 mm hole and at least 5 mm outer diameter. Height should lift the board 3 to 5 mm above the enclosure floor to allow airflow underneath and clearance for bottom-mounted components.

Heat-Set Inserts

For enclosures that will be assembled and disassembled many times, heat-set threaded inserts provide metal threads that will not strip. These brass inserts are pressed into the plastic with a soldering iron set approximately 10 to 20 degrees Celsius above the filament's printing temperature — around 225 degrees for PLA, 245 degrees for PETG.

Design the receiving hole with a tapered cavity. The insert vendor provides recommended hole dimensions, but a general rule is to make the hole 0.1 to 0.2 mm smaller than the insert's outer diameter. The knurled surface of the insert melts into the surrounding plastic for a strong bond.

As CNC Kitchen recommends, melt the insert 90 percent of the way in with the soldering iron, then press it the final distance with a flat tool and hold it until the plastic cools and solidifies. Ensure you have at least 2 mm of material around and below the insert.

Self-Tapping Screws

For simpler enclosures, design pilot holes for self-tapping screws. A pilot hole diameter of 2.0 mm works well for M2.5 self-tapping screws in PLA. The screw cuts its own threads into the plastic, which is faster than heat-set inserts but wears out after 5 to 10 assembly cycles.

Step 6: Print Settings for Enclosures

Material Selection

| Material | Best For | Notes | |---|---|---| | PLA | Indoor, low-heat projects | Easy to print, stiff, affordable | | PETG | Projects needing flex or durability | Better snap fits, heat resistance to ~80°C | | ABS/ASA | Outdoor or high-heat environments | Heat resistance to ~100°C, UV stable (ASA) | | TPU | Vibration damping, flexible lids | Excellent for gaskets and seals |

Recommended Settings

Step 7: CAD Software for Enclosure Design

For enclosure design, parametric CAD tools are strongly preferred because you will iterate on dimensions repeatedly.

Whichever tool you use, start by creating a sketch of the PCB outline and mounting holes, then build the enclosure around it. Use the "shell" operation to hollow out a solid block to the desired wall thickness — this is faster and more reliable than building walls individually.

Common Mistakes to Avoid

Forgetting cable bend radius. Cables need room to exit the enclosure and bend. A USB cable needs at least 15 mm of clearance beyond the port face.

Ignoring thermal expansion. ABS and PETG enclosures in high-temperature environments will expand slightly. Add 0.1 to 0.2 mm extra clearance if the enclosure will be used near heat sources.

Overcomplicating the first version. Print a rough draft without snap fits or cosmetic details first. Verify the board fits, ports align, and ventilation is adequate before adding finishing touches.

Skipping the test print. Before printing the full enclosure, print just the corner sections to verify snap-fit engagement and screw hole alignment. This saves filament and time.

Finding Enclosure Models and Inspiration

If you want to skip the design phase or find a starting point, search for existing enclosure models on 3DSearch. It aggregates results from Printables, Thingiverse, MakerWorld, and other platforms, so you can find Raspberry Pi cases, Arduino housings, and ESP32 enclosures from a single search bar.

Many community-designed enclosures on Printables and MakerWorld include source CAD files (STEP or Fusion 360 format) that you can modify for your specific project. As highlighted by XDA Developers, some community enclosures are refined enough to look store-bought.

Final Thoughts

A well-designed 3D printed enclosure is the difference between a prototype and a finished product. The key principles are simple: measure accurately, add proper clearance, plan for heat, and choose the right fastening method for your use case. Start simple, iterate quickly, and do not be afraid to reprint.

If you are looking for enclosure models to print or modify, 3DSearch lets you search across all major model platforms at once. Find existing enclosures, download the source files, and customize them for your exact hardware. Happy building.

BG

Written by Basel Ganaim

Founder of 3DSearch. Passionate about making 3D printing accessible to everyone. When not building tools for makers, you can find me tweaking slicer settings or designing functional prints.

Learn more about 3DSearch →

Search for related models on 3DSearch

Find 3D printable models across Printables, Thingiverse, and Cults3D in one search. Get AI-powered slicer settings for your printer.

Search 3DSearch →