1
0

TinySpHEAR_H2N_common.scad 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. //
  2. // Spherical Harmonics Ear Project (*SpHEAR)
  3. //
  4. // TinySpHEAR, First Order (B-format) Ambisonics Microphone
  5. // Common files for H2N add-on array
  6. //
  7. // Copyright 2016, Fernando Lopez-Lezcano, All Rights Reserved
  8. // nando@ccrma.stanford.edu
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. // 3d Models released under the Creative Commons license as follows:
  24. // Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
  25. // http://creativecommons.org/licenses/by-nc-sa/4.0/
  26. include <SpHEAR_common.scad>;
  27. include <TinySpHEAR_common.scad>;
  28. include <TinySpHEAR_mount_pcb.scad>;
  29. // outline of H2N front
  30. // include<h2n/H2N_front_outline.scad>;
  31. // outline of H2N top
  32. // include<h2n/H2N_top_up_outline.scad>;
  33. // dimensions of the EM200 electret microphone capsule (measured 14.59 max)
  34. capsule_radius = 14.6 / 2;
  35. capsule_height = 4.75;
  36. mic_radius = 11;
  37. // adjust the depth of slots in mount
  38. mic_to_mount_fit = -0.4;
  39. // make triangular legs have the height of the capsule
  40. connect = 1;
  41. leg_thick = capsule_height;
  42. // dimensions of H2R recorder
  43. // width and depth at middle of ring
  44. h2n_width = 62.00;
  45. h2n_depth = 42.66;
  46. h2n_width_up = 57.0;
  47. h2n_column_height = 40;
  48. transition_height = 30;
  49. // measured = 11.50, should be 13.1 -> ratio =
  50. // h2n_side_radius = 18.2;
  51. h2n_side_radius = 18.4;
  52. h2n_side_band = 1.5;
  53. h2n_side_band_w = 13.4;
  54. h2n_width_m = 63.0;
  55. h2n_depth_m = 36.4;
  56. h2n_band_height = 6.0;
  57. // base band width
  58. h2n_band_wall = 1.6;
  59. // walls for the columns
  60. h2n_col_wall = 2 * wall;
  61. // tilt for the columnds
  62. h2n_col_tilt = 4.0;
  63. // radius of mount stalk
  64. h2n_mount_radius = mount_radius;
  65. // fit for connector from column to bridge
  66. h2n_mount_fit = 0.04;
  67. // bridge dimensions
  68. h2n_bridge_base_height = 6.0;
  69. h2n_bridge_stalk_height = 30.0;
  70. module tube(or, ir, h) {
  71. difference() {
  72. cylinder(r = or, h = h, $fn = facets);
  73. cylinder(r = ir, h = h, $fn = facets);
  74. }
  75. }
  76. // main support ring
  77. module h2n_ring(width, depth, radius, height, tilt, slot_w, slot_d, band_wall, wall, col_rad, col_wall) {
  78. // main support ring
  79. difference() {
  80. conical_rounded_box(height, width / 2 + band_wall, depth / 2 + band_wall, radius - thin_mint, band_wall, height * tan(tilt));
  81. for (m = [0, 1]) mirror([m, 0, 0]) {
  82. translate([-(width / 2 + col_rad - col_wall), 0, 0]) {
  83. tilted_cylinder(col_rad, height, height * tan(tilt));
  84. }
  85. }
  86. }
  87. // inner band
  88. difference() {
  89. conical_rounded_box(height, width / 2 + wall - h2n_side_band, depth / 2 + band_wall, radius - thin_mint, wall, height * tan(tilt));
  90. for (m = [0, 1]) mirror([m, 0, 0]) {
  91. // cut slots on the sides
  92. translate([-width / 2, -h2n_side_band_w / 2, 0]) {
  93. cube([width / 2, h2n_side_band_w, height + thin_mint]);
  94. }
  95. }
  96. }
  97. }
  98. // side columns
  99. module tilted_cylinder(radius, height, offset) {
  100. hull() {
  101. cylinder(r = radius, h = thin_mint, $fn = facets);
  102. translate([offset, 0, height]) {
  103. cylinder(r = radius, h = thin_mint, $fn = facets);
  104. }
  105. }
  106. }
  107. module tilted_rounded_box(height, width, depth, radius, wall, offset) {
  108. difference() {
  109. hull() {
  110. rounded_block(thin_mint, width, depth, radius);
  111. translate([offset, 0, height]) {
  112. rounded_block(thin_mint, width, depth, radius);
  113. }
  114. }
  115. hull() {
  116. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  117. translate([offset, 0, height]) {
  118. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  119. }
  120. }
  121. }
  122. }
  123. module conical_rounded_box(height, width, depth, radius, wall, inset) {
  124. difference() {
  125. hull() {
  126. rounded_block(thin_mint, width, depth, radius);
  127. translate([0, 0, height]) {
  128. rounded_block_relative(thin_mint, width, depth, radius, -inset);
  129. }
  130. }
  131. hull() {
  132. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  133. translate([0, 0, height]) {
  134. rounded_block_relative(thin_mint, width, depth, radius, -(wall + inset));
  135. }
  136. }
  137. }
  138. }
  139. module tilted_cube(width, depth, height, offset) {
  140. hull() {
  141. cube([width, depth, thin_mint]);
  142. translate([offset, 0, height]) {
  143. cube([width, depth, thin_mint]);
  144. }
  145. }
  146. }
  147. module tilted_half_rounded_box(height, width, depth, radius, wall, offset, e = 0.1) {
  148. difference() {
  149. tilted_rounded_box(height, width, depth, radius, wall, offset);
  150. translate([0, -(depth + e), 0]) {
  151. tilted_cube(width + e, (depth + e) * 2, height, offset);
  152. }
  153. }
  154. }
  155. module half_rounded_box(height, width, depth, radius, wall, e = 0.1) {
  156. difference() {
  157. rounded_box(height, width , depth, radius, wall);
  158. translate([0, -(depth + e), 0]) {
  159. cube([width + e, 2 * (depth + e), height]);
  160. }
  161. }
  162. }
  163. module h2n_columns(width, height, ring_height, tilt, transition, radius, col_wall, wall) {
  164. // side tubes for cables
  165. slot_height = 25.0;
  166. for (m = [0, 1]) mirror([m, 0, 0]) {
  167. translate([-(width / 2 + radius - col_wall), 0, 0]) {
  168. difference() {
  169. // angled column
  170. tilted_cylinder(radius + col_wall, height, height * tan(tilt));
  171. tilted_cylinder(radius, height, height * tan(tilt));
  172. // slots in the columns for cables
  173. translate([radius - col_wall - ring_height * tan(tilt), - radius * 2, -ring_height]) {
  174. rotate([0, tilt, 0]) {
  175. cube([5.0, radius * 4, slot_height]);
  176. translate([radius + col_wall, radius - col_wall, slot_height]) {
  177. rotate([0, 90, 90]) {
  178. cylinder(r = radius + col_wall, h = 15.0, $fn = facets);
  179. }
  180. }
  181. }
  182. }
  183. // trim side of tubes with a vertical plane
  184. translate([-(radius * 2 + col_wall) + col_wall / 2, -(radius + col_wall), 0]) {
  185. cube([col_wall * 2, (radius + col_wall) * 2, 30]);
  186. }
  187. }
  188. // add a thicker wall at the bottom of the side trim
  189. difference() {
  190. translate([-(radius), -(radius + col_wall), 0]) {
  191. cube([wall, (radius + col_wall) * 2, 30]);
  192. }
  193. difference() {
  194. tilted_cylinder(radius * 4, height, height * tan(tilt));
  195. tilted_cylinder(radius + col_wall, height, height * tan(tilt));
  196. }
  197. }
  198. }
  199. // connector to bridge
  200. translate([-(width / 2 + radius - col_wall - height * tan(tilt)), 0, height]) {
  201. connector_height = 5.0;
  202. difference() {
  203. tube(radius + wall - h2n_mount_fit, radius, connector_height);
  204. translate([0, -(radius + wall), connector_height / 2]) {
  205. cube([radius + wall, (radius + wall) * 2, connector_height / 2]);
  206. }
  207. }
  208. }
  209. // side sleeves
  210. sleeve_height = slot_height - mount_radius - col_wall;
  211. for (m = [0, 1]) mirror([m, 0, 0]) {
  212. // we should derive the geometry for the aligment magic below...
  213. side_fit = 1.05;
  214. translate([-(width / 2 - (radius + col_wall) / 2 + wall - side_fit), 0, 0]) {
  215. difference() {
  216. tilted_half_rounded_box(sleeve_height, 3.8, h2n_side_band_w / 2 + wall, 2.0, wall, sleeve_height * tan(tilt));
  217. translate([col_wall / 2 + wall - radius * 3 / 2 - side_fit, 0, 0]) {
  218. tilted_cylinder(radius, height, height * tan(tilt));
  219. }
  220. }
  221. }
  222. }
  223. }
  224. }
  225. // bridge that connects to capsule array
  226. module semi_cylinder(r, h, e = thin_mint) {
  227. difference() {
  228. cylinder(h, r, r, $fn = facets);
  229. translate ([-r*2, -r, 0])
  230. cube([2*(r+e), 2*(r+e), h]);
  231. }
  232. }
  233. module quarter_sphere(r, e = thin_mint) {
  234. difference() {
  235. sphere(r, $fn = facets);
  236. translate([-(r+e), -(r+e), -(r+e)])
  237. cube([2*(r+e), 2*(r+e), r+e]);
  238. translate([-(r+e), -(r+e), -e])
  239. cube([r, 2*(r+e), (r+e)]);
  240. }
  241. }
  242. module cylcube(width, depth, height, wall) {
  243. difference() {
  244. semi_cylinder(r = depth, h = height);
  245. semi_cylinder(r = depth - wall, h = height);
  246. }
  247. translate([-(width + depth / 2), -depth, 0]) {
  248. difference() {
  249. cube([(width + depth / 2), depth * 2, height]);
  250. translate([0, wall, 0]) {
  251. cube([(width + depth), (depth - wall) * 2, height]);
  252. }
  253. }
  254. }
  255. }
  256. module h2n_bridge(width, base_height, stalk_height, radius, col_wall, wall) {
  257. // capsule array mount
  258. translate([0, 0, base_height + stalk_height]) {
  259. tetra_capsule_array_mount([-45, 135]);
  260. }
  261. // stalk
  262. translate([0, 0, base_height]) {
  263. difference() {
  264. tube(radius + wall, radius, stalk_height);
  265. // remove stalk segment that is inside the bridge
  266. translate([width / 2, 0, -1.0]) {
  267. rotate([0, -90, 0]) {
  268. semi_cylinder(r = radius + col_wall, h = width);
  269. }
  270. }
  271. }
  272. }
  273. // top of bridge
  274. translate([width / 2, 0, base_height]) {
  275. rotate([0, -90, 0]) {
  276. difference() {
  277. // curvy ceiling
  278. semi_cylinder(r = radius + col_wall, h = width);
  279. semi_cylinder(r = radius + col_wall - wall, h = width);
  280. // make a hole for the cables
  281. translate([0, 0, width / 2]) {
  282. rotate([0, 90, 0]) {
  283. cylinder(r = radius, h = 10, $fn = facets);
  284. }
  285. }
  286. }
  287. }
  288. }
  289. // caps at ends
  290. for (m = [0, 1]) mirror([m, 0, 0]) {
  291. translate([width / 2, 0, base_height]) {
  292. difference() {
  293. quarter_sphere(r = radius + col_wall);
  294. quarter_sphere(r = radius + col_wall - wall);
  295. }
  296. }
  297. }
  298. // base of bridge
  299. translate([0, 0, 0]) {
  300. for (m = [0, 1]) mirror([m, 0, 0]) {
  301. translate([width / 2, 0, 0]) {
  302. cylcube(width / 2, radius + col_wall, base_height, wall);
  303. }
  304. }
  305. }
  306. // reinforcement beams at the base
  307. translate([-col_wall / 2, -(radius + wall), 0]) {
  308. cube([col_wall, (radius + wall) * 2, col_wall]);
  309. }
  310. for (m = [0, 1]) mirror([m, 0, 0]) {
  311. translate([-width / 2 + radius + wall, -(radius + wall), 0]) {
  312. cube([col_wall, (radius + wall) * 2, col_wall]);
  313. }
  314. }
  315. }
  316. // render the whole thing
  317. difference() {
  318. union() {
  319. *h2n_ring(h2n_width_m, h2n_depth_m, h2n_depth * 0.425, h2n_band_height, h2n_col_tilt,
  320. h2n_side_band_w, h2n_side_band, h2n_band_wall, wall, mount_radius, h2n_col_wall);
  321. *h2n_columns(h2n_width_m, h2n_column_height, h2n_band_height, h2n_col_tilt,
  322. transition_height, h2n_mount_radius, h2n_col_wall, wall);
  323. //translate([0, 0, h2n_column_height]) {
  324. *h2n_bridge((h2n_width_m / 2 + mount_radius - h2n_col_wall - h2n_column_height * tan(h2n_col_tilt)) * 2,
  325. h2n_bridge_base_height, h2n_bridge_stalk_height, mount_radius, h2n_col_wall, wall);
  326. //}
  327. *rotate([0, 0, 0]) {
  328. render_tetra_capsule_array(h2n_column_height + h2n_bridge_base_height + h2n_bridge_stalk_height + 27);
  329. }
  330. }
  331. *translate([-40, -50, 0]) {
  332. cube([80, 50, 80]);
  333. }
  334. }
  335. // individual capsule holders
  336. *render_tetra_capsule_top(0);
  337. *render_tetra_capsule_bot(0);
  338. // make sure dimensions are fine
  339. *translate([-(h2n_width_m - 0.1) / 2, - 0.5, 0]) {
  340. cube([h2n_width_m - 0.1, 1, 1]);
  341. }
  342. *translate([-0.5, -(h2n_depth_m - 0.1) / 2, 0]) {
  343. cube([1, h2n_depth_m - 0.1, 1]);
  344. }
  345. // some tests with traced profiles
  346. *difference() {
  347. translate([0, -2.5, 0]) {
  348. scale([2.15, 2.15, 1.0]) {
  349. H2N_top_up_outline(5.0);
  350. }
  351. }
  352. // scale([1.75, 1.75, 1.0]) {
  353. translate([0, -2.4, 0]) {
  354. scale([2.02, 2.02, 1.0]) {
  355. H2N_top_up_outline(5.0);
  356. }
  357. }
  358. }
  359. *scale(1.665) {
  360. translate([0, 10, -0]) {
  361. rotate([0, 0, 0]) {
  362. H2N_front_outline(1.0);
  363. }
  364. }
  365. }
  366. *rotate([0, 0, 4]) translate([35, 0, 0])
  367. cube([2, 80, 4]);