BigSpHEAR.scad 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. //
  2. // BigSpHEAR (Big Spherical Harmonics Ear), 12 capsule Ambisonics microphone
  3. //
  4. // Copyright 2015, Fernando Lopez-Lezcano, All Rights Reserved
  5. // nando@ccrma.stanford.edu
  6. //
  7. //
  8. // This program is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. //
  22. // 3d Models released under the Creative Commons license as follows:
  23. // Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
  24. // http://creativecommons.org/licenses/by-nc-sa/4.0/
  25. ////
  26. //// model parameters
  27. // dimensions of the EM182 electret microphone
  28. capsule_radius = 5;
  29. capsule_height = 4.5;
  30. // distance between face of capsule and center of array
  31. mic_radius = 20;
  32. // dimensions of capsule holder connection legs
  33. leg_width = 4;
  34. leg_thick = 2.5;
  35. // width of the ridge that connects to the mount
  36. ridge_width = 2;
  37. ridge_length = 2;
  38. // wall thickness of capsule holder
  39. wall = 1;
  40. // dimensions of microphone holder
  41. mount_radius = 4.5;
  42. // height of mount
  43. mount_height = 4;
  44. // type of octathingy
  45. // 0 -> regular octathingy (equilateral triangles in the square antiprism)
  46. // 1 -> tetrahedral compatible octathingy (same elevation angle as the tetrahedral mic)
  47. tetra_compat = 0;
  48. //// end of model parameters
  49. ////
  50. //// rendering control
  51. // what to render:
  52. // 0 -> ready to print
  53. // set = 0 -> one capsule, set = 1 -> four capsules
  54. // 1 -> the whole microhone with four capsules
  55. rendermic = 1;
  56. renderset = 0;
  57. // what type of connection to use between capsule holders:
  58. // 0 -> original cylinder beams
  59. // 1 -> interlocking beams (out)
  60. // 2 -> interlocking beams (in)
  61. connect = 1;
  62. // adjustment for the radius of the capsule
  63. // measured inside diameter of a trial print was around 7.5 to 8.2
  64. // instead of 10, capsule diameter was 9.99)
  65. fudge = 0.15;
  66. // adjustment for fit of slots in connection legs and mount
  67. fit = 0.2;
  68. // number of facets for rendering cylinders
  69. facets = 64;
  70. //// end of rendering control
  71. ////
  72. // define the elevation angle of the upper and lower rings
  73. //
  74. // http://eusebeia.dyndns.org/4d/antiprism4
  75. //
  76. // The Cartesian coordinates of the square antiprism,
  77. // centered on the origin and having edge length 2, are:
  78. //
  79. // (0, ±√2, 1/∜2)
  80. // (±√2, 0, 1/∜2)
  81. // (±1, ±1, −1/∜2)
  82. //
  83. // the elevation angle for the two rings of 4 is:
  84. //
  85. // 1/2*∜2 = 0.420448207627 (z for edge length = 1)
  86. // atan(1/(2*∜2) / 0.707) = 30.7358671024
  87. elev_angle = tetra_compat == 0 ? atan(1 / (2 * sqrt(sqrt(2))) * sqrt(2)) : atan(sqrt(1/2));
  88. // calculate half angle between vertices in the square antiprism
  89. // these angles define the length of the connecting legs
  90. //
  91. // z coordinate of antiprism vertices
  92. vert_z = sqrt(2) * tan(elev_angle) / 2;
  93. // vector length (same for all antiprism vertices)
  94. vert_n = norm([-0.5, -0.5, vert_z]);
  95. // half angle between adjacent vertices in either the upper or lower rings
  96. vert_angle_h = acos(([-0.5, -0.5, vert_z] / vert_n) * ([0.5, -0.5, vert_z] / vert_n)) / 2;
  97. // half angle between adjacent vertices in the upper and lower rings
  98. vert_angle_v = acos(([0.0, -1 / sqrt(2), -vert_z] / vert_n) * ([0.5, -0.5, vert_z] / vert_n)) / 2;
  99. // microphone holder geometry
  100. capsule_sep_min = (mic_radius - capsule_height) * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
  101. capsule_sep_max = mic_radius * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
  102. capsule_bottom = mic_radius * sin(elev_angle) + (capsule_radius + wall) * cos(elev_angle);
  103. mount_slot_depth = ridge_length * sin(elev_angle);
  104. ////////
  105. // microphone capsule holder
  106. // azimuth: horizontal orientation of the capsule
  107. // elevation: vertical orientation of the capsure
  108. // mounts: vectors containing the angle of the mount and the angle to the adjacent capsule
  109. // twist: rotate the whole capsule to match mounting legs
  110. module capsule (azimuth, elevation, mounts, twist, ridge) {
  111. rotate([0, 0, azimuth]) {
  112. rotate([0, (90 - elevation), 0]) {
  113. translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
  114. difference () {
  115. union () {
  116. // main capsule holder
  117. cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
  118. // the mounting legs
  119. for (angles = mounts) {
  120. rotate([0, 0, angles[0] + twist]) {
  121. // connect with cylindrical beams, very pretty
  122. leg_length = mic_radius * sin(angles[1]) - (capsule_radius + wall) * cos(angles[1]) + wall;
  123. if (connect == 0) {
  124. translate([capsule_radius - wall, 0, capsule_height - wall]) {
  125. rotate([0, 180 - (90 - angles[1]), 0]) {
  126. cylinder(d = leg_width, h = leg_length - 0.1, center = false, $fn = facets);
  127. }
  128. }
  129. }
  130. // connect with horizontal legs
  131. if (connect == 1) {
  132. leg_length = (mic_radius - capsule_height + leg_thick) * tan(angles[1]) - capsule_radius;
  133. slot_depth = leg_thick * cos(90 - 2 * angles[1]) + fit;
  134. translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
  135. rotate([0, -90, 0]) {
  136. difference() {
  137. // thickness, width
  138. cube([leg_thick, leg_width, leg_length]);
  139. // cut slot in connector
  140. translate([0, leg_width / 3 - (fit / 2), 0]) {
  141. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  142. }
  143. }
  144. }
  145. }
  146. }
  147. // connect with vertical legs
  148. if (connect == 2) {
  149. leg_length = (mic_radius * tan(angles[1]) - capsule_radius) * tan(90 - angles[1]);
  150. slot_depth = leg_thick * (cos (90 - 2 * angles[1]) + tan(90 - 2 * angles[1])) + fit;
  151. translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
  152. difference() {
  153. // thickness, width
  154. cube([leg_thick, leg_width, leg_length]);
  155. // cut slot in connector
  156. translate([0, leg_width / 3 - (fit / 2), 0]) {
  157. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. // add ridges for microphone mount
  165. if (ridge == 1) {
  166. rotate([0, 0, twist]) {
  167. translate([capsule_radius + fudge, - wall , 0]) {
  168. difference() {
  169. cube([ridge_length, ridge_width, capsule_height], center = false);
  170. //rotate([0, 90 - elev_angle, 0]) {
  171. // cube([ridge_length, ridge_width, capsule_height], center = false);
  172. //}
  173. }
  174. }
  175. }
  176. }
  177. }
  178. // make the hole for the capsule
  179. translate ([0, 0, -2]) {
  180. cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
  181. }
  182. // remove any extra connecting beam material from the face of the holder
  183. if (connect == 0) {
  184. translate ([0, 0, capsule_height]) {
  185. cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. // microphone mount
  194. //
  195. // angles: angles for mount slots
  196. // wall: thickness of cylinder wall
  197. // separation: height of mount with respect of the microphone assembly
  198. module mount (angles, wall, separation) {
  199. translate([0, 0, -(separation + 0.1)]) {
  200. difference() {
  201. union() {
  202. // grips for the capsule holder ridge
  203. for (rot = angles) {
  204. rotate([0, 0, rot]) {
  205. translate([-capsule_sep_max, -(ridge_width - fit / 2), -mount_height]) {
  206. cube([capsule_sep_max, ridge_width * 2 - fit, mount_height]);
  207. rotate([0, -elev_angle, 0]) {
  208. cube([capsule_sep_max, ridge_width * 2 - fit, mount_height * cos(elev_angle)]);
  209. }
  210. }
  211. }
  212. }
  213. translate([0, 0, -mount_height]) {
  214. cylinder(r = mount_radius + wall, h = mount_height, $fn = facets);
  215. }
  216. }
  217. // make the hole for the mount (* 2 to cut the ridge as well)
  218. translate([0, 0, -mount_height]) {
  219. cylinder(r = mount_radius, h = mount_height * 2, $fn = facets);
  220. }
  221. // cut the outside of the sloped ridge
  222. translate([0, 0, -mount_height]) {
  223. difference() {
  224. cylinder(r = capsule_sep_max + mount_height * 2, h = mount_height * 2, $fn = facets);
  225. cylinder(r = capsule_sep_max, h = mount_height * 2, $fn = facets);
  226. }
  227. }
  228. // and cut a slot for the ridges in the wall of the cylinder
  229. for (rot = angles) {
  230. rotate([0, 0, rot]) {
  231. translate([-capsule_sep_max * 2, -ridge_width + 4 * fit, -mount_slot_depth]) {
  232. cube([capsule_sep_max * 2, ridge_width + 2 * fit, mount_height * 2]);
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. elev = atan(1/2);
  240. golden = (1 + sqrt(5)) / 2;
  241. diedral = 90 - (2 * atan(golden) / 2);
  242. leg_angles =
  243. [
  244. [0, diedral],
  245. [72, diedral],
  246. [144, diedral],
  247. [216, diedral],
  248. [288, diedral]
  249. ];
  250. // render a complete microphone
  251. if (rendermic == 1) {
  252. for (azup = [0 : 72 : 360]) {
  253. capsule(azup, elev, leg_angles, 36, 0);
  254. }
  255. for (azdn = [36 : 72 : 360]) {
  256. capsule(azdn, -elev, leg_angles, 0, 0);
  257. }
  258. capsule(0, 90, leg_angles, 0, 0);
  259. capsule(0, -90, leg_angles, 0, 0);
  260. }
  261. // print all the parts separately
  262. part_sep = capsule_radius * 5;
  263. if (rendermic == 0) {
  264. if (connect == 1) {
  265. twist_all = -36;
  266. translate([0, 0, 0]) { capsule(0, 90, leg_angles, twist_all, 0); }
  267. translate([0, part_sep, 0]) { capsule(0, 90, leg_angles, twist_all, 0); }
  268. translate([part_sep, 0, 0]) { capsule(0, 90, leg_angles, twist_all, 0); }
  269. translate([part_sep, part_sep]) { capsule(0, 90, leg_angles, twist_all, 0); }
  270. translate([-part_sep, 0, 0]) { capsule(0, 90, leg_angles, twist_all, 0); }
  271. translate([-part_sep, part_sep]) { capsule(0, 90, leg_angles, twist_all, 0); }
  272. // ridges to connect all parts
  273. translate([-part_sep + wall, part_sep / 2 - wall, 0]) {
  274. cube([part_sep * 2, wall, wall / 2]);
  275. }
  276. for (d = [-part_sep, 0, part_sep]) {
  277. translate([wall + d, capsule_radius, 0]) {
  278. cube([wall, part_sep - capsule_radius * 2, wall / 2]);
  279. }
  280. }
  281. }
  282. }