A two-part PLA case for a Raspberry Pi Zero with a Waveshare 3-channel RPi Relay Board stacked on top and a 40-way ribbon breakout plugged into it. Relay wires enter through the front, the ribbon leaves through the rear, and the lid has slots over the terminal screws.
Width
76.0mm
Depth
67.0mm
Height
39.9mm
Drag to orbit · scroll or pinch to zoom · hover a part in the schedule
Loading models…
Assembly order
Pi into the base. Two M2.5 × 6 screws through the Pi's port-side holes into the short bosses.
Power lead. Pass the micro-USB plug in through the front window and into the PWR port. Clip the cable plug over the lead and press it into the window.
Spacers. Stand the two 11 mm printed spacers on the Pi's header-side holes.
Relay board. Press it onto the GPIO header. Fit two M2.5 × 18 screws through board, spacers and Pi into the bosses, then two M2.5 × 6 into the tall bosses at the terminal edge.
Ribbon. Push the 40-way IDC socket onto the relay board's pass-through pins and drop the ribbon into the rear notch.
Relay wiring. Feed each load's wires through its front window into the CH1–CH3 terminals and tighten.
Lid. Four M3 × 10 countersunk screws into the corner posts. Re-tighten terminals later through the lid slots.
Measure before printing
These are the numbers the case depends on. Each is a named parameter at the top of pi_zero_relay_case.scad.
What to measure
Parameter
Model
Pi top surface to relay-board underside, header fully seated
stack_gap
11.0
Tallest relay above the relay board
relay_h
15.5
IDC socket top above the relay board
idc_h
9.5
Micro-USB plug body (must pass the window)
usb_window
13 × 9
Micro-USB plug length, port to cable bend
—
≤ 26
Terminal screw line, from the relay board's front edge
term_screw_y
8.0
Indicator LED positions (lid windows)
leds
verify
KiCad dimension check
Run by kicad/check_dimensions.py against KiCad's official footprint Module:Raspberry_Pi_Zero_Socketed_THT_FaceDown_MountingHoles. Positions are in the case frame: x along the long edge from the camera-end hole, y across from the header-side hole line. Tolerance ±0.05 mm.
12 of 12 checks pass
Check
OpenSCAD
KiCad
Result
Hole spacing, long axis
58.00
58.00
PASS
Hole spacing, short axis
23.00
23.00
PASS
Board length
65.00
65.00
PASS
Board width
30.00
30.00
PASS
Hole inset from board edge
3.50
3.50
PASS
Header centre line (y)
0.00
0.00
PASS
Pin 1 position x
53.13
53.13
PASS
Pin 1 row offset |y|
1.27
1.27
PASS
Micro-USB PWR centre x
7.50
7.50
PASS
Micro-USB data centre x
20.10
20.10
PASS
Mini-HDMI centre x
49.10
49.10
PASS
Camera connector centre y
11.50
11.50
PASS
The KiCad footprint has no micro-SD or relay-board data. The relay board's 65.15 × 56.21 mm outline and 58 × 49 mm hole pattern come from Waveshare's dimension drawing.
Reference drawing
Plotted by kicad-cli from kicad/pi_zero_relay_stack.kicad_pcb. Open that file in KiCad's PCB Editor and use the measure tool: the drill/place origin is the case origin, so readings match the .scad numbers. Front (relay terminals) is at the top of the drawing.
Edge.Cuts: case outer wallCmts.User: inner wallDwgs.User: relay boardEco1.User: relays, terminals, LEDs, IDCB.Fab: Pi Zero footprint
Print settings · Bambu P1S, PLA
Layer height
0.20 mm, 0.4 mm nozzle
Walls
4 loops (case walls are 2.4 mm)
Infill
15 % gyroid
Supports
None. Window tops bridge ≤ 16 mm
Base
Open side up
Lid
Top face down (STL is pre-flipped)
Spacers, cable plug
As exported; plug flange down
Plate
Textured PEI, 55 °C bed
Hardware
2× M2.5 × 18 pan head: relay board + spacers + Pi, header side
4× M2.5 × 6 pan head: Pi port side, relay board terminal side
4× M3 × 10 countersunk: lid
2× M4 screws for the mounting ears (optional)
40-way IDC ribbon breakout, micro-USB power lead
All screws self-tap into printed pilot holes (2.2 mm for M2.5, 2.6 mm for M3).
The relays are rated for 250 V AC. If they switch mains, isolate the supply before opening the lid or using the screw slots, and consider PETG or ASA instead of PLA in a warm, humid grow space.
Files
Everything is in the project folder next to this page. Rebuild with the commands in the README after changing a parameter.
pi_zero_relay_case.scad: parametric model, set part to base, lid, spacer, cable_plug, print_plate, assembly or kicad_check