// ============================================================ // XIAO ePaper Display Board EE04 — 3D-Printed Case // OpenSCAD parametric model // ============================================================ use /* [Preview] */ SHOW_BOARD = true; SHOW_LID = true; SHOW_BASE = true; EXPLODE = 65; // mm to pull lid out in Y- for inspection (try 40) /* [Board Dimensions — from EE04 STL] */ PCB_L = 80.00; // board length (case_x axis) PCB_W = 41.22; // board width (case_y axis) PCB_T = 1.93; // PCB thickness // Component heights measured from PCB bottom face: COMP_MAX_Z = 7.29; // tallest component (XIAO module) COMP_SIDE_Z = 3.82; // tallest component on +Y wall (buttons, USB-C) /* [Cutout Positions — from STL geometry, PCB-origin-relative] */ // ---- +Y wall: Sliding power switch ---- PWR_CX = 10.3; // PCB-relative case_x centre PWR_W = 5.0; // slot width PWR_H = 2.5; // slot height PWR_CZ = 3.8; // height above PCB bottom // ---- +Y wall: USB-C port ---- USBC_CX = 65.65; USBC_W = 11.5; USBC_H = 4.8; USBC_CZ = 4.4; // ---- +Y wall: 3× user buttons + 1× reset ---- BTN_CX = [48.4, 39.1, 29.8, 20.4]; // PCB-relative case_x centres BTN_D = 4.5; BTN_CZ = 3.7; /* [Case Parameters] */ WALL = 2.0; // wall thickness FLOOR = 2.0; // base floor thickness (thicker for thread engagement) CORNER_R = 2.5; // XY corner fillet radius SCREW_D = 3.2; // M3 tap drill diameter BOSS_D = 6.0; // PCB standoff boss outer diameter BOSS_H = 2.0; // standoff boss height; PCB bottom sits flush on boss top /* [PCB Standoff Positions — relative to PCB origin] */ PCB_BOSS_X1 = 2.5; PCB_BOSS_X2 = PCB_L - 2.5; PCB_BOSS_Y1 = 2.5; PCB_BOSS_Y2 = PCB_W - 2.5; /* [Interior Clearances — PCB edge to interior wall face] */ CLR_XN = 5.0; // X- side CLR_XP = 15.0; // X+ side (JST cable routing) CLR_YN = 15.0; // Y- side (FPC routing; lid inserts from here) CLR_YP = 0.5; // Y+ side (snug against button/USB-C wall) CLR_LID = 5.0; // from tallest component top to lid underside /* [Sliding Lid] */ LID_T = 1.5; // lid ceiling thickness FLANGE_H = 3.0; // Z height of retention flanges (base + lid); drives lid placement and Y- wall step FLANGE_W = FLANGE_H * tan(30); // flange width — 30° from vertical (60° from horizontal), printable without support SLIDE_CLEAR = 0.40; // clearance between flange/rib and groove/channel on all mating faces (0.4 mm suits typical FDM tolerances) /* [Computed] */ PCB_Z = FLOOR + BOSS_H; // Base inner height: floor to lid underside ≈ BASE_H (flange rests on groove floor) BASE_INNER_H = BOSS_H + COMP_MAX_Z + CLR_LID; BASE_H = FLOOR + BASE_INNER_H; PCB_OX = WALL + CLR_XN; PCB_OY = WALL + CLR_YN; CAV_L = CLR_XN + PCB_L + CLR_XP; CAV_W = CLR_YN + PCB_W + CLR_YP; OUT_L = CAV_L + 2*WALL; OUT_W = CAV_W + 2*WALL; LID_H = FLANGE_H + LID_T; LID_Y_LEN = CAV_W; // flange length; lid Y+ end stops against Y+ interior wall // ============================================================ // HELPERS // ============================================================ module rounded_box(l, w, h, r) { hull() for (dx = [r, l-r], dy = [r, w-r]) translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32); } // Standoff boss: solid cylinder with through-hole (hole continues into floor via base diff) module pcb_boss(px, py) { translate([PCB_OX + px, PCB_OY + py, FLOOR]) difference() { cylinder(d=BOSS_D, h=BOSS_H + 0.01, $fn=24); translate([0, 0, -0.1]) cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18); } } // ============================================================ // BASE // ============================================================ module base() { color("#004B49") { difference() { rounded_box(OUT_L, OUT_W, BASE_H, CORNER_R); // Interior cavity (open top) translate([WALL, WALL, FLOOR]) cube([CAV_L, CAV_W, BASE_H]); // ---- Boss screw holes through 50 % of floor ---- for (bx = [PCB_BOSS_X1, PCB_BOSS_X2]) for (by = [PCB_BOSS_Y1, PCB_BOSS_Y2]) translate([PCB_OX + bx, PCB_OY + by, FLOOR * 0.5 - 0.1]) cylinder(d=SCREW_D * 0.7, h=FLOOR * 0.5 + 0.2, $fn=18); // ---- +Y wall cutouts ---- // Sliding power switch slot translate([PCB_OX + PWR_CX - PWR_W/2, OUT_W - WALL - 0.1, PCB_Z + PWR_CZ - PWR_H/2]) cube([PWR_W, WALL + 0.2, PWR_H]); // USB-C slot translate([PCB_OX + USBC_CX - USBC_W/2, OUT_W - WALL - 0.1, PCB_Z + USBC_CZ - USBC_H/2]) cube([USBC_W, WALL + 0.2, USBC_H]); // 4× button holes (3 user + 1 reset) for (bcx = BTN_CX) translate([PCB_OX + bcx, OUT_W + 0.1, PCB_Z + BTN_CZ]) rotate([90, 0, 0]) cylinder(d=BTN_D, h=WALL + 0.3, $fn=32); // ---- Y- wall step for lid flange clearance ---- // Remove the full Y- wall above z=BASE_H-FLANGE_H-SLIDE_CLEAR so the lid // flanges can enter freely from Y-. translate([-0.1, -0.1, BASE_H - FLANGE_H - SLIDE_CLEAR]) cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.1]); } // Standoff bosses (added outside diff so cavity doesn't subtract them) pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y1); pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y1); pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y2); pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y2); } // Lid-retention flanges — right triangles, wide face flush with case top (z=BASE_H), // tip pointing down to (WALL, BASE_H-FLANGE_H). Hypotenuse faces down-into-cavity; // lid flanges slide underneath it for Z retention. color("#2C3863") { hull() { translate([WALL, WALL, BASE_H - 0.01]) cube([FLANGE_W, CAV_W, 0.01]); translate([WALL, WALL, BASE_H - FLANGE_H]) cube([0.01, CAV_W, 0.01]); } hull() { translate([OUT_L - WALL - FLANGE_W, WALL, BASE_H - 0.01]) cube([FLANGE_W, CAV_W, 0.01]); translate([OUT_L - WALL - 0.01, WALL, BASE_H - FLANGE_H]) cube([0.01, CAV_W, 0.01]); } } } // ============================================================ // LID (slide-on; enters from Y- face, closes toward Y+) // Print upside-down (ceiling on build plate). // z=0 = bottom of flanges; z=FLANGE_H = ceiling underside. // Flanges sit inside cavity and ride on base retention flange hypotenuses. // ============================================================ module lid() { // Flanges: right triangles in XZ; hypotenuse at reciprocal angle to base retention flanges. // Wide vertical face at x=WALL+FLANGE_W (inner), tip at bottom-wall-face — same // (-FLANGE_W, -FLANGE_H) hypotenuse slope as base flanges so they mate when lid slides in. color("#2C3863") { // Left (X-) flange hull() { translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, 0, 0]) cube([0.01, LID_Y_LEN, FLANGE_H - SLIDE_CLEAR]); translate([WALL + SLIDE_CLEAR, 0, -0.005]) cube([0.01, LID_Y_LEN, 0.01]); } // Right (X+) flange hull() { translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, 0, 0]) cube([0.01, LID_Y_LEN, FLANGE_H - SLIDE_CLEAR]); translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, 0, -0.005]) cube([0.01, LID_Y_LEN, 0.01]); } // Interior ribs — 2 mm wide, on cavity face of each flange translate([WALL + FLANGE_W - SLIDE_CLEAR, 0, 0]) cube([2.0, LID_Y_LEN, FLANGE_H]); translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR - 2.0, 0, 0]) cube([2.0, LID_Y_LEN, FLANGE_H]); // Y+ stop tabs — two 10 mm tabs at 1/3 and 2/3 of OUT_L, press against Y+ interior wall translate([OUT_L/4 - 5, LID_Y_LEN - 3, FLANGE_H - 3]) cube([10, 3, 3]); translate([3*OUT_L/4 - 5, LID_Y_LEN - 3, FLANGE_H - 3]) cube([10, 3, 3]); } color("#004B49") { // Ceiling plate — matches base footprint (OUT_L × OUT_W) with CORNER_R rounding translate([0, -WALL, FLANGE_H]) rounded_box(OUT_L, OUT_W, LID_T, CORNER_R); // Y- lip — same rounded_box profile clipped to the Y- wall zone so the // lip corners match the base exterior corners intersection() { translate([0, -WALL, -SLIDE_CLEAR]) rounded_box(OUT_L, OUT_W, FLANGE_H + SLIDE_CLEAR, CORNER_R); translate([-0.1, -WALL - 0.1, -SLIDE_CLEAR - 0.1]) cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.2]); } } } // ============================================================ // BOARD PLACEMENT // EE04() XY-normalises the STL (board left/front at origin). // +1.925 corrects for STL native Z (PCB bottom at Z=−1.925) so // the PCB bottom face lands exactly at PCB_Z. // ============================================================ module stl_board() { translate([PCB_OX, PCB_OY, PCB_Z]) EE04(); } // ============================================================ // ASSEMBLY // ============================================================ if (SHOW_BASE) base(); if (SHOW_LID) translate([0, WALL - EXPLODE, BASE_H - FLANGE_H]) lid(); if (SHOW_BOARD) stl_board();