Raspberry Pi 5 Case 3D Print: Design It, Calibrate It, Adapt It
A case for the Raspberry Pi 5 costs between 13 and 60 euros in a shop. Printed yourself it costs around 40 grams of filament – less than a euro – and it fits exactly the way you need it to. In this article I show you how to design your own case, which five decisions actually determine whether it fits, and which print settings turn a wobbly box into a clean enclosure. At the end you get our model to download – not as a rigid STL, but as a parametric source you can adapt to your board and your HAT.
What this is – and what it isn’t. This is not a finished product, it’s a workshop report. The case was created together with an AI: the dimensions come from the official Raspberry Pi reference model, the design is parametric OpenSCAD code written by Claude – and I printed, measured and said what didn’t fit. Version 1.4 couldn’t even be assembled. What you get here is honestly the result of several iterations on my desk, not the output of an engineering department. Reprints, criticism and improvements are explicitly welcome – the source is included.
Buy or build your own?
Let’s start honestly: if all you care about is cooling, buy an aluminium case. Metal dissipates heat far better than any plastic you can print at home. Which models are worth it is covered in our comparison of the best Raspberry Pi 5 cases.
Printing your own pays off for other reasons:
- A special fit: a Pi with a HAT stack, a hole for one particular cable, a wall mount – you often can’t buy that.
- Repair: snapped a latch? Print a new one instead of buying a new case.
- Cost: our set of tub and lid weighs 39.5 grams. At around 20 euros per kilo that’s about 80 cents.
- And because you learn something. A case is a perfect first CAD project: small enough to finish, but with real tolerances.
Where the real dimensions come from – derive them, don’t guess
The most common mistake when building a case is reading a few numbers off a drawing and estimating the rest. That fails because the numbers that matter – where exactly each connector sits and how far it sticks out – aren’t in any dimensional drawing. The official Raspberry Pi mechanical drawing even says itself that it must not be used to produce production data.
There is, however, an official 3D reference model of the Pi 5 (file reference RP-004882-DD, created in SolidWorks). With it, every connector position can be derived exactly. Two pitfalls on the way there:
- OpenSCAD cannot import STEP. You need an intermediate step. I used
gmsh(pip install gmsh): it loads the assembly and returns the bounding box of every individual solid. - Don’t read the coordinates straight out of the STEP file. It’s an assembly with local coordinate systems. Read the points naively and you’ll get height figures of 140 millimetres for a board that is 1.4 mm thick. The library has to resolve the transformations.
The result is this table. All values in millimetres, referenced to the board corner, with z = 0 being the top face of the PCB:
| Connector | Wall | from | to | z bottom | z top |
|---|---|---|---|---|---|
| 4 × USB (both stacks) | x = 85 | 22.30 | 54.66 | −3.50 | 16.78 |
| Ethernet | x = 85 | 2.25 | 18.15 | −2.05 | 13.70 |
| USB-C (power) | y = 0 | 6.73 | 15.67 | −0.80 | 3.16 |
| micro-HDMI 0 | y = 0 | 22.55 | 29.05 | −0.55 | 2.97 |
| micro-HDMI 1 | y = 0 | 35.95 | 42.45 | −0.55 | 2.97 |
| microSD | x = 0 | 22.00 | 33.95 | −3.05 | −1.60 |
Two of those numbers matter more than all the others: the two USB stacks are only 2.8 mm apart, and the USB connectors reach 16.78 mm above the top face of the board plus 3.5 mm below it. Both come back shortly.
One legal note: the reference model belongs to Raspberry Pi. You may use the dimensions – dimensions are facts – but don’t ship the STEP file in your own release package.
The five decisions that actually determine the fit
1. The interior follows the connectors, not the board
This is the mistake that killed our versions 1.0 through 1.5. The board measures 85 × 56 mm – design the interior around that and you get a case the Pi cannot be inserted into at all. The connectors overhang the board edge: USB by 3.9 mm, Ethernet by 3.0 mm, USB-C by 1.2 mm. Lower the board in vertically and they hit the wall above the openings.
So the interior has to accommodate the envelope of board plus connector overhang. For us that is 94.5 × 62.8 mm on the outside instead of the original 90.6 × 61.6 mm. And that is exactly why commercial Pi 5 cases measure roughly 96 × 65 mm – I checked it against third-party STL files: 96.6 × 65.0 mm.
2. One continuous port opening instead of bridges
Many cases separate the port openings with thin bridges. It looks tidy, but there are two catches. First, there are only 2.8 mm between the two USB stacks – subtract tolerance and no bridge remains that would carry any load. Second, that is exactly where you run out of room if you later add an NVMe HAT.
So we built one shared opening for all four USB ports. Between USB and Ethernet there is just under 3 mm – that does carry, so there is a bridge.
3. Centring pins instead of screws
On the four mounting bosses we put a 2.4 mm chamfered pin that engages the mounting hole in the board. That holds the Pi in place and stops it shifting – without a single screw. It’s pleasant during assembly and a real selling point on the model platforms.
If you’d rather use screws, the pilot hole in the plastic is 2.1 to 2.3 mm, not 2.7. The 2.7 mm is the hole in the board. Drill it that size in the case and the thread of an M2.5 self-tapping screw will strip.
4. The build height is decided by the cooler
The official Active Cooler stands 13.7 mm above the top face of the board. Add an M.2 HAT+ and it sits on the supplied 16 mm spacers – which exist precisely so the cooler fits underneath. On top of that come another 1.4 mm of HAT board and roughly 3 mm for the socket and SSD.
That gives two variants:

| Variant A (cooler only) | Variant B (with M.2 HAT+) | |
|---|---|---|
| Interior height above floor | 19.6 mm | 26.3 mm |
| Total height with lid | 23.6 mm | 30.3 mm |
| Outer footprint | 94.5 × 62.8 mm | 94.5 × 62.8 mm |
If you’re considering NVMe on the Pi 5: which HATs and SSDs actually work is covered in our NVMe buying guide for the Pi 5.
5. Ventilation – generous, but honest
The lid has a honeycomb field above the fan, the floor has longitudinal slots, and the closed GPIO wall carries honeycombs too. The hexagons are 5 mm across flats with 1.8 mm webs – fine enough that nothing falls in, coarse enough to still print cleanly.
What I am not claiming: I have not measured the cooling performance. The vent areas are designed, not proven. If you need maximum cooling, aluminium is the better answer – see above.
What went wrong for us – four versions until it fitted
This section is the most honest part of the article, and probably the most useful. An engineering department would leave it out.
| Version | The mistake | What you take away |
|---|---|---|
| v1.2 | Two axes were swapped when converting the reference dimensions. That isn’t a rotation, it’s a mirror – the case would only have fitted an upside-down Pi. | Always anchor axis direction to an asymmetric feature and check the top view against it. |
| v1.4 | The first printed prototype could not be populated. Interior calculated from the board instead of the connector envelope. | See decision 1. Two hours of print time for nothing. |
| v1.5 | The cutting bodies for the openings were built from nested rotations, and width and height got swapped in the process. The openings for USB and Ethernet wandered out of the wall. | Render the walls individually after every change to the cutting geometry. A check for “one closed solid” says nothing about where the holes are. |
| v2.0 | – | Interior sized to the connector envelope. It has fitted ever since. |

On top of that came printer reality: on 13 and 14 August I produced roughly 15 failed attempts, including one genuine firmware crash. The lesson is unspectacular but it saves your nerves: after a run of failures, don’t restart six times back to back. Wash the build plate with dish soap, restart the printer, re-level the bed – and then try once.
Calibrate first, then print
A complete set takes close to two hours. That’s far too long to experiment with tolerances. So the model includes a calibration piece: the real case corner where the USB edge meets the HDMI edge – in other words the most expensive cutouts – plus one mounting boss and a lettering sample. Print time: 29 minutes.

Take the piece and hold it against your actual Pi. Four questions, four parameters:
| Check this | If it binds, adjust |
|---|---|
| Does the board slide over the centring pins without binding? | zapfen_d, in 0.1 mm steps |
| Do USB and HDMI plugs go in without force? | port_spiel (default 0.5) |
| Does the board rest on the bosses without components fouling underneath? | unter_pcb (default 3.0) |
| Is the lettering legible or filled in? | schrift_groesse, schrift_tief |
Only once the corner piece fits do you print the tub and lid. That can easily save you three failed prints.
Print settings for clean fits
The geometry is only half the job. Whether a case fits is decided just as much in the slicer. I ran these values on an Elegoo Neptune 4 Plus, but they transfer to any FDM printer.
The basics
- Layer height 0.16 or 0.2 mm with a 0.4 mm nozzle. Finer does not look better on a boxy part – you only see layer height on slopes and curves. For the honeycomb field in the lid 0.12 mm is worth it anyway, more on that in a moment.
- 3 perimeters. The lid rebate is only 1.2 mm thick; with two wall lines it goes soft.
- 20 % infill, 4 bottom and top layers.
- No supports needed. The model is laid out so every overhang is self-supporting.
- Brim on – 5 mm. The tub has little floor area and otherwise likes to lift at a corner.
The real fit killer: elephant’s foot
The first layer gets slightly squashed by the hot bed. So the part is a few tenths wider at the bottom than in CAD – and that is exactly what makes lids bind and stops boards dropping between the bosses. Almost every slicer has elephant foot compensation. Start at 0.1 to 0.2 mm. If your calibration piece is visibly flared at the base, this is the setting to change.
Fine honeycombs are the stress test for your profile
I deliberately printed our lid once with a coarse profile – the way you probably print it on your first attempt. You can see the result on the left in the picture below: several honeycombs have closed up, the edge of the field is ragged, one cell holds a blob, and strings are drawn over the floor slots.
That’s not the model, that’s speed. On the short bridges between the honeycombs the nozzle moves across too quickly and the layer has no time to cool before the next one arrives. Three adjustments help:
- Outer wall much slower: 60 mm/s instead of the usual 160, and outer wall acceleration down to 2000 from 2500.
- Enable precise wall (called “Exakte Wand” in the German ElegooSlicer – it is off in the stock profile).
- Check the cooling: the Elegoo profile already ships 60 to 80 per cent fan and a six second minimum layer time – if your slicer specifies less, turn it up here.
A finer layer came on top of that: the second lid ran at 0.12 mm. Thinner layers put down less material per honeycomb bridge and have cooled off before the next one arrives. You pay for it in time: 48 minutes instead of 37 for the same lid. Which of those values contributed how much I cannot cleanly separate – I changed wall speed and layer height together. The only certain part is the result, on the right in the picture. The tub does not need any of this, 0.16 mm is fine there.

Two small things for looks
The seam position is already set to “aligned” in the Elegoo profile; for the lid I moved it to “rear”, so the seam collects on the back edge instead of wandering across the visible face. And print the lid upside down, top face on the bed. The embossing then sits against the smooth build plate and comes out noticeably crisper.
For deburring and cleaning off support remnants, a post-processing tool kit* is handy – side cutters, a deburring tool and tweezers are all you really need.
Which filament?
Short answer: PLA is fine for almost every case. A Pi 5 with the Active Cooler doesn’t get hot enough inside the enclosure to soften PLA – the heat leaves upwards through the cooler, not into the case wall.
I would reach for PETG if the Pi runs at full load permanently, sits in a closed cabinet, or the case stands in direct sunlight – in a car or on a windowsill. PETG takes considerably more heat but is fussier to print. ABS or ASA I’d skip: on an open printer without an enclosure, a part this size will warp reliably.
Which material suits which job is covered in detail in our filament guide.
Assembly
Assembly takes a minute and needs no tools:
- Peel the brim off the tub and run a deburring tool over the seating surfaces.
- Insert the Pi at an angle: guide the port side into the openings first, then lower the other side. Don’t push it straight down – the sockets sit behind the wall.
- Press the board onto the four centring pins until it sits flat.
- Put the lid on and press it into the rebate until the latches click.
One note from practice: the lid is tight the first time. That’s intentional – after opening and closing it two or three times it beds in. If it won’t close at all, elephant’s foot is almost always the culprit.
Adapting it: the model is a generator
And now the part that sets this case apart from an ordinary download: you don’t just get a finished STL, you get the parametric source. Open the file in OpenSCAD, unfold the customizer, and you can put together your own case without writing a line of code.

The most important knobs:
| Parameter | What it does |
|---|---|
part | What gets rendered: wanne (tub), deckel (lid), kalibrierung, portlehre or vorschau |
variante | A for Active Cooler only, B with M.2 HAT+ |
hat_spacer | Spacer height of your HAT. Different HAT? Enter it here and the case height recalculates. |
port_spiel | Clearance around the socket openings (default 0.5 mm) |
dom_typ | zapfen for screwless, schraube for bosses with a pilot hole |
fpc_schlitze | Open the slots for camera and display cables (off by default) |
wabe_schl, wabe_steg | Size and web width of the ventilation honeycombs |
radius_aussen | Corner radius – purely cosmetic |
That, incidentally, is also why I could show you the old design mistake above: because the model is parametric, I don’t have to hunt for the mistake – I set two numbers back and render it again. That’s exactly what parametric CAD is for.
Download
Here is the complete package, version 2.0, around 660 KB:
👉 Download raspberry-tips-pi5-case-v2.0.zip
- STL/ – tub, lid, calibration piece and a port gauge for checking the socket dimensions
- 3MF/ – tub and lid with the print profile embedded. It is set to 0.12 mm; if you want it faster, switch to 0.16 mm in the slicer – that is what the times and weights in this article refer to.
- OpenSCAD/ –
rpi5_case.scad, the parametric source, plus the ghost model of the Pi 5 for visual checks - README.txt – licence, attribution line, print settings and the calibration checklist
No STEP, and that’s deliberate: OpenSCAD cannot export STEP. The .scad file is the better remix source anyway – there you change a number instead of re-modelling a face.
The model is licensed under CC BY 4.0. You may modify it, share it and use it commercially – you only have to credit the source. Ready-made line for your remixes:
Case for Raspberry Pi 5 by raspberry.tips, CC BY 4.0
https://raspberry.tips/en/3d-druck/raspberry-pi-5-case-3d-print
And the usual caveat: a case encloses a heat source. I have not measured the cooling performance and give no guarantee for continuous operation. Use at your own risk – and don’t leave a Pi running unattended in a case you have modified yourself without watching the temperatures first.
Frequently asked questions
No. On the Pi 5, USB and Ethernet have swapped places, and there’s a power button plus changed connectors. A Pi 4 case cannot be populated. That’s annoying because many of the most popular case models online still date from the Pi 4 era – I learned it the expensive way and put over an hour of print time into a case that didn’t fit. Before you print, check which generation a model is meant for.
For sustained load, yes. Plastic barely conducts heat, so the case doesn’t help with cooling – it just must not trap the heat. With the official Active Cooler plus vents in the lid and floor you’re on the safe side. Without active cooling a Pi 5 will throttle under full load even in the open.
PLA is fine for almost every case and is the easiest to print. PETG is worth it if the Pi runs under load permanently, sits in a closed cabinet, or the case stands in direct sunlight. I would not attempt ABS or ASA on an open printer without an enclosure – a part this size warps too easily.
Our set of tub and lid weighs 39.5 grams – 26.2 g for the tub and 13.3 g for the lid, printed at 0.16 mm layer height with 20 % infill. At typical filament prices that is less than a euro. A 1 kg spool is therefore good for roughly 25 cases.
In the standard variant, none – the board sits on centring pins and the lid clicks into place. If you prefer screws, set the parameter dom_typ to schraube and use M2.5 self-tapping screws. Important: the pilot hole in the plastic is 2.1 to 2.3 mm, not 2.7 – that is the hole in the board.
For printing alone the STL or 3MF file is entirely sufficient. You only need OpenSCAD if you want to change something – the build height for a different HAT, the tolerance at the port openings, or your own lettering on the lid. The software is free, and thanks to the customizer you don’t have to write any code.
First check which side of the build plate is facing up. If it is coated on both sides, the material you are printing has to appear on the label of the side facing up. Only then wash the plate, re-level and add a brim.
Yes. The model is licensed under CC BY 4.0 and commercial use is explicitly allowed. You only need to credit raspberry.tips as the source. Do mind the Raspberry Pi trademark rules though: call your product “case for Raspberry Pi 5”, not “Raspberry Pi 5 case” – and don’t use a raspberry logo.
Over to you
This case is explicitly not a finished product, it’s a snapshot. If you reprint it and something binds, put it in the comments – ideally with your printer and your filament. And if you build a better version: the licence allows it, and I’d be glad to see any remix.
If you’ve got a taste for it, the case for the Arduino UNO Q is a second model built on the same principles – and how to get your printer into Home Assistant is covered in connecting a 3D printer to Home Assistant. Happy printing!






