first_order.scad 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 = 12.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.15;
  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. // the attachment point to the other capsules
  54. for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
  55. // connect with cylindrical beams, very pretty
  56. rotate(a = rot + twist, v = [0, 0, 1]) {
  57. if (connect == 0) {
  58. translate([radius - wall, 0, height - wall]) {
  59. rotate(a = 145, v = [0, 1, 0]) {
  60. cylinder(d = wall * 4, h = 6, center = false, $fn = facets);
  61. }
  62. }
  63. }
  64. // connect with flat square beams pointing out
  65. if (connect == 1) {
  66. translate([radius - wall, 3 * wall / 4, wall]) {
  67. rotate(a = 90, v = [0, 1, 0]) {
  68. difference() {
  69. cube([wall * 2, wall * 4, height * 4], center = true);
  70. translate([0, 0, wall * 8]) {
  71. cube([wall * 2, wall * 1.5, height], center = true);
  72. }
  73. }
  74. }
  75. }
  76. }
  77. // connect with flat square beams pointing in
  78. if (connect == 2) {
  79. translate([radius + fudge, - wall * 1.29 , - height]) {
  80. difference() {
  81. cube([wall * 3, wall * 4, height * 2], center = false);
  82. translate([0, wall * 1.25, - wall * 2]) {
  83. cube([wall * 3, wall * 1.5, height], center = false);
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. // make the hole for the capsule
  92. translate ([0, 0, -2]) {
  93. cylinder(r = radius + fudge, h = height + 2, $fn = facets);
  94. }
  95. // remove any extra connecting beam material from the face of the holder
  96. translate ([0, 0, height]) {
  97. cylinder(r = radius + wall * 2, h = 2, $fn = facets);
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. // mounting stalk
  105. module stalk (radius_top, radius_bot, length, wall, separation) {
  106. // top cone
  107. translate([0, 0, -separation]) {
  108. difference() {
  109. cylinder(h = length, r1 = radius_bot, r2 = radius_top, center = true, $fn = 128);
  110. cylinder(h = length, r1 = radius_bot - wall, r2 = radius_top - wall, center = true, $fn=128);
  111. // carve out the two microphones, this is a hack
  112. translate([-(wall * 3), wall * 3, cap_sep * 1.5]) {
  113. rotate([0, 145 + 90, -45]) {
  114. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  115. }
  116. }
  117. translate([wall * 3, -(wall * 3), cap_sep * 1.5]) {
  118. rotate([0, 145 + 90, 135]) {
  119. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  120. }
  121. }
  122. }
  123. // mounting stalk
  124. translate([0, 0, -(1.5 * length)]) {
  125. difference() {
  126. cylinder(h = length * 2, r = radius_bot, center = true, $fn=128);
  127. cylinder(h = length * 2, r = radius_bot - wall, center = true, $fn=128);
  128. }
  129. }
  130. }
  131. }
  132. // vectors pointing in the directions of the four capsules
  133. direction1 = [1, 1, 1];
  134. direction2 = [-1, 1, -1];
  135. direction3 = [-1, -1, 1];
  136. direction4 = [1, -1, -1];
  137. dist = sqrt(3);
  138. // azimuths
  139. az1 = atan2(1, 1);
  140. az2 = atan2(1, -1);
  141. az3 = atan2(-1, -1);
  142. az4 = atan2(-1, 1);
  143. // elevations
  144. el1 = asin(1/dist);
  145. el2 = -asin(1/dist);
  146. el3 = asin(1/dist);
  147. el4 = -asin(1/dist);
  148. // connect the four instances together
  149. if (rendermic == 1) {
  150. capsule(az1, el1, amb_radius, mic_radius, mic_height, 1, 60, 3);
  151. capsule(az2, el2, amb_radius, mic_radius, mic_height, 1, 240, 2);
  152. capsule(az3, el3, amb_radius, mic_radius, mic_height, 1, 60, 3);
  153. capsule(az4, el4, amb_radius, mic_radius, mic_height, 1, 240, 2);
  154. // the mount
  155. //stalk(mic_radius * 1.25, mic_radius * 2/3, 8, 1, 12);
  156. }
  157. part_sep = mic_radius * 2 * 3;
  158. // just one to test
  159. if (rendermic == 0) {
  160. capsule(0, 270, height, mic_radius, mic_height, 1, 0);
  161. translate([0, part_sep, 0]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
  162. translate([part_sep, 0, 0]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
  163. translate([part_sep, part_sep]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
  164. }