Design a 3D-printed case that fits your board the first time
Measure the board, choose clearance and wall thickness, work out the case size step by step, plan screw holes, USB cut-outs and vents, and pick PLA, PETG or ABS.
- FDM prints do not match the model exactly. Outside edges tend to grow a little and holes tend to shrink.
- Leave about 0.3–0.5 mm per side around the board, and print a small test piece before the full case.
- Make walls a whole number of extrusion widths, such as 1.6 or 2.0 mm for a 0.4 mm nozzle.
- PLA softens at about 55–60 °C, so it is a poor choice for hot places such as a car in the sun.
The board works and the sensor reads. The next step is turning it into a device that sits on a desk without wires dangling everywhere. A 3D-printed case is the answer, but many people’s first case either will not take the board or is so loose the board rattles. This is how to design one that fits the first time.
The numbers here assume an FDM printer (the kind that extrudes plastic filament) with a 0.4 mm nozzle and 0.2 mm layers, the most common starting setup.
Why prints do not match the model
An FDM printer lays down a line of plastic that is pressed flat, so it spreads a little sideways. As a result:
- Outside edges of a part tend to come out slightly larger than the model.
- Holes and inner pockets tend to come out smaller, because the line bulges into them.
- Holes in an STL file are polygons, not true circles, so they lose a little more.
Errors of 0.1–0.3 mm are common, and they vary with the printer, the material and the settings. No single number works for every machine.
Do not guess how far off your printer is. Print a small test piece and measure it. It takes minutes and saves hours of failed cases.
Step 1: measure the real thing
Measure the actual board with calipers. Do not trust sizes from the web: boards with the same name from different makers can differ by several millimetres. Measure:
- The width, length and thickness of the board.
- The height of the tallest part on top, and how far pins stick out underneath.
- Where the USB socket is: from the board edge to the socket’s centre.
- The mounting holes, if any. Some boards have none, and need a ledge for the board edge or clips instead.
Step 2: choose the clearance
These are starting points per side for a 0.4 mm nozzle. Adjust them from your test piece.
| The fit you want | Clearance per side |
|---|---|
| Press fit, must be pushed in | 0.0–0.1 mm |
| Snug, slides in | 0.2 mm |
| Loose, drops in | 0.3–0.5 mm |
For a board case, choose loose: the board drops in without force, and screws, a ledge or the lid hold it. Forcing a board into a tight pocket risks bending it.
Step 3: work out the case size
Say the board measures 51.5 × 28.4 mm, with 0.5 mm clearance per side and 2.0 mm walls.
- Inside = 51.5 + 0.5 + 0.5 = 52.5 mm, and 28.4 + 0.5 + 0.5 = 29.4 mm
- Outside = 52.5 + 2.0 + 2.0 = 56.5 mm, and 29.4 + 2.0 + 2.0 = 33.4 mm
Height stacks up from the bottom:
| Part | Height |
|---|---|
| Floor | 2.0 mm |
| Standoffs (room for pins under the board) | 5.0 mm |
| Board | 1.6 mm |
| Tallest part on the board | 8.0 mm |
| Space under the lid | 2.0 mm |
| Total outside height (without lid) | 18.6 mm |
These are example values; use the ones you measured from your own board.
Why 2.0 mm walls: a 0.4 mm nozzle prints lines about 0.4–0.45 mm wide. A wall that is a whole number of lines, such as 1.6 mm (4 lines) or 2.0 mm, prints solid with no gap in the middle.
Make it a model you can change
This OpenSCAD code builds an open-top case from your measurements. Measure a new board and you only change the first line.
// measured sizes (mm)
board = [51.5, 28.4];
clear = 0.5; // clearance per side
wall = 2.0;
floor_t = 2.0;
height = 18.6; // outside height
inner = board + [2 * clear, 2 * clear];
outer = inner + [2 * wall, 2 * wall];
difference() {
cube([outer[0], outer[1], height]);
translate([wall, wall, floor_t])
cube([inner[0], inner[1], height]);
}
There are browser-based parametric tools too, such as Forge, made by the owner of this site.
Screw holes, the USB cut-out and vents
- An M3 screw driven straight into plastic wants a hole of about 2.5–2.8 mm, so the thread cuts into the plastic. If the case will be opened often, use heat-set inserts (brass inserts pressed in with a soldering iron), with the hole size the insert maker specifies.
- The USB cut-out: the cable’s plug has a plastic shell bigger than the socket on the board. Measure the plug you actually use and leave at least 1 mm around it.
- A vent for the sensor: as the previous article showed, a BME280 close to an ESP32 reads too warm. Give the sensor its own small pocket with side vents, and put a wall between it and the board.
Placing the part on the bed
Print the case open side up with the floor on the bed, so the walls rise straight with no supports. Print the lid separately, flat side down. Overhangs up to 45 degrees from vertical print without support. A hole in a side wall sags a little at the top; make it a teardrop shape or ream it afterwards.
Choosing a material
| Material | Softens around | Good for | Worth knowing |
|---|---|---|---|
| PLA | 55–60 °C | Indoors, air-conditioned rooms | Easiest to print, but warps with heat |
| PETG | about 80 °C | Near a window, moderate heat | Tougher than PLA, some stringing |
| ABS / ASA | about 100 °C | Hot places, outdoors (ASA) | Shrinks a lot; print in an enclosure, with ventilation |
These are approximate and vary by brand; check the datasheet of your filament.
Safety
- The nozzle runs at about 190–260 °C and the bed at 60–100 °C depending on the material. Do not touch them while printing or just after.
- Keep the printer in a ventilated space. ABS and ASA give off fumes you should not breathe.
- Do not leave the printer alone during the first layers, and keep flammable things away from it.
Common mistakes
- Using board sizes from the internet instead of measuring.
- No clearance at all, a pocket exactly the board’s size: it will not go in.
- Forgetting the pins under the board, so it does not sit flat.
- A USB cut-out the size of the socket, which the real plug will not fit through.
That completes the three: an LED wired correctly, a sensor that reads, and a case that fits. From here, the next step is bringing them together into one device.
FAQ
Which design software should I use?
Anything where sizes are numbers you can change (parametric), such as OpenSCAD, FreeCAD or Fusion. Measure a new board, change one number, and the whole case follows.
Why do my printed screw holes come out smaller than designed?
The squashed plastic bulges into the hole, and the hole in an STL file is a polygon slightly smaller than a true circle. Design holes about 0.2–0.3 mm larger, or ream them with a drill bit after printing.
Do I need supports?
Usually not, if you print the case open side up and the lid separately. Consider supports for overhangs past 45 degrees from vertical or for very long bridges.
Circuits and code were tested on sample boards. Boards differ in pin layout, so check your board's pinout before you power anything.