Relay Zero Enclosure
Hydroponics controller · OpenSCAD + KiCad

Relay Zero Enclosure

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

  1. Pi into the base. Two M2.5 × 6 screws through the Pi's port-side holes into the short bosses.
  2. 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.
  3. Spacers. Stand the two 11 mm printed spacers on the Pi's header-side holes.
  4. 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.
  5. Ribbon. Push the 40-way IDC socket onto the relay board's pass-through pins and drop the ribbon into the rear notch.
  6. Relay wiring. Feed each load's wires through its front window into the CH1–CH3 terminals and tighten.
  7. 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 measureParameterModel
Pi top surface to relay-board underside, header fully seatedstack_gap11.0
Tallest relay above the relay boardrelay_h15.5
IDC socket top above the relay boardidc_h9.5
Micro-USB plug body (must pass the window)usb_window13 × 9
Micro-USB plug length, port to cable bend—≤ 26
Terminal screw line, from the relay board's front edgeterm_screw_y8.0
Indicator LED positions (lid windows)ledsverify

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
CheckOpenSCADKiCadResult
Hole spacing, long axis58.0058.00PASS
Hole spacing, short axis23.0023.00PASS
Board length65.0065.00PASS
Board width30.0030.00PASS
Hole inset from board edge3.503.50PASS
Header centre line (y)0.000.00PASS
Pin 1 position x53.1353.13PASS
Pin 1 row offset |y|1.271.27PASS
Micro-USB PWR centre x7.507.50PASS
Micro-USB data centre x20.1020.10PASS
Mini-HDMI centre x49.1049.10PASS
Camera connector centre y11.5011.50PASS

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
Image generated by PCBNEW CASE INNER WALL CASE INNER WALL FRONT: relay wire windows + USB power FRONT: relay wire windows + USB power REAR: ribbon cable notch REAR: ribbon cable notch Waveshare RPi Relay Board 65.15 x 56.21 Waveshare RPi Relay Board 65.15 x 56.21 40-way IDC ribbon socket 40-way IDC ribbon socket CH1 CH1 CH2 CH2 CH3 CH3 Raspberry_Pi_Zero_Socketed_THT_FaceDown_MountingHoles Raspberry_Pi_Zero_Socketed_THT_FaceDown_MountingHoles PI1 PI1

Print settings · Bambu P1S, PLA

Layer height0.20 mm, 0.4 mm nozzle
Walls4 loops (case walls are 2.4 mm)
Infill15 % gyroid
SupportsNone. Window tops bridge ≤ 16 mm
BaseOpen side up
LidTop face down (STL is pre-flipped)
Spacers, cable plugAs exported; plug flange down
PlateTextured 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
stl/base.stl · stl/lid.stl · stl/spacer.stl · stl/cable_plug.stl: print-ready, oriented for the bed
kicad/pi_zero_relay_stack.kicad_pcb: reference board · kicad/check_dimensions.py · kicad/make_reference_board.py
viewer/index.html: this page, self-contained