| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- // Waveshare e-Paper FPC Adapter — parametric mockup
- //
- // Coordinate system:
- // Origin at PCB Z- face, lower-left corner (X=0, Y=0, Z=0).
- // X: board long axis (width)
- // Y: board short axis (height)
- // Z: 0 = bottom face (Z-); PCB_T = top face (Z+, component side)
- //
- // Two FPC connectors sit on the Z+ face:
- // Connector A (Y+): FPC exits in +Y direction
- // Connector B (Y-): FPC exits in -Y direction
- //
- // Mounting bosses hang from the Z- face (z=0, downward in -Z).
- // Stud pins extend upward from z=0 through the PCB locating holes.
- // When the board is flipped for ceiling-mount (rotate([0,180,0])):
- // bosses point toward the ceiling, stud tips snap down through the PCB.
- //
- // fpc_adapter() always produces boss geometry.
- // PCB / connector / FPC visuals are shown only in $preview.
- // ── PCB ────────────────────────────────────────────────────────────────
- PCB_W = 32.0;
- PCB_H = 18.0;
- PCB_T = 1.6; // standard; measured ~1.72
- PCB_R = 3.0; // corner radius
- // ── Mounting holes ─────────────────────────────────────────────────────
- HOLE_D = 3.0;
- HOLE_MX = 3.75; // hole center from nearest X edge (2.25 clearance + 1.5 radius)
- HOLE_MY = 3.75; // hole center from nearest Y edge
- // ── FPC connectors (simple box approximation) ──────────────────────────
- CON_W = 15.5; // connector width along X
- CON_D = 5.85; // connector depth along Y
- CON_H = 2.05; // connector height above Z+ face (total stack 3.65 − PCB_T)
- CON_CX = PCB_W / 2;
- CON_A_Y1 = PCB_H - CON_D; // Connector A inner face (Y+ side)
- CON_B_Y0 = 0; // Connector B outer face (Y- side)
- // ── FPC cable (simple flat box) ────────────────────────────────────────
- FPC_W = 12.5;
- FPC_T = 0.3;
- // Default stub lengths. 0 = no cable; >0 = stub that many mm.
- FPC_YP = 20;
- FPC_YN = 0;
- // ── Mounting bosses ────────────────────────────────────────────────────
- BOSS_D = 6.0; // boss outer diameter
- BOSS_H = 2.0; // boss standoff height (extends below Z- face)
- SCREW_D = 3.2; // retained for reference; drives nothing (see SCREW_PILOT_D)
- SCREW_PILOT_D = 1.7; // M2 self-tapper pilot, SLA resin
- STUD_R = 1.5; // locating stud radius
- STUD_H = PCB_T + 1.0; // stud height: pierces PCB with 1 mm snap-through
- // ═══════════════════════════════════════════════════════════════════════
- // Private helpers
- // ═══════════════════════════════════════════════════════════════════════
- module _pcb_shape(h) {
- r = PCB_R;
- linear_extrude(h)
- offset(r=r)
- translate([r, r])
- square([PCB_W - 2*r, PCB_H - 2*r]);
- }
- // Boss hangs from Z- face (z=0) downward; stud pin rises through PCB hole.
- // Stud diagonal: (X1,Y1)+(X2,Y2); screw diagonal: (X1,Y2)+(X2,Y1).
- module _adapt_boss(px, py, stud=false) {
- translate([px, py, 0]) {
- translate([0, 0, -BOSS_H])
- difference() {
- cylinder(d=BOSS_D, h=BOSS_H, $fn=24);
- if (!stud)
- translate([0, 0, -0.1])
- cylinder(d=SCREW_PILOT_D, h=BOSS_H + 0.2, $fn=18);
- }
- if (stud) {
- cylinder(r=STUD_R, h=STUD_H, $fn=24);
- translate([0, 0, STUD_H])
- sphere(r=STUD_R, $fn=24);
- }
- }
- }
- // ═══════════════════════════════════════════════════════════════════════
- // Public module
- // ═══════════════════════════════════════════════════════════════════════
- module fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN) {
- // ── Visual geometry (preview only) ──────────────────────────────────
- if ($preview) {
- color("darkgray", 0.85) {
- difference() {
- _pcb_shape(PCB_T);
- for (xi = [HOLE_MX, PCB_W - HOLE_MX])
- for (yi = [HOLE_MY, PCB_H - HOLE_MY])
- translate([xi, yi, -0.1])
- cylinder(d=HOLE_D, h=PCB_T + 0.2, $fn=24);
- }
- // Connector A (Y+ edge, FPC exits +Y)
- translate([CON_CX - CON_W/2, CON_A_Y1, PCB_T])
- cube([CON_W, CON_D, CON_H]);
- if (fpc_yp > 0)
- translate([CON_CX - FPC_W/2, PCB_H, PCB_T + (CON_H - FPC_T)/2])
- cube([FPC_W, fpc_yp, FPC_T]);
- // Connector B (Y- edge, FPC exits -Y)
- translate([CON_CX - CON_W/2, CON_B_Y0, PCB_T])
- cube([CON_W, CON_D, CON_H]);
- if (fpc_yn > 0)
- translate([CON_CX - FPC_W/2, -fpc_yn, PCB_T + (CON_H - FPC_T)/2])
- cube([FPC_W, fpc_yn, FPC_T]);
- }
- }
- // ── Mounting bosses (always — structural geometry for host part) ─────
- color("#004B49") {
- _adapt_boss(HOLE_MX, HOLE_MY, stud=true);
- _adapt_boss(PCB_W - HOLE_MX, PCB_H - HOLE_MY, stud=true);
- _adapt_boss(HOLE_MX, PCB_H - HOLE_MY, stud=false);
- _adapt_boss(PCB_W - HOLE_MX, HOLE_MY, stud=false);
- }
- }
- // Standalone render
- fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN);
|