1
0

first_order.scad 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. //
  2. // SphEAR, First Order (B-format) Ambisonics Microphone
  3. //
  4. // Copyright 2015, Fernando Lopez-Lezcano, All Rights Reserved
  5. //
  6. // Source code released under the GNU GPL License
  7. // http://www.gnu.org/licenses/gpl-3.0.en.html
  8. //
  9. // 3d models released under Creative Commons Non-Commercial Share-Alike
  10. // CC-NC-SA 3.0
  11. // http://creativecommons.org/licenses/by-nc-sa/3.0/
  12. //
  13. // https://en.wikipedia.org/wiki/Tetrahedron
  14. // angle capsule to vertical = atan(sqrt(2)) = 54.7356103172
  15. ////
  16. //// model parameters
  17. // dimensions of the EM182 electret microphone
  18. capsule_radius = 5;
  19. capsule_height = 4.5;
  20. // distance between face of capsule and center of array
  21. mic_radius = 10.5;
  22. // dimensions of capsule holder connection legs
  23. leg_width = 4;
  24. leg_thick = 2.5;
  25. // width of the ridge that connects to the mount
  26. ridge_width = 2;
  27. ridge_length = 3;
  28. // dimensions of microphone holder
  29. mount_radius = 3.5;
  30. // height of mount
  31. mount_height = 4;
  32. //// end of model parameters
  33. ////
  34. //// rendering control
  35. // what to render:
  36. // 0 -> ready to print
  37. // set = 0 -> one capsule, set = 1 -> four capsules
  38. // 1 -> the whole microhone with four capsules
  39. rendermic = 1;
  40. renderset = 0;
  41. // what type of connection between capsule holders:
  42. // 0 -> original cylinder beams
  43. // 1 -> interlocking beams (out)
  44. // 2 -> interlocking beams (in)
  45. connect = 2;
  46. //// end of rendering control
  47. ////
  48. // adjustment for the size of the capsule
  49. // (measured inside diameter was around 7.5 to 8.2 instead of 10, capsule diameter was 9.99)
  50. fudge = 0.15;
  51. // adjustment for fit of slots
  52. fit = 0.2;
  53. // wall thickness of cylinders
  54. wall = 1;
  55. // number of facets for cylinders
  56. facets = 64;
  57. // the rest of the leg geometry
  58. tetra = atan(sqrt(2));
  59. leg_length =
  60. connect == 0 ?
  61. mic_radius * sin(tetra) - capsule_radius * cos(tetra) :
  62. connect == 1 ?
  63. (mic_radius - capsule_height + leg_thick) * sin(tetra) / sin(90 - tetra) - capsule_radius :
  64. mic_radius - (capsule_radius / sqrt(2));
  65. slot_depth = connect == 1 ?
  66. leg_thick * 1.5 : leg_thick;
  67. // holder geometry
  68. capsule_sep_min = mic_radius * sin(tetra) - capsule_radius * cos(tetra);
  69. capsule_sep_max = capsule_sep_min + capsule_height * sin(tetra);
  70. capsule_bottom = mic_radius * cos(tetra) + capsule_radius * sin(tetra);
  71. ////////
  72. // microphone capsule holder
  73. // azimuth: orientation of the capsule
  74. // elevation: orientation of the capsure
  75. // twist: adjust the angle of the mounts
  76. // mounts: number of mounts to create (2 for the bottom mics, 3 for the top)
  77. module capsule (azimuth, elevation, twist, mounts) {
  78. rotate([0, 0, azimuth]) {
  79. rotate([0, (90 - elevation), 0]) {
  80. translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
  81. // the capsule holder
  82. difference () {
  83. union () {
  84. // main capsule holder
  85. cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
  86. // the attachment point to the other capsules
  87. for (rot = mounts == 2 ? [-120, 120] : [-120, 0, 120]) {
  88. rotate(a = rot + twist, v = [0, 0, 1]) {
  89. // connect with cylindrical beams, very pretty
  90. if (connect == 0) {
  91. translate([capsule_radius - wall, 0, capsule_height - wall]) {
  92. rotate([0, 90 + tetra, 0]) {
  93. cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
  94. }
  95. }
  96. }
  97. // connect with horizontal legs
  98. if (connect == 1) {
  99. translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
  100. rotate([0, -90, 0]) {
  101. difference() {
  102. // thickness, width
  103. cube([leg_thick, leg_width, leg_length]);
  104. // cut slot in connector
  105. translate([0, leg_width / 3 - (fit / 2), 0]) {
  106. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  107. }
  108. }
  109. }
  110. }
  111. }
  112. // connect with vertical legs
  113. if (connect == 2) {
  114. translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
  115. difference() {
  116. // thickness, width
  117. cube([leg_thick, leg_width, leg_length]);
  118. // cut slot in connector
  119. translate([0, leg_width / 3 - (fit / 2), 0]) {
  120. cube([leg_thick, leg_width / 3 + fit, slot_depth]);
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. // add ridges for microphone mount
  128. if (mounts == 2) {
  129. rotate([0, 0, twist]) {
  130. translate([capsule_radius + fudge, - wall , 0]) {
  131. difference() {
  132. cube([ridge_length, ridge_width, capsule_height], center = false);
  133. rotate([0, tetra, 0]) {
  134. cube([ridge_length, ridge_width, capsule_height], center = false);
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. // make the hole for the capsule
  142. translate ([0, 0, -2]) {
  143. cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
  144. }
  145. // remove any extra connecting beam material from the face of the holder
  146. if (connect == 0) {
  147. translate ([0, 0, capsule_height]) {
  148. cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
  149. }
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. // microphone mount
  157. module mount (wall, separation) {
  158. translate([0, 0, -(separation + 1)]) {
  159. difference() {
  160. union() {
  161. // grips for the capsule holder ridge
  162. for (rot = [0 : 180 : 360]) {
  163. rotate([0, 0, rot - 45]) {
  164. translate([-(capsule_sep_max / 2), (ridge_width / 2) + fit, -mount_height]) {
  165. cube([capsule_sep_max, ridge_width / 2, mount_height]);
  166. }
  167. }
  168. }
  169. translate([0, 0, -mount_height]) {
  170. cylinder(r = mount_radius + wall, h = mount_height, $fn = facets);
  171. }
  172. }
  173. // make the hole for the mount
  174. translate([0, 0, -mount_height]) {
  175. cylinder(r = mount_radius, h = mount_height, $fn = facets);
  176. }
  177. // and cut a slot for the ridges in the wall of the cylinder
  178. rotate([0, 0, -45]) {
  179. translate([-(capsule_sep_max / 2), -ridge_width + 4 * fit, -mount_height / 2]) {
  180. cube([capsule_sep_max, ridge_width + 2 * fit, mount_height]);
  181. }
  182. }
  183. }
  184. }
  185. }
  186. // elevation angle for capsule holders
  187. elev = asin(1 / sqrt(3));
  188. // render a complete microphone
  189. if (rendermic == 1) {
  190. capsule(45, elev, 60, 3);
  191. capsule(-45, -elev, 0, 2);
  192. capsule(-135, elev, 60, 3);
  193. capsule(135, -elev, 0, 2);
  194. // the mount
  195. mount(1, capsule_bottom);
  196. }
  197. // print all the parts separately
  198. part_sep = capsule_radius * 2 * 3;
  199. if (rendermic == 0) {
  200. capsule(0, -90, 0, 3);
  201. if (renderset != 0) {
  202. translate([0, part_sep, 0]) { capsule(0, -90, 0, 3); }
  203. translate([part_sep, 0, 0]) { capsule(0, -90, 0, 2); }
  204. translate([part_sep, part_sep]) { capsule(0, -90, 0, 2); }
  205. translate([part_sep / 2, -part_sep, 0]) { mount(1, 0); }
  206. }
  207. }