first_order.scad 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. //
  2. // SphEAR, 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. mic_radius = 10.5;
  34. // dimensions of capsule holder connection legs
  35. leg_width = 4;
  36. leg_thick = 2.5;
  37. // width of the ridge that connects to the mount
  38. ridge_width = 2;
  39. ridge_length = 3;
  40. // dimensions of microphone holder
  41. mount_radius = 3.5;
  42. // height of mount
  43. mount_height = 4;
  44. //// end of model parameters
  45. ////
  46. //// rendering control
  47. // what to render:
  48. // 0 -> ready to print
  49. // set = 0 -> one capsule, set = 1 -> four capsules
  50. // 1 -> the whole microhone with four capsules
  51. rendermic = 1;
  52. renderset = 0;
  53. // what type of connection to use between capsule holders:
  54. // 0 -> original cylinder beams
  55. // 1 -> interlocking beams (out)
  56. // 2 -> interlocking beams (in)
  57. connect = 2;
  58. //// end of rendering control
  59. ////
  60. // adjustment for the radius of the capsule
  61. // measured inside diameter of a trial print was around 7.5 to 8.2
  62. // instead of 10, capsule diameter was 9.99)
  63. fudge = 0.15;
  64. // adjustment for fit of slots in connection legs and mount
  65. fit = 0.2;
  66. // wall thickness of cylinders
  67. wall = 1;
  68. // number of facets for cylinders
  69. facets = 64;
  70. // the rest of the connection leg geometry
  71. tetra = atan(sqrt(2));
  72. leg_length =
  73. connect == 0 ?
  74. mic_radius * sin(tetra) - capsule_radius * cos(tetra) :
  75. connect == 1 ?
  76. (mic_radius - capsule_height + leg_thick) * sin(tetra) / sin(90 - tetra) - capsule_radius :
  77. mic_radius - (capsule_radius / sqrt(2));
  78. slot_depth = connect == 1 ?
  79. leg_thick * 1.5 : leg_thick;
  80. // microphone holder geometry
  81. capsule_sep_min = (mic_radius - capsule_height) * sin(tetra) - (capsule_radius + wall) * cos(tetra);
  82. capsule_sep_max = mic_radius * sin(tetra) - (capsule_radius + wall) * cos(tetra);
  83. capsule_bottom = mic_radius * cos(tetra) + (capsule_radius + wall) * sin(tetra);
  84. mount_slot_depth = ridge_length * cos(tetra);
  85. ////////
  86. // microphone capsule holder
  87. // azimuth: horizontal orientation of the capsule
  88. // elevation: vertical orientation of the capsure
  89. // mounts: vector with angles that correspond to the orientation of the legs
  90. // twist: rotate the whole capsule to match mounting legs
  91. module capsule (azimuth, elevation, mounts, twist) {
  92. rotate([0, 0, azimuth]) {
  93. rotate([0, (90 - elevation), 0]) {
  94. translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
  95. difference () {
  96. union () {
  97. // main capsule holder
  98. cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
  99. // the mounting legs
  100. for (rot = mounts) {
  101. rotate(a = rot + twist, v = [0, 0, 1]) {
  102. // connect with cylindrical beams, very pretty
  103. if (connect == 0) {
  104. translate([capsule_radius - wall, 0, capsule_height - wall]) {
  105. rotate([0, 90 + tetra, 0]) {
  106. cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
  107. }
  108. }
  109. }
  110. // connect with horizontal legs
  111. if (connect == 1) {
  112. translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
  113. rotate([0, -90, 0]) {
  114. difference() {
  115. // thickness, width
  116. cube([leg_thick, leg_width, leg_length]);
  117. // cut slot in connector
  118. translate([0, leg_width / 3 - (fit / 2), 0]) {
  119. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  120. }
  121. }
  122. }
  123. }
  124. }
  125. // connect with vertical legs
  126. if (connect == 2) {
  127. translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
  128. difference() {
  129. // thickness, width
  130. cube([leg_thick, leg_width, leg_length]);
  131. // cut slot in connector
  132. translate([0, leg_width / 3 - (fit / 2), 0]) {
  133. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. // add ridges for microphone mount
  141. if (elevation < 0) {
  142. rotate([0, 0, twist]) {
  143. translate([capsule_radius + fudge, - wall , 0]) {
  144. difference() {
  145. cube([ridge_length, ridge_width, capsule_height], center = false);
  146. rotate([0, tetra, 0]) {
  147. cube([ridge_length, ridge_width, capsule_height], center = false);
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. // make the hole for the capsule
  155. translate ([0, 0, -2]) {
  156. cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
  157. }
  158. // remove any extra connecting beam material from the face of the holder
  159. if (connect == 0) {
  160. translate ([0, 0, capsule_height]) {
  161. cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. // microphone mount
  170. //
  171. // angles:
  172. // wall: thickness of cylinder wall
  173. // separation: height of mount with respect of the microphone assembly
  174. module mount (angles, wall, separation) {
  175. translate([0, 0, -(separation + 0.1)]) {
  176. difference() {
  177. union() {
  178. // grips for the capsule holder ridge
  179. for (rot = angles) {
  180. rotate([0, 0, rot]) {
  181. translate([-capsule_sep_max, -(ridge_width - fit / 2), -mount_height]) {
  182. cube([capsule_sep_max, ridge_width * 2 - fit, mount_height]);
  183. rotate([0, -(90 - tetra), 0]) {
  184. cube([capsule_sep_max, ridge_width * 2 - fit, mount_height * sin(tetra)]);
  185. }
  186. }
  187. }
  188. }
  189. translate([0, 0, -mount_height]) {
  190. cylinder(r = mount_radius + wall, h = mount_height, $fn = facets);
  191. }
  192. }
  193. // make the hole for the mount (* 1.5 to cut the ridge as well)
  194. translate([0, 0, -mount_height]) {
  195. cylinder(r = mount_radius, h = mount_height * 1.5, $fn = facets);
  196. }
  197. // cut the outside of the sloped ridge
  198. translate([0, 0, -mount_height]) {
  199. difference() {
  200. cylinder(r = capsule_sep_max + mount_height * 1.5, h = mount_height * 1.5, $fn = facets);
  201. cylinder(r = capsule_sep_max, h = mount_height * 1.5, $fn = facets);
  202. }
  203. }
  204. // and cut a slot for the ridges in the wall of the cylinder
  205. for (rot = angles) {
  206. rotate([0, 0, rot]) {
  207. translate([-capsule_sep_max * 2, -ridge_width + 4 * fit, -mount_slot_depth]) {
  208. cube([capsule_sep_max * 2, ridge_width + 2 * fit, mount_height]);
  209. }
  210. }
  211. }
  212. }
  213. }
  214. }
  215. // elevation angle for capsule holders
  216. elev = atan(1 / sqrt(2));
  217. // render a complete microphone
  218. if (rendermic == 1) {
  219. capsule(45, elev, [-120, 0, 120], 60);
  220. capsule(-45, -elev, [-120, 120], 0);
  221. capsule(-135, elev, [-120, 0, 120], 60);
  222. capsule(135, -elev, [-120, 120], 0);
  223. // the mount
  224. mount([-45, 135], 1, capsule_bottom);
  225. }
  226. // print all the parts separately
  227. part_sep = capsule_radius * 2 * 3;
  228. if (rendermic == 0) {
  229. capsule(0, -90, [-120, 0, 120], 0);
  230. if (renderset != 0) {
  231. translate([0, part_sep, 0]) { capsule(0, -90, [-120, 0, 120], 0); }
  232. translate([part_sep, 0, 0]) { capsule(0, -90, [-120, 120], 0); }
  233. translate([part_sep, part_sep]) { capsule(0, -90, [-120, 120], 0); }
  234. translate([part_sep / 2, -part_sep, 0]) { mount(1, 0); }
  235. }
  236. }