SpHEAR_windscreen.scad 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // Spherical Harmonics Ear Project (*SpHEAR)
  3. //
  4. // Windscreen modules
  5. //
  6. // Copyright 2017, Fernando Lopez-Lezcano, All Rights Reserved
  7. // nando@ccrma.stanford.edu
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation, either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  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. // http://dkprojects.net/openscad-threads/
  26. // used for the windscreeen mount threads
  27. include <threads.scad>;
  28. ////
  29. //// default model parameters
  30. ////
  31. // windscreen frame
  32. module sphear_windscreen_frame(sides, radius, height, beam_radius, twist, heights) {
  33. inc = 360/sides;
  34. for (r = [0:inc:360]) for (t = [1, -1]) rotate([0, 0, r]) {
  35. render() {
  36. linear_extrude(height = height, center = false, convexity = 0, twist = twist * t, $fn = facets/2) {
  37. translate([radius, 0, 0]) {
  38. circle(r = beam_radius, $fn = facets/2);
  39. }
  40. }
  41. *if (t == -1) for (h = [1/3, 2/3, 1]) {
  42. rotate([0, 0, (inc/2) * (t - 1)]) translate([radius, 0, h * height]) {
  43. intersection() {
  44. scale([1.0, 1.55, 1.0]) {
  45. translate([0, 0, -beam_radius * 2]) {
  46. cylinder(r = beam_radius, h = beam_radius * 4, $fn = facets);
  47. }
  48. }
  49. scale([1, 2, 2.5]) sphere(r = beam_radius, $fn = facets);
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. // windscreen inset frame
  57. module sphear_windscreen_inset_frame(sides, radius, iradius, height, beam_radius, xscale = 1.0, yscale = 1.0) {
  58. inc = 360/sides;
  59. difference() {
  60. for (r = [0:inc:360]) for (t = [1, -1]) rotate([0, 0, r]) {
  61. render() {
  62. hull() {
  63. translate([iradius, 0, 0]) {
  64. scale([xscale, yscale, 1.0]) cylinder(r = beam_radius, h = thin_mint, $fn = facets);
  65. }
  66. rotate([0, 0, inc/2 * t]) translate([radius, 0, height]) {
  67. cylinder(r = beam_radius, h = thin_mint, $fn = facets);
  68. }
  69. }
  70. }
  71. }
  72. cylinder(r = iradius, h = height, $fn = facets);
  73. }
  74. }
  75. // windscreen frame reinforcements
  76. module sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, zrotation, yrotation) {
  77. for (r = [0:360/sides:360]) rotate([0, 0, r + zrotation]) {
  78. translate([radius, 0, 0]) {
  79. render() rotate([0, yrotation, 0]) intersection() {
  80. scale([1.0, 1.55, 1.0]) {
  81. translate([0, 0, -beam_radius * 2]) {
  82. cylinder(r = beam_radius, h = beam_radius * 4, $fn = facets);
  83. }
  84. }
  85. scale([1, 2, 2.5]) sphere(r = beam_radius, $fn = facets);
  86. }
  87. }
  88. }
  89. }
  90. // windscreen dome
  91. module sphear_windscreen_dome(sides, radius, beam_radius) {
  92. arcs = sides/2 - 1;
  93. ang = 360 / sides;
  94. difference() {
  95. for (r = [0, 90]) rotate([0, 0, r]) {
  96. for (t = [1, -1]) {
  97. translate([radius * sin(ang/2) * t, 0, 0]) rotate([0, 90, 0]) {
  98. render() rotate_extrude(convexity = 10, $fn = facets) {
  99. translate([radius * cos(ang/2), 0, 0]) {
  100. circle(r = beam_radius, $fn = facets);
  101. }
  102. }
  103. }
  104. translate([radius * sin(ang/(2/3)) * t, 0, 0]) rotate([0, 90, 0]) {
  105. render() rotate_extrude(convexity = 10, $fn = facets) {
  106. translate([radius * cos(ang/(2/3)), 0, 0]) {
  107. circle(r = beam_radius, $fn = facets);
  108. }
  109. }
  110. }
  111. }
  112. }
  113. brad = radius + 2 * beam_radius + thin_mint;
  114. translate([-brad, -brad, - 2 * brad]) {
  115. cube([2 * brad, 2 * brad, 2 * brad]);
  116. }
  117. }
  118. }
  119. // windscreen mount to body with thread
  120. module sphear_windscreen_mount(height, radius, beam_radius) {
  121. octagon_radius = (radius + 2 * beam_radius + wall) * cos(PI/8);
  122. difference() {
  123. cylinder(r = radius + 2 * beam_radius + windscreen_thread_depth, h = height, $fn = facets);
  124. metric_thread(diameter = radius * 2 + windscreen_thread_fit, pitch = windscreen_thread_pitch,
  125. length = height, angle = windscreen_thread_angle, internal = true);
  126. // make outside be a octagon instead of a circle
  127. rotate([0, 0, 22.5]) translate([0, 0, -thin_mint]) {
  128. difference() {
  129. cylinder(r = 1.5 * radius, h = height + 2 * thin_mint);
  130. cylinder(r = octagon_radius, h = height + 2 * thin_mint, $fn = 8);
  131. }
  132. }
  133. }
  134. // marker for center of screen
  135. translate([-(radius + wall), 0, 0]) {
  136. cylinder(r = 1.0, h = height, $fn = facets);
  137. }
  138. }
  139. // round windscreen mount to body with thread
  140. module sphear_windscreen_round_mount(height, radius, wall) {
  141. difference() {
  142. cylinder(r = radius + wall, h = height, $fn = facets);
  143. metric_thread(diameter = radius * 2 + windscreen_thread_fit, pitch = windscreen_thread_pitch,
  144. length = height, angle = windscreen_thread_angle, internal = true);
  145. }
  146. // add better attachment points for windscreen
  147. difference() {
  148. union() {
  149. cylinder(r = radius + 2 * wall, h = height/2, $fn = facets);
  150. translate([0, 0, height/2]) {
  151. cylinder(r1 = radius + 2 * wall, r2 = radius + wall, h = height/2, $fn = facets);
  152. }
  153. }
  154. cylinder(r = radius + wall, h = height, $fn = facets);
  155. }
  156. // marker for center of microphone
  157. translate([-(radius + 2 * wall), 0, 0]) {
  158. cylinder(r = 1.0, h = height/2, $fn = facets);
  159. }
  160. }