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