TinySpHEAR_mount_pcb.scad 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. //
  2. // *SpHEAR Project (Spherical Harmonics Ears),
  3. //
  4. // Mount for four interface printed circuit boards
  5. //
  6. // Copyright 2015-2016, Fernando Lopez-Lezcano, All Rights Reserved
  7. // nando@ccrma.stanford.edu
  8. //
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. //
  24. // 3d Models released under the Creative Commons license as follows:
  25. // Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
  26. // http://creativecommons.org/licenses/by-nc-sa/4.0/
  27. // size of printed circuit board
  28. pcb_length = 85.090;
  29. // measured = 16.26 (fit = 0.25)
  30. pcb_width = 16.51;
  31. // measured = 1.33 (fit = 0.28)
  32. pcb_thickness = 1.61;
  33. // diameter of four conductor cable
  34. cable_diam = 8.75;
  35. // add to length and width of pcb
  36. pcb_fit = 0.25 / 2;
  37. // add to thickness of pcb
  38. pcb_tfit = 0.3;
  39. // lip fit for flares (fit = 0.25)
  40. // tried with 0.30 and seems to be fine
  41. lip_fit = 0.30 / 2;
  42. // wall thickness
  43. wall = 1.0;
  44. // back and front clearance of pcb (components and leads)
  45. // pcb_front = 10.2;
  46. pcb_front = 12.5;
  47. pcb_back = 2.0;
  48. // calculated minimum "radius" of microphone box
  49. box_radius = pcb_front + (pcb_thickness + pcb_tfit) + pcb_back + 2 * wall;
  50. // number of facets for rendering cylinders
  51. facets = 64;
  52. // the printed circuit board
  53. module pcb(length, width, thick) {
  54. translate([-width/2, 0, 0]) {
  55. cube([width, thick, length]);
  56. }
  57. }
  58. // the printed circuit board plus space in the front and back for components
  59. module pcb_clear(length, width, thick, slot_depth, front, back) {
  60. translate([0, - (thick + front)]) {
  61. pcb(length, width, thick);
  62. // clear space in the front
  63. translate([- (width/2 - slot_depth), thick, 0]) {
  64. cube([width - 2 * slot_depth, front, length]);
  65. }
  66. // clear space in the back
  67. translate([- (width/2 - slot_depth), - back, 0]) {
  68. cube([width - 2 * slot_depth, back, length]);
  69. }
  70. }
  71. }
  72. // all four printed circuit boards
  73. module tetra_pcb_clear(length, width, thick, slot_depth, front, back) {
  74. for (rot = [0, 90, 180, 270]) {
  75. rotate([0, 0, rot]) {
  76. pcb_clear(pcb_length + 2*pcb_fit, pcb_width + 2*pcb_fit, pcb_thickness + pcb_tfit, slot_depth, front, back);
  77. }
  78. }
  79. }
  80. module tetra_mount_box(height, radius, corner) {
  81. rd = radius - corner;
  82. minkowski() {
  83. translate([-rd, -rd, 0]) {
  84. cube([rd * 2, rd * 2, height / 2]);
  85. }
  86. cylinder(r = corner, h = height / 2, $fn = facets);
  87. }
  88. }
  89. // the main body of the microphone mount
  90. module tetra_mount_body(height, radius, corner, lower_lip, upper_lip, clear) {
  91. rd = radius - corner;
  92. difference() {
  93. tetra_mount_box(height, radius, corner);
  94. union() {
  95. // hollow out the inside with slots for pcbs
  96. tetra_pcb_clear(pcb_length, pcb_width, pcb_thickness, 1.0, pcb_front, pcb_back);
  97. // trim square angles
  98. cylinder(r = pcb_front, h = height, $fn = facets);
  99. // upper lip for flare to microphone
  100. translate([0, 0, height - upper_lip]) {
  101. difference() {
  102. tetra_mount_box(upper_lip, radius, corner);
  103. tetra_mount_box(upper_lip, radius - (wall + lip_fit), corner);
  104. }
  105. }
  106. // lower lip for flare to cable
  107. translate([0, 0, 0]) {
  108. difference() {
  109. tetra_mount_box(lower_lip, radius, corner);
  110. tetra_mount_box(lower_lip, radius - (wall + lip_fit), corner);
  111. }
  112. }
  113. }
  114. }
  115. // external slot for microphone holder
  116. mount_slot_len = 30;
  117. mount_slot_stem = 4;
  118. mount_slot_width = 2;
  119. mount_slot_radius = 2;
  120. translate([-(radius + mount_slot_stem), -(mount_slot_width/2), 0]) {
  121. cube([mount_slot_stem, mount_slot_width, mount_slot_len]);
  122. }
  123. translate([-(radius + mount_slot_stem), 0, 0]) {
  124. cylinder(r = mount_slot_radius, h = mount_slot_len, $fn = facets);
  125. }
  126. // add parts for clearance check
  127. if (clear == 1) {
  128. // electrolytic capacitors
  129. cap_diam = 10.2;
  130. for (rot = [0, 180, 270]) {
  131. rotate([0, 0, rot]) {
  132. translate([-pcb_front + cap_diam/2, 0, 0]) {
  133. cylinder(r = (cap_diam/2), h = 20, $fn = facets);
  134. }
  135. }
  136. }
  137. // 12.3 x 10.53 caps
  138. cap_h = 12.3;
  139. cap_w = 10.53/2;
  140. for (rot = [0, 180, 270]) {
  141. rotate([0, 0, rot]) {
  142. translate([-pcb_front + cap_h, -cap_w/2 - 2.5, 0]) {
  143. cube([cap_h, cap_w, 20]);
  144. }
  145. }
  146. }
  147. }
  148. }
  149. // flares from the body to the microphone stalk and cable
  150. module tetra_mount_flare(height, transition, bot_radius, bot_corner, top_radius, stalk_height) {
  151. // bottom rounded box
  152. difference() {
  153. tetra_mount_box(height, bot_radius, bot_corner);
  154. tetra_mount_box(height, bot_radius - wall, bot_corner);
  155. }
  156. // flare to round section
  157. translate([0, 0, height]) {
  158. difference() {
  159. hull() {
  160. tetra_mount_box(1, bot_radius, bot_corner);
  161. translate([0, 0, transition]) {
  162. cylinder(r = top_radius, h = 1, $fn = facets);
  163. }
  164. }
  165. hull() {
  166. tetra_mount_box(1, bot_radius - wall, bot_corner);
  167. translate([0, 0, transition]) {
  168. cylinder(r = top_radius - wall, h = 1, $fn = facets);
  169. }
  170. }
  171. }
  172. }
  173. // cylindrical stalk
  174. translate([0, 0, height + transition]) {
  175. difference() {
  176. cylinder(r = top_radius, h = stalk_height, $fn = facets);
  177. cylinder(r = top_radius - wall, h = stalk_height, $fn = facets);
  178. }
  179. }
  180. }
  181. echo("box radius is ", box_radius);
  182. // main body of microphone mount
  183. tetra_mount_body(pcb_length, box_radius + wall, 10, 6, 6, 0);
  184. // flare to microphone stalk
  185. // translate([0, 0, pcb_length + 10]) {
  186. *translate([0, 0, 0]) {
  187. tetra_mount_flare(10, 50, box_radius + wall, 10, 5, 40);
  188. }
  189. // flare to microphone cable
  190. *translate([0, 0, -10]) {
  191. rotate([0, 180, 0]) {
  192. tetra_mount_flare(10, 20, 17, 10, cable_diam / 2, 10);
  193. }
  194. }