first_order.scad 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //
  2. // First Order (B-format) Ambisonics Microphone, or SphEAR for short
  3. //
  4. // Copyright 2015 Fernando Lopez-Lezcano
  5. //
  6. // Source code released under the GNU GPL License
  7. // http://www.gnu.org/licenses/gpl-3.0.en.html
  8. //
  9. // 3d model 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. // what to render:
  13. // 0 -> a single capsule holder
  14. // 1 -> the whole microhone with four capsules
  15. rendermic = 1;
  16. // what type of connection between capsule holders:
  17. // 0 -> original cylinder beams
  18. // 1 -> interlocking beams (out)
  19. // 2 -> interlocking beams (in)
  20. connect = 2;
  21. // number of facets for cylinders
  22. facets = 64;
  23. // adjustment for the size of the capsule
  24. // (measured inside diameter was around 7.5 to 8.2 instead of 10, capsule diameter was 9.99)
  25. fudge = 0.1;
  26. ////////
  27. // microphone capsule holder
  28. // azimuth: orientation of the capsule
  29. // elevation: orientation of the capsure
  30. // separation: how far from the center to displace the capsule
  31. // radius: radius of the microphone
  32. // height: height of the microphone
  33. // wall: thickness of the microphone housing walls
  34. // twist: adjust the angle of the mounts so they match
  35. // mounts: number of mounts to create (2 or 3)
  36. module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, mounts) {
  37. rotate([0, 0, azimuth]) {
  38. rotate([0, (90 - elevation), 0]) {
  39. translate([0, 0, ambradius - height]) {
  40. // the capsule holder
  41. difference () {
  42. union () {
  43. // main capsule holder
  44. cylinder(r = radius + wall, h = height, $fn = facets);
  45. // ridge to stop capsule when inserted
  46. // translate(v = [0, 0, - (wall / 2)]) {
  47. // difference() {
  48. // cylinder(r = radius + wall, h = wall / 2, $fn = facets);
  49. // cylinder(r = radius - 0.4, h = wall / 2, $fn = facets);
  50. // }
  51. // }
  52. // the attachment point to the other capsules
  53. for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
  54. // connect with cylindrical beams, very pretty
  55. rotate(a = rot + twist, v = [0, 0, 1]) {
  56. if (connect == 0) {
  57. translate([radius - wall, 0, height - wall]) {
  58. rotate(a = 145, v = [0, 1, 0]) {
  59. cylinder(d = wall * 4, h = 6, center = false, $fn = facets);
  60. }
  61. }
  62. }
  63. // connect with flat square beams pointing out
  64. if (connect == 1) {
  65. translate([radius - wall, 3 * wall / 4, wall]) {
  66. rotate(a = 90, v = [0, 1, 0]) {
  67. difference() {
  68. cube([wall * 2, wall * 4, height * 4], center = true);
  69. translate([0, 0, wall * 8]) {
  70. cube([wall * 2, wall * 1.5, height], center = true);
  71. }
  72. }
  73. }
  74. }
  75. }
  76. // connect with flat square beams pointing in
  77. if (connect == 2) {
  78. translate([radius + fudge, - wall * 1.29 , - height]) {
  79. difference() {
  80. cube([wall * 2, wall * 4, height * 2], center = false);
  81. translate([0, wall * 1.25, - wall * 2]) {
  82. cube([wall * 2, wall * 1.5, height], center = false);
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. // make the hole for the capsule
  91. translate ([0, 0, -2]) {
  92. cylinder(r = radius + fudge, h = height + 2, $fn = facets);
  93. }
  94. // remove any extra connecting beam material from the face of the holder
  95. translate ([0, 0, height]) {
  96. cylinder(r = radius + wall * 2, h = 2, $fn = facets);
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
  103. // mounting stalk
  104. module stalk (radius_top, radius_bot, length, wall, separation) {
  105. // top cone
  106. translate([0, 0, -separation]) {
  107. difference() {
  108. cylinder(h = length, r1 = radius_bot, r2 = radius_top, center = true, $fn = 128);
  109. cylinder(h = length, r1 = radius_bot - wall, r2 = radius_top - wall, center = true, $fn=128);
  110. // carve out the two microphones, this is a hack
  111. translate([-(wall * 3), wall * 3, cap_sep * 1.5]) {
  112. rotate([0, 145 + 90, -45]) {
  113. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  114. }
  115. }
  116. translate([wall * 3, -(wall * 3), cap_sep * 1.5]) {
  117. rotate([0, 145 + 90, 135]) {
  118. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  119. }
  120. }
  121. }
  122. // mounting stalk
  123. translate([0, 0, -(1.5 * length)]) {
  124. difference() {
  125. cylinder(h = length * 2, r = radius_bot, center = true, $fn=128);
  126. cylinder(h = length * 2, r = radius_bot - wall, center = true, $fn=128);
  127. }
  128. }
  129. }
  130. }
  131. // vectors pointing in the directions of the four capsules
  132. direction1 = [1, 1, 1];
  133. direction2 = [-1, 1, -1];
  134. direction3 = [-1, -1, 1];
  135. direction4 = [1, -1, -1];
  136. dist = sqrt(3);
  137. // azimuths
  138. az1 = atan2(1, 1);
  139. az2 = atan2(1, -1);
  140. az3 = atan2(-1, -1);
  141. az4 = atan2(-1, 1);
  142. // elevations
  143. el1 = asin(1/dist);
  144. el2 = -asin(1/dist);
  145. el3 = asin(1/dist);
  146. el4 = -asin(1/dist);
  147. // dimensions for the EM182 electret microphone
  148. mic_radius = 5;
  149. mic_height = 4.5;
  150. // separation between capsules
  151. cap_sep = 7;
  152. // distance between face of capsule and center of array
  153. amb_radius = 11.5;
  154. // connect the four instances together
  155. if (rendermic == 1) {
  156. capsule(az1, el1, amb_radius, mic_radius, mic_height, 1, 60, 3);
  157. capsule(az2, el2, amb_radius, mic_radius, mic_height, 1, 240, 2);
  158. capsule(az3, el3, amb_radius, mic_radius, mic_height, 1, 60, 3);
  159. capsule(az4, el4, amb_radius, mic_radius, mic_height, 1, 240, 2);
  160. // the mount
  161. //stalk(mic_radius * 1.25, mic_radius * 2/3, 8, 1, 12);
  162. }
  163. // just one to test
  164. if (rendermic == 0) {
  165. capsule(0, 90, height, mic_radius, mic_height, 1, 0);
  166. }