1
0

TinySphEAR.scad 24 KB

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