TinySphEAR.scad 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. //
  2. // TinySphEAR, Tiny Spherical Ear, First Order (B-format) 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. // https://en.wikipedia.org/wiki/Tetrahedron
  26. // angle of capsule to vertical axis = atan(sqrt(2)) = 54.7356103172
  27. ////
  28. //// model parameters
  29. // dimensions of the EM182 electret microphone
  30. capsule_radius = 5;
  31. capsule_height = 4.5;
  32. // distance between face of capsule and center of array
  33. //
  34. // for a 10mm capsule: with vertical legs -> 10.5mm min radius
  35. // with horizontal legs -> 10mm min radius
  36. mic_radius = 10.6;
  37. // dimensions of capsule holder connection legs
  38. // 4mm is too thin for the width, 5mm works better
  39. leg_width = 5;
  40. leg_thick = 3;
  41. // width of the ridge that connects to the mount
  42. ridge_width = 2.0;
  43. ridge_slot_width = 2;
  44. // wall thickness of capsule holder
  45. wall = 1;
  46. // dimensions of microphone holder
  47. mount_radius = 2.75;
  48. mount_wall = 0.75;
  49. // height of mount
  50. mount_height = 30;
  51. // height of sleeve
  52. sleeve_height = 23;
  53. sleeve_wall = 0.75;
  54. // microphone stand mount
  55. //
  56. // diameter of existing shielded wires (x 4)
  57. mic_wire_diam = 1.5;
  58. mic_wire_hole_radius = 2.5;
  59. mic_wire_hole_offset = 5;
  60. // measured diameter = 13.5, inside diameter of sleeve = 13.79 (
  61. mic_mount_radius = 13.50 / 2;
  62. // add this to inside diameter
  63. mic_mount_fit = 0.1;
  64. mic_mount_slot_height = 11.5;
  65. mic_mount_slot_width = 4.25;
  66. mic_mount_slot_radius = 6.25 / 2;
  67. mic_mount_wall = 1.5;
  68. mic_mount_height = 35.0 + mic_wire_hole_offset + mic_wire_hole_radius + 2 * mic_mount_wall;
  69. //// end of model parameters
  70. ////
  71. //// rendering control
  72. // what to render:
  73. // 0 -> ready to print
  74. // set = 0 -> one capsule, set = 1 -> four capsules
  75. // 1 -> the whole microhone with four capsules
  76. rendermic = 1;
  77. renderset = 0;
  78. // what type of connection to use between capsule holders:
  79. // 0 -> original cylindrical angled legs
  80. // 1 -> interlocking horizontal legs
  81. // 2 -> interlocking vertical legs
  82. connect = 2;
  83. // what type of mount ridges to use
  84. // 0 -> nothing
  85. // 1 -> 1 ridge
  86. // 2 -> 2 ridges
  87. ridges = 1;
  88. //// end of rendering control
  89. ////
  90. // elevation angle for the capsule holders (fixed for this microphone)
  91. elev_angle = atan(sqrt(1/2));
  92. // angles of the connection legs and adjacent capsule holders
  93. leg_angles_top =
  94. [
  95. [-120, elev_angle],
  96. [0, elev_angle],
  97. [120, elev_angle]
  98. ];
  99. leg_angles_bot =
  100. [
  101. [-120, elev_angle],
  102. [120, elev_angle]
  103. ];
  104. // adjustment for the inner radius of the capsule holder
  105. // measured inside diameter of a trial print was around 7.5 to 8.2
  106. // instead of 10, capsule diameter was 9.99)
  107. fudge = 0.15;
  108. // adjustment for fit of slots in connection legs and mount
  109. fit = 0.2;
  110. // number of facets for rendering cylinders
  111. facets = 64;
  112. // microphone holder geometry
  113. capsule_sep_min = (mic_radius - capsule_height) * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
  114. capsule_sep_max = mic_radius * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
  115. capsule_bottom = mic_radius * sin(elev_angle) + (capsule_radius + wall) * cos(elev_angle);
  116. mount_radius_capsule = capsule_sep_max;
  117. ////////
  118. // microphone capsule holder
  119. // azimuth: horizontal orientation of the capsule
  120. // elevation: vertical orientation of the capsure
  121. // mounts: vectors containing the angle of the mount and the angle to the adjacent capsule
  122. // twist: rotate the whole capsule to match mounting legs
  123. // ridge: 1 -> print ridge for mount
  124. // solid: make the capsule holder solid, used in the mount to carve the capsule rests
  125. module capsule (azimuth, elevation, mounts, twist, ridge, solid = 0) {
  126. rotate([0, 0, azimuth]) {
  127. rotate([0, (90 - elevation), 0]) {
  128. translate([0, 0, (rendermic == 0 && solid == 0) ? 0 : mic_radius - capsule_height]) {
  129. difference () {
  130. union () {
  131. // main capsule holder
  132. cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
  133. // the mounting legs
  134. for (angles = mounts) {
  135. rotate([0, 0, angles[0] + twist]) {
  136. // connect with cylindrical beams, very pretty
  137. if (connect == 0) {
  138. leg_length = mic_radius * cos(angles[1]) - capsule_radius * sin(angles[1]);
  139. translate([capsule_radius - wall, 0, capsule_height - wall]) {
  140. rotate([0, 180 - angles[1], 0]) {
  141. cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
  142. }
  143. }
  144. }
  145. // connect with horizontal legs
  146. if (connect == 1) {
  147. leg_length = (mic_radius - capsule_height + leg_thick) * tan(90 - angles[1]) - capsule_radius;
  148. slot_depth = leg_thick * cos(90 - 2 * angles[1]) + wall + fit;
  149. translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
  150. rotate([0, -90, 0]) {
  151. difference() {
  152. // thickness, width
  153. cube([leg_thick, leg_width, leg_length]);
  154. // cut slot in connector
  155. translate([0, leg_width / 3 - (fit / 2), 0]) {
  156. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  157. }
  158. }
  159. }
  160. }
  161. }
  162. // connect with vertical legs
  163. if (connect == 2) {
  164. // fix this 0.2 == (2 * fudge?)
  165. leg_length = (mic_radius * tan(90 - angles[1]) - capsule_radius) * tan(angles[1]) - 0.2;
  166. slot_depth = leg_thick * cos (90 - (2 * angles[1]));
  167. translate([capsule_radius - leg_thick / 2 + fudge, - leg_width / 3,
  168. - leg_length + capsule_height]) {
  169. difference() {
  170. // the connection
  171. difference() {
  172. cube([leg_thick + leg_thick / 2, leg_width, leg_length]);
  173. translate([-leg_thick + wall - fudge, 0, - capsule_height + fudge]) {
  174. cube([leg_thick, leg_width, leg_length]);
  175. }
  176. }
  177. // cut slot in connector
  178. translate([0, leg_width / 3 - (fit / 2), 0]) {
  179. cube([leg_thick + leg_thick / 2, leg_width / 3 + fit, slot_depth]);
  180. }
  181. }
  182. }
  183. }
  184. }
  185. }
  186. // add ridges for microphone mount
  187. ridge_length = (mic_radius - capsule_height) / tan(elev_angle) - (capsule_radius + wall);
  188. if (ridge == 2) {
  189. rotate([0, 0, twist]) {
  190. translate([capsule_radius + wall - ridge_length / 2, ridge_slot_width / 2, 0]) {
  191. cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
  192. }
  193. translate([capsule_radius + wall - ridge_length / 2, -ridge_width - ridge_slot_width / 2, 0]) {
  194. cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
  195. }
  196. }
  197. }
  198. if (ridge == 1) {
  199. rotate([0, 0, twist]) {
  200. translate([capsule_radius + wall - ridge_length / 2, -ridge_width / 2, 0]) {
  201. cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
  202. }
  203. }
  204. }
  205. }
  206. // make the hole for the capsule (also cuts leg overhang for vertical connectors)
  207. if (solid != 1) {
  208. translate ([0, 0, -capsule_height]) {
  209. cylinder(r = capsule_radius + fudge, h = capsule_height * 2, $fn = facets);
  210. }
  211. }
  212. // remove any extra connecting beam material from the face of the holder
  213. if (connect == 0) {
  214. translate ([0, 0, capsule_height]) {
  215. cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
  216. }
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. // microphone mount
  224. //
  225. // angles: angles for mount slots
  226. // wall: thickness of cylinder wall
  227. // separation: height of mount with respect of the microphone assembly
  228. module mount (angles, wall, separation, solid = 0) {
  229. cone_height = 5;
  230. translate([0, 0, -(separation - 0)]) {
  231. difference() {
  232. union() {
  233. // conic section
  234. translate([0, 0, -cone_height]) {
  235. difference() {
  236. cylinder(r2 = mount_radius_capsule, r1 = mount_radius + wall, h = cone_height, $fn = facets);
  237. // make the hole for the mount (* 1.5 to cut the ridge as well)
  238. if (solid == 0) {
  239. cylinder(r2 = mount_radius_capsule - wall, r1 = mount_radius, h = cone_height * 1.5, $fn = facets);
  240. }
  241. }
  242. }
  243. translate([0, 0, -mount_height]) {
  244. difference() {
  245. cylinder(r = mount_radius + wall, h = mount_height - cone_height, $fn = facets);
  246. // make the hole for the mount (* 1.5 to cut the ridge as well)
  247. cylinder(r = mount_radius, h = (mount_height - cone_height) * 1.5, $fn = facets);
  248. }
  249. }
  250. }
  251. // indentations that match the lower capsule holders
  252. translate([0, 0, (mic_radius - capsule_height) + capsule_height * sin(elev_angle)]) {
  253. capsule(angles[0], -elev_angle, [], 0, 1, 1);
  254. capsule(angles[1], -elev_angle, [], 0, 1, 1);
  255. }
  256. // slice it open so we can pop in cables
  257. if (solid == 0) {
  258. rotate([0, 0, 45]) {
  259. translate([mount_radius - fudge, - mic_wire_diam / 2, -mount_height]) {
  260. cube([mount_radius_capsule - mount_radius + fudge, mic_wire_diam, mount_height]);
  261. }
  262. }
  263. }
  264. }
  265. }
  266. }
  267. module mount_sleeve (wall, separation, solid = 0) {
  268. translate([0, 0, -(separation + 0.0)]) {
  269. difference() {
  270. union() {
  271. // main mount cylinder
  272. translate([0, 0, -mount_height]) {
  273. difference() {
  274. cylinder(r = mount_radius + mount_wall + wall, h = sleeve_height, $fn = facets);
  275. // make the hole for the mount (* 1.5 to cut the ridge as well)
  276. if (solid == 0) {
  277. cylinder(r = mount_radius + mount_wall, h = sleeve_height * 1.5, $fn = facets);
  278. }
  279. }
  280. }
  281. // spine that fits into slice of mount body
  282. rotate([0, 0, 45]) {
  283. translate([mount_radius - mount_wall, - mic_wire_diam / 2, -mount_height]) {
  284. cube([2 * mount_wall, mic_wire_diam, sleeve_height]);
  285. }
  286. }
  287. }
  288. // cut a bit less that one half of the sleeve so it fits around the body
  289. rotate([0, 0, 45]) {
  290. translate([-mount_radius - 4 * wall, - (mount_radius + wall) /2, -mount_height]) {
  291. cube([mount_radius + wall, (mount_radius + wall), sleeve_height]);
  292. }
  293. }
  294. }
  295. }
  296. }
  297. // mount for microphone stand
  298. //
  299. module stand_mount (wall, separation) {
  300. translate([0, 0, -separation]) {
  301. difference() {
  302. union() {
  303. // main mount cylinder
  304. translate([0, 0, - mic_mount_height]) {
  305. difference() {
  306. cylinder(r = mic_mount_radius + mic_mount_fit + wall, h = mic_mount_height, $fn = facets);
  307. // make the hole for the mount (* 1.5 to cut the ridge as well)
  308. cylinder(r = mic_mount_radius + mic_mount_fit, h = mic_mount_height, $fn = facets);
  309. }
  310. }
  311. }
  312. // slot for fitting into microphone stand
  313. translate([mic_mount_radius - wall / 2, - mic_mount_slot_width / 2, - mic_mount_height]) {
  314. cube([2 * wall, mic_mount_slot_width, mic_mount_slot_height]);
  315. }
  316. // eyelet for microphone stand
  317. translate([mic_mount_radius - wall / 2, 0, - mic_mount_height + mic_mount_slot_height]) {
  318. rotate([0, 90, 0]) {
  319. cylinder(r = mic_mount_slot_radius, h = 2 * wall, $fn = facets);
  320. }
  321. }
  322. // slot and hole for microphone wiring
  323. translate([mic_mount_radius - wall / 2, - mic_wire_diam / 2, - mic_wire_hole_offset]) {
  324. cube([2 * wall, mic_wire_diam, mic_wire_hole_offset]);
  325. }
  326. translate([mic_mount_radius - wall / 2, 0, - mic_wire_hole_offset]) {
  327. rotate([0, 90, 0]) {
  328. cylinder(r = mic_wire_hole_radius, h = 2 * wall, $fn = facets);
  329. }
  330. }
  331. }
  332. }
  333. }
  334. // the cap that connects the microphone stand mount with the microphone mount
  335. module stand_mount_cap (wall, separation) {
  336. translate([0, 0, -(separation)]) {
  337. difference() {
  338. union() {
  339. // cap
  340. cylinder(r = mic_mount_radius + mic_mount_fit + wall, h = wall, $fn = facets);
  341. translate([0, 0, - 2 * wall]) {
  342. cylinder(r = mic_mount_radius + mic_mount_fit, h = 3 * wall, $fn = facets);
  343. }
  344. }
  345. // use mount and sleeve to cut hole of correct size and shape
  346. translate([0, 0, mount_height - 2 * wall]) {
  347. mount([45, -135], mount_wall, 0, 1);
  348. mount_sleeve(sleeve_wall, 0, 1);
  349. }
  350. translate([0, 0, - 2 * wall]) {
  351. cylinder(r = mount_radius + mount_wall, h = 3 * wall, $fn = facets);
  352. }
  353. // slot for microphone wiring
  354. translate([0, - mic_wire_diam / 2, - 2 * wall]) {
  355. cube([mic_mount_radius + mic_mount_fit + wall, mic_wire_diam, 3 * wall]);
  356. }
  357. }
  358. }
  359. }
  360. // render a complete microphone
  361. if (rendermic == 1) {
  362. capsule(45, elev_angle, leg_angles_top, 60, 0);
  363. capsule(-135, elev_angle, leg_angles_top, 60, 0);
  364. capsule(-45, -elev_angle, leg_angles_bot, 0, 1);
  365. capsule(135, -elev_angle, leg_angles_bot, 0, 1);
  366. // the mount
  367. mount([-45, 135], mount_wall, capsule_bottom);
  368. // the sleeve closing it
  369. mount_sleeve(sleeve_wall, capsule_bottom);
  370. // the microphone stand mount
  371. stand_mount_cap(mic_mount_wall, capsule_bottom + mount_height + 3);
  372. stand_mount(mic_mount_wall, capsule_bottom + mount_height + 7);
  373. }
  374. // print all the parts separately
  375. if (rendermic == 0) {
  376. if (connect == 1) {
  377. part_rot = 90;
  378. part_height = 0;
  379. part_sep = capsule_radius * 2.5;
  380. // #3
  381. translate([part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 60, 0); }
  382. if (renderset != 0) {
  383. // #4
  384. translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 60, 0); }
  385. // #2
  386. translate([-part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, -90, 1); }
  387. // #1
  388. translate([-part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, 90, 1); }
  389. // mount body
  390. translate([0, 0, mount_height]) { mount([-45, 135], 1, 0); }
  391. // mount sleeve
  392. translate([mount_radius * 8, 0, mount_height]) { mount_sleeve(1, 0); }
  393. // add connecting ridges to make it all one part
  394. difference() {
  395. for (rot_a = [-45, 45]) {
  396. rotate([0, 0, rot_a]) {
  397. translate([-wall / 2, -part_sep, 0]) {
  398. cube([wall, part_sep * 2, wall / 2]);
  399. }
  400. }
  401. }
  402. // remove them in the inside of the mount
  403. cylinder(r = mount_radius + wall / 2, h = wall / 2);
  404. }
  405. }
  406. } else {
  407. // connect == 2
  408. part_rot = -90;
  409. part_height = capsule_height;
  410. part_sep = capsule_radius * 2;
  411. // #3
  412. translate([part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 0, 0); }
  413. if (renderset != 0) {
  414. // #4
  415. *translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 0, 0); }
  416. // #2
  417. translate([-part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, -90, 1); }
  418. // #1
  419. translate([-part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, 90, 1); }
  420. // mount
  421. *rotate([0, 0, 45]) {
  422. translate([0, 0, mount_height]) { mount([-45, 135], mount_wall, 0); }
  423. }
  424. // mount sleeve
  425. *translate([10, 0, mount_height]) {
  426. rotate([0, 0, 45]) {
  427. mount_sleeve(sleeve_wall, 0); }
  428. }
  429. // stand mount
  430. *translate([0, 0, mic_mount_height + mic_mount_height]) {
  431. stand_mount(mic_mount_wall, mic_mount_height);
  432. }
  433. // stand mount cap
  434. *rotate([0, 180, 0]) {
  435. translate([2 * mic_mount_radius + 8, 0, - mic_mount_wall]) {
  436. stand_mount_cap(mic_mount_wall, 0);
  437. }
  438. }
  439. // add connecting ridges to make it all one part
  440. *difference() {
  441. for (rot_a = [-45, 45]) {
  442. rotate([0, 0, rot_a]) {
  443. translate([-wall / 2, -part_sep * 0.85, 0]) {
  444. cube([wall, part_sep * 1.75, wall / 2]);
  445. }
  446. }
  447. }
  448. // remove them in the inside of the mount
  449. cylinder(r = mount_radius + wall / 2, h = wall / 2);
  450. }
  451. }
  452. }
  453. }