cable_guide.scad 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // Waveshare 2.13" e-Paper HAT (B) — ESP32 Nametag Case
  2. // Display slides in from X−; FPC routes through internal 180° bend guide at X+
  3. // --- Display Dimensions (landscape: portrait rotated 90°) ---
  4. DISP_W = 59.20; // overall width (X) — portrait height
  5. DISP_D = 29.20; // overall depth (Y) — portrait width
  6. DISP_T = 1.0; // thickness (Z)
  7. // --- Active (Visible) Area ---
  8. ACT_W = 48.55; // active area width (X) — portrait AA height
  9. ACT_D = 23.71; // active area depth (Y) — portrait AA width
  10. // Border offsets from display edge to active area:
  11. // X-: portrait top border ≈ 1.95 mm (open/entry side)
  12. // X+: portrait FPC border ≈ 8.70 mm (closed/backstop; FPC exits here)
  13. // Y±: symmetric ≈ 2.75 mm each side
  14. ACT_X_OFFSET = 1.95;
  15. ACT_Y_OFFSET = 2.75;
  16. // --- FPC Cable (exits X+ side of display) ---
  17. FPC_W = 12.5;
  18. FPC_T = 0.3;
  19. FPC_LEN = 20.0; // visualization length of hanging tail
  20. // --- FPC Bend Guide ---
  21. BEND_R = 2.0; // inner bend radius (mm)
  22. BEND_WALL = 1.5; // wall thickness around channel (mm)
  23. // --- FPC Excess-Cable Pocket (under display floor) ---
  24. FPC_POCKET_D = 0.75; // depth below display floor (Z), slip-fit with assembly clearance
  25. FPC_POCKET_L = 20.0; // length running toward X− from the X+ cavity wall
  26. // --- Resin Drain Holes (Z− face, under bend guide arc bottom) ---
  27. DRAIN_HOLES = true; // enable drain holes for SLA printing
  28. DRAIN_D = 3.0; // hole diameter (mm)
  29. DRAIN_MARGIN = 1.0; // clearance from FPC cable corner to hole edge (mm)
  30. // --- Case Parameters ---
  31. WALL = 4.2; // = BEND_WALL + 2*BEND_R − DISP_T − TOL: keeps exactly BEND_WALL below channel
  32. LIP = 1.5; // front bezel lip thickness (Z)
  33. TOL = 0.3; // per-side display clearance
  34. CHAM = 1.0;
  35. CHAM_ANGLE = 60;
  36. CORNER_R = 2.5;
  37. X_PAD = 0; // extra bezel thickness added at X− (entry) end
  38. // --- Magnetic Strip Pocket (back face) ---
  39. MAG_L = 1.772 * 25.4; // strip length ≈ 45.01 mm
  40. MAG_W = 0.512 * 25.4; // strip width ≈ 13.00 mm
  41. MAG_LIP_H = 2.0; // pocket depth
  42. MAG_TOL = 0.2; // per-side clearance
  43. // --- Preview Controls ---
  44. SHOW_DISP = false;
  45. SCREEN_EXPLODE = 0; // mm to pull display toward X− in preview
  46. SLICE_Z = 0; // show only below this Z for cross-section view (0 = off)
  47. SLICE_Y = 25; // show only below this Y for cross-section view (0 = off)
  48. // --- Derived Dimensions ---
  49. cav_w = DISP_W + TOL * 2;
  50. cav_d = DISP_D + TOL * 2;
  51. case_w = WALL + cav_w; // WALL on X+; guide flat face at x=case_w
  52. case_h = WALL + DISP_T + LIP;
  53. case_d = WALL * 2 + cav_d;
  54. _guide_or = BEND_R + BEND_WALL; // guide depth; case extends this far past case_w
  55. _guide_cz = WALL + DISP_T + TOL - BEND_R; // guide center Z: aligns guide top with entry slot top
  56. _sweep_half = 112.5; // half of 225° sweep; arms exit at ±_sweep_half°
  57. _exit_x = case_w + BEND_R * cos(-_sweep_half); // X of bottom exit arm on inner radius
  58. _exit_z = _guide_cz + BEND_R * sin(-_sweep_half); // Z of bottom exit arm on inner radius
  59. _exit_span_x = abs(BEND_R * cos(_sweep_half)); // X span from arc tip back to guide center
  60. _cham_xy = CHAM * tan(CHAM_ANGLE);
  61. // Drain holes: punched from Z− face up to just inside the arc bottom
  62. // Y offset keeps hole edges DRAIN_MARGIN clear of FPC cable corners (at ±FPC_W/2 from center)
  63. _drain_depth = _guide_cz - BEND_R + 0.5; // 1.8 mm solid + 0.5 mm into arc
  64. _drain_y_off = FPC_W / 2 - DRAIN_D / 2 - DRAIN_MARGIN; // inset from cable corner
  65. win_x = X_PAD + TOL + ACT_X_OFFSET;
  66. win_y = WALL + TOL + ACT_Y_OFFSET;
  67. // Magnetic strip pocket centered on full case length (including guide extension and X_PAD)
  68. _lip_il = MAG_L + 2 * MAG_TOL;
  69. _lip_iw = MAG_W + 2 * MAG_TOL;
  70. _lip_x = (X_PAD + case_w + _guide_or) / 2 - _lip_il / 2;
  71. _lip_y = case_d / 2 - _lip_iw / 2;
  72. // -------------------------------------------------------------------
  73. // Display mockup — approximate geometry for preview only
  74. // -------------------------------------------------------------------
  75. module EPD213B() {
  76. color([0.82, 0.84, 0.80])
  77. cube([DISP_W, DISP_D, DISP_T]);
  78. color("white")
  79. translate([ACT_X_OFFSET, ACT_Y_OFFSET, DISP_T])
  80. cube([ACT_W, ACT_D, 0.02]);
  81. color([1.0, 0.85, 0.1])
  82. translate([DISP_W, (DISP_D - FPC_W) / 2, (DISP_T - FPC_T) / 2])
  83. cube([FPC_LEN, FPC_W, FPC_T]);
  84. }
  85. // -------------------------------------------------------------------
  86. module rounded_box(l, w, h, r) {
  87. hull()
  88. for (dx = [r, l-r], dy = [r, w-r])
  89. translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
  90. }
  91. module epd_case() {
  92. _slot_w = FPC_W + 1.0; // 0.5 mm per-side assembly clearance
  93. difference() {
  94. // Case body extended in X+ to enclose the bend guide, X_PAD extends X− end
  95. rounded_box(X_PAD + case_w + _guide_or, case_d, case_h, CORNER_R);
  96. // Display cavity — slot opens through X− face, extends full depth including X_PAD
  97. translate([-0.01, WALL, WALL])
  98. cube([X_PAD + cav_w + 0.01, cav_d, DISP_T + TOL]);
  99. // Active area window + chamfered top edges
  100. translate([win_x, win_y, WALL + DISP_T - 0.01])
  101. cube([ACT_W, ACT_D, LIP - CHAM + 0.02]);
  102. hull() {
  103. translate([win_x, win_y, case_h - CHAM])
  104. cube([ACT_W, ACT_D, 0.01]);
  105. translate([win_x - _cham_xy, win_y - _cham_xy, case_h])
  106. cube([ACT_W + 2*_cham_xy, ACT_D + 2*_cham_xy, 0.01]);
  107. }
  108. // Magnetic strip pocket in back face
  109. translate([_lip_x, _lip_y, -0.01])
  110. cube([_lip_il, _lip_iw, MAG_LIP_H + 0.01]);
  111. // Combined cable channel — entry + return, interior walls removed
  112. // Top is flat at WALL+DISP_T+TOL; floor slopes up from guide exit to cavity wall
  113. hull() {
  114. translate([X_PAD + _exit_x - 0.01, case_d / 2 - _slot_w / 2, _exit_z])
  115. cube([_exit_span_x + 0.01, _slot_w, WALL + DISP_T + TOL - _exit_z]);
  116. translate([X_PAD + cav_w - 0.01, case_d / 2 - _slot_w / 2, WALL - FPC_POCKET_D])
  117. cube([0.02, _slot_w, DISP_T + TOL + FPC_POCKET_D]);
  118. }
  119. // FPC excess-cable pocket below display floor — cable coils here after the bend guide
  120. translate([X_PAD + cav_w - FPC_POCKET_L, case_d / 2 - _slot_w / 2,
  121. WALL - FPC_POCKET_D])
  122. cube([FPC_POCKET_L + 0.01, _slot_w, FPC_POCKET_D + 0.01]);
  123. // Internal 225° bend guide channel
  124. translate([X_PAD + case_w, case_d / 2, _guide_cz])
  125. rotate([-90, 0, 0])
  126. translate([0, 0, -_slot_w / 2])
  127. linear_extrude(_slot_w)
  128. intersection() {
  129. circle(r = BEND_R, $fn = 64);
  130. polygon(concat([[0, 0]],
  131. [for (a = [112.5 : -5 : -112.5])
  132. [(BEND_R + 0.01) * cos(a), (BEND_R + 0.01) * sin(a)]]));
  133. }
  134. // Resin drain holes through Z− face at arc bottom
  135. // Symmetric pair inset from FPC cable corners by DRAIN_MARGIN so cable glides past
  136. if (DRAIN_HOLES)
  137. for (s = [-1, 1])
  138. translate([X_PAD + case_w, case_d / 2 + s * _drain_y_off, -0.01])
  139. cylinder(d = DRAIN_D, h = _drain_depth + 0.01, $fn = 32);
  140. }
  141. }
  142. // -------------------------------------------------------------------
  143. // Render
  144. // -------------------------------------------------------------------
  145. color("#004B49")
  146. intersection() {
  147. epd_case();
  148. cube([X_PAD + case_w + _guide_or + 1,
  149. ($preview && SLICE_Y > 0) ? SLICE_Y : case_d + 1,
  150. ($preview && SLICE_Z > 0) ? SLICE_Z : case_h + 1]);
  151. }
  152. if ($preview && SHOW_DISP)
  153. translate([X_PAD + TOL - SCREEN_EXPLODE, WALL + TOL, WALL])
  154. EPD213B();