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:
- Board dimensions: Length, width, and thickness of the PCB itself.
- Mounting holes: Center-to-center distance and hole diameter. Most Raspberry Pi and Arduino boards use M2.5 or M3 mounting holes.
- Port locations: Measure the position, width, and height of every USB, HDMI, Ethernet, power, and GPIO port from a consistent reference edge.
- Component heights: Measure the tallest component on both the top and bottom of the board. Capacitors, heatsinks, and headers often stick up more than you expect.
- Cable clearance: Account for the physical size of plugs and cables, not just the port. A USB-C port is small, but the plug and cable need room to bend.
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
- Cantilever length: The flexible arm should be at least 5 times longer than it is thick. Short, thick cantilevers crack instead of flexing.
- Overhang angle: Keep the hook entry angle at 30 to 45 degrees for easy insertion. The retaining angle can be steeper (up to 90 degrees) if you want a permanent connection.
- Wall thickness: The snap arm should be at least 1.5 mm thick for PLA, 2.0 mm for PETG. Thinner arms break during assembly.
- Clearance: Add 0.2 mm of clearance between mating surfaces. FDM printing is less precise than injection molding, so tighter fits risk not assembling at all.
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
- Layer height: 0.2 mm for functional parts, 0.12 mm for visible surfaces.
- Walls: At least 3 perimeters (1.2 mm with a 0.4 mm nozzle). More walls mean stronger screw bosses and snap fits.
- Infill: 20 to 30 percent for general enclosures. Increase to 50 percent around screw bosses and mounting points.
- Orientation: Print the enclosure with the opening facing up. This avoids supports inside the case and gives the best surface finish on the exterior walls.
- Supports: Use supports only for overhangs greater than 55 degrees. Well-designed enclosures should minimize the need for supports.
Step 7: CAD Software for Enclosure Design
For enclosure design, parametric CAD tools are strongly preferred because you will iterate on dimensions repeatedly.
- Fusion 360: The most popular choice for hobbyist enclosure design. Free for personal use and has excellent tools for parametric modeling, fillets, and shell operations.
- OnShape: Runs entirely in the browser. Great for collaboration and version control. Free tier available.
- FreeCAD: Fully open-source. The Part Design workbench handles enclosure design well, though the learning curve is steeper.
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.
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 →