fpc_adapter.scad 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Waveshare e-Paper FPC Adapter — parametric mockup
  2. //
  3. // Coordinate system:
  4. // Origin at PCB Z- face, lower-left corner (X=0, Y=0, Z=0).
  5. // X: board long axis (width)
  6. // Y: board short axis (height)
  7. // Z: 0 = bottom face (Z-); PCB_T = top face (Z+, component side)
  8. //
  9. // Two FPC connectors sit on the Z+ face:
  10. // Connector A (Y+): FPC exits in +Y direction
  11. // Connector B (Y-): FPC exits in -Y direction
  12. //
  13. // fpc_len_a / fpc_len_b control how much cable to show beyond each connector.
  14. // Set either to 0 to show an empty (no-cable) connector.
  15. // ── PCB ────────────────────────────────────────────────────────────────
  16. PCB_W = 32.0; // board width (X)
  17. PCB_H = 18.0; // board height (Y)
  18. PCB_T = 1.6; // board thickness (standard; measured ~1.72)
  19. PCB_R = 3.0; // corner radius ← replace with measured value
  20. // ── Mounting holes ─────────────────────────────────────────────────────
  21. HOLE_D = 3.0; // hole diameter
  22. HOLE_MX = 3.75; // hole center X from nearest X edge (2.25 clearance + 1.5 radius)
  23. HOLE_MY = 3.75; // hole center Y from nearest Y edge (2.25 clearance + 1.5 radius)
  24. // ── FPC connectors (simple box approximation) ──────────────────────────
  25. CON_W = 15.5; // connector width along X
  26. CON_D = 5.85; // connector depth along Y
  27. CON_H = 2.05; // connector height above Z+ face (total stack 3.65 - PCB_T)
  28. CON_T = 0.5; // connector wall / overhang ← replace
  29. // X centre of both connectors (assumed centred on board)
  30. CON_CX = PCB_W / 2;
  31. // Y edge positions of the connector body
  32. // Connector A sits at Y+ edge; connector B sits at Y- edge.
  33. CON_A_Y1 = PCB_H - CON_D; // inner face (toward board centre)
  34. CON_B_Y0 = 0; // outer face (at Y=0 edge)
  35. // ── FPC cable (simple flat box) ────────────────────────────────────────
  36. FPC_W = 12.5; // cable width along X
  37. FPC_T = 0.3; // cable thickness ← replace with measured value
  38. // FPC stub length at each connector. 0 = no cable shown; >0 = stub that many mm.
  39. FPC_YP = 20; // cable length beyond Y+ connector
  40. FPC_YN = 0; // cable length beyond Y- connector
  41. // ═══════════════════════════════════════════════════════════════════════
  42. // Modules
  43. // ═══════════════════════════════════════════════════════════════════════
  44. module _pcb_shape(h) {
  45. r = PCB_R;
  46. linear_extrude(h)
  47. offset(r=r)
  48. translate([r, r])
  49. square([PCB_W - 2*r, PCB_H - 2*r]);
  50. }
  51. module fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN) {
  52. // ── PCB body ──────────────────────────────────────────────────────
  53. color("#1a7abf", 0.85)
  54. difference() {
  55. _pcb_shape(PCB_T);
  56. // Mounting holes
  57. for (xi = [HOLE_MX, PCB_W - HOLE_MX])
  58. for (yi = [HOLE_MY, PCB_H - HOLE_MY])
  59. translate([xi, yi, -0.1])
  60. cylinder(d=HOLE_D, h=PCB_T + 0.2, $fn=24);
  61. }
  62. // ── Connector A (Y+ edge, FPC exits +Y) ──────────────────────────
  63. color("#d0d0d0")
  64. translate([CON_CX - CON_W/2, CON_A_Y1, PCB_T])
  65. cube([CON_W, CON_D, CON_H]);
  66. // FPC stub out of connector A
  67. if (fpc_yp > 0)
  68. color("#e8e8e8")
  69. translate([CON_CX - FPC_W/2, PCB_H, PCB_T + (CON_H - FPC_T)/2])
  70. cube([FPC_W, fpc_yp, FPC_T]);
  71. // ── Connector B (Y- edge, FPC exits -Y) ──────────────────────────
  72. color("#d0d0d0")
  73. translate([CON_CX - CON_W/2, CON_B_Y0, PCB_T])
  74. cube([CON_W, CON_D, CON_H]);
  75. // FPC stub out of connector B
  76. if (fpc_yn > 0)
  77. color("#e8e8e8")
  78. translate([CON_CX - FPC_W/2, -fpc_yn, PCB_T + (CON_H - FPC_T)/2])
  79. cube([FPC_W, fpc_yn, FPC_T]);
  80. }
  81. // Standalone render
  82. fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN);