TinySpHEAR_H2N_common.scad 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. // dimensions of H2R recorder
  38. // width and depth at middle of ring
  39. h2n_width = 62.00;
  40. h2n_depth = 42.66;
  41. h2n_width_up = 57.0;
  42. h2n_column_height = 40;
  43. transition_height = 30;
  44. // measured = 11.50, should be 13.1 -> ratio =
  45. // h2n_side_radius = 18.2;
  46. h2n_side_radius = 18.4;
  47. h2n_side_band = 1.5;
  48. h2n_side_band_w = 13.4;
  49. h2n_width_m = 63.0;
  50. h2n_depth_m = 36.4;
  51. h2n_band_height = 6.0;
  52. // base band width
  53. h2n_band_wall = 1.6;
  54. // walls for the columns
  55. h2n_col_wall = 2 * wall;
  56. // tilt for the columnds
  57. h2n_col_tilt = 4.0;
  58. // radius of mount stalk
  59. h2n_mount_radius = mount_radius;
  60. // fit for connector from column to bridge
  61. h2n_mount_fit = 0.04;
  62. // bridge dimensions
  63. h2n_bridge_base_height = 6.0;
  64. h2n_bridge_stalk_height = 20.0;
  65. module tube(or, ir, h) {
  66. difference() {
  67. cylinder(r = or, h = h, $fn = facets);
  68. cylinder(r = ir, h = h, $fn = facets);
  69. }
  70. }
  71. // main support ring
  72. module h2n_ring(width, depth, radius, height, tilt, slot_w, slot_d, band_wall, wall, col_rad, col_wall) {
  73. // main support ring
  74. difference() {
  75. conical_rounded_box(height, width / 2 + band_wall, depth / 2 + band_wall, radius - thin_mint, band_wall, height * tan(tilt));
  76. for (m = [0, 1]) mirror([m, 0, 0]) {
  77. translate([-(width / 2 + col_rad - col_wall), 0, 0]) {
  78. tilted_cylinder(col_rad, height, height * tan(tilt));
  79. }
  80. }
  81. }
  82. // inner band
  83. difference() {
  84. conical_rounded_box(height, width / 2 + wall - h2n_side_band, depth / 2 + band_wall, radius - thin_mint, wall, height * tan(tilt));
  85. for (m = [0, 1]) mirror([m, 0, 0]) {
  86. // cut slots on the sides
  87. translate([-width / 2, -h2n_side_band_w / 2, 0]) {
  88. cube([width / 2, h2n_side_band_w, height + thin_mint]);
  89. }
  90. }
  91. }
  92. }
  93. // side columns
  94. module tilted_cylinder(radius, height, offset) {
  95. hull() {
  96. cylinder(r = radius, h = thin_mint, $fn = facets);
  97. translate([offset, 0, height]) {
  98. cylinder(r = radius, h = thin_mint, $fn = facets);
  99. }
  100. }
  101. }
  102. module tilted_rounded_box(height, width, depth, radius, wall, offset) {
  103. difference() {
  104. hull() {
  105. rounded_block(thin_mint, width, depth, radius);
  106. translate([offset, 0, height]) {
  107. rounded_block(thin_mint, width, depth, radius);
  108. }
  109. }
  110. hull() {
  111. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  112. translate([offset, 0, height]) {
  113. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  114. }
  115. }
  116. }
  117. }
  118. module conical_rounded_box(height, width, depth, radius, wall, inset) {
  119. difference() {
  120. hull() {
  121. rounded_block(thin_mint, width, depth, radius);
  122. translate([0, 0, height]) {
  123. rounded_block_relative(thin_mint, width, depth, radius, -inset);
  124. }
  125. }
  126. hull() {
  127. rounded_block_relative(thin_mint, width, depth, radius, -wall);
  128. translate([0, 0, height]) {
  129. rounded_block_relative(thin_mint, width, depth, radius, -(wall + inset));
  130. }
  131. }
  132. }
  133. }
  134. module tilted_cube(height, width, depth, offset) {
  135. hull() {
  136. cube([width, depth, thin_mint]);
  137. translate([offset, 0, height]) {
  138. cube([width, depth, thin_mint]);
  139. }
  140. }
  141. }
  142. module tilted_half_rounded_box(height, width, depth, radius, wall, offset, e = 0.1) {
  143. difference() {
  144. tilted_rounded_box(height, width, depth, radius, wall, offset);
  145. translate([0, -(depth + e), 0]) {
  146. tilted_cube(height, width + e, (depth + e) * 2, offset);
  147. }
  148. }
  149. }
  150. module half_rounded_box(height, width, depth, radius, wall, e = 0.1) {
  151. difference() {
  152. rounded_box(height, width , depth, radius, wall);
  153. translate([0, -(depth + e), 0]) {
  154. cube([width + e, 2 * (depth + e), height]);
  155. }
  156. }
  157. }
  158. module h2n_columns(width, height, ring_height, tilt, transition, radius, col_wall, wall) {
  159. // side tubes for cables
  160. slot_height = 25.0;
  161. for (m = [0, 1]) mirror([m, 0, 0]) {
  162. translate([-(width / 2 + radius - col_wall), 0, 0]) {
  163. difference() {
  164. // angled column
  165. tilted_cylinder(radius + col_wall, height, height * tan(tilt));
  166. tilted_cylinder(radius, height, height * tan(tilt));
  167. // slots in the columns for cables
  168. translate([radius - col_wall - ring_height * tan(tilt), - radius * 2, -ring_height]) {
  169. rotate([0, tilt, 0]) {
  170. cube([5.0, radius * 4, slot_height]);
  171. translate([radius + col_wall, radius - col_wall, slot_height]) {
  172. rotate([0, 90, 90]) {
  173. cylinder(r = radius + col_wall, h = 15.0, $fn = facets);
  174. }
  175. }
  176. }
  177. }
  178. // trim side of tubes with a vertical plane
  179. translate([-(radius * 2 + col_wall) + col_wall / 2, -(radius + col_wall), 0]) {
  180. cube([col_wall * 2, (radius + col_wall) * 2, 30]);
  181. }
  182. }
  183. // add a thicker wall at the bottom of the side trim
  184. difference() {
  185. translate([-(radius), -(radius + col_wall), 0]) {
  186. cube([wall, (radius + col_wall) * 2, 30]);
  187. }
  188. difference() {
  189. tilted_cylinder(radius * 4, height, height * tan(tilt));
  190. tilted_cylinder(radius + col_wall, height, height * tan(tilt));
  191. }
  192. }
  193. }
  194. // connector to bridge
  195. translate([-(width / 2 + radius - col_wall - height * tan(tilt)), 0, height]) {
  196. connector_height = 5.0;
  197. difference() {
  198. tube(radius + wall - h2n_mount_fit, radius, connector_height);
  199. translate([0, -(radius + wall), connector_height / 2]) {
  200. cube([radius + wall, (radius + wall) * 2, connector_height / 2]);
  201. }
  202. }
  203. }
  204. // side sleeves
  205. sleeve_height = slot_height - mount_radius - col_wall;
  206. for (m = [0, 1]) mirror([m, 0, 0]) {
  207. // we should derive the geometry for the aligment magic below...
  208. side_fit = 1.05;
  209. translate([-(width / 2 - (radius + col_wall) / 2 + wall - side_fit), 0, 0]) {
  210. difference() {
  211. tilted_half_rounded_box(sleeve_height, 3.8, h2n_side_band_w / 2 + wall, 2.0, wall, sleeve_height * tan(tilt));
  212. translate([col_wall / 2 + wall - radius * 3 / 2 - side_fit, 0, 0]) {
  213. tilted_cylinder(radius, height, height * tan(tilt));
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. // bridge that connects to capsule array
  221. module semi_cylinder(r, h, e = thin_mint) {
  222. difference() {
  223. cylinder(h, r, r, $fn = facets);
  224. translate ([-(r+e)*2, -r, 0])
  225. cube([2*(r+e), 2*(r+e), h]);
  226. }
  227. }
  228. module quarter_sphere(r, e = thin_mint) {
  229. difference() {
  230. sphere(r, $fn = facets);
  231. translate([-(r+e), -(r+e), -(r+e)])
  232. cube([2*(r+e), 2*(r+e), r+e]);
  233. translate([-(r+e), -(r+e), -e])
  234. cube([r, 2*(r+e), (r+e)]);
  235. }
  236. }
  237. module cylcube(width, depth, height, wall) {
  238. difference() {
  239. semi_cylinder(r = depth, h = height);
  240. semi_cylinder(r = depth - wall, h = height);
  241. }
  242. translate([-(width + depth / 2), -depth, 0]) {
  243. difference() {
  244. cube([(width + depth / 2), depth * 2, height]);
  245. translate([0, wall, 0]) {
  246. cube([(width + depth), (depth - wall) * 2, height]);
  247. }
  248. }
  249. }
  250. }
  251. module h2n_bridge(width, base_height, stalk_height, radius, col_wall, wall) {
  252. // capsule array mount
  253. translate([0, 0, base_height + stalk_height]) {
  254. tetra_capsule_array_mount([-45, 135]);
  255. }
  256. // stalk
  257. translate([0, 0, base_height]) {
  258. difference() {
  259. tube(radius + wall, radius, stalk_height);
  260. // remove stalk segment that is inside the bridge
  261. translate([width / 2, 0, -1.0]) {
  262. rotate([0, -90, 0]) {
  263. semi_cylinder(r = radius + col_wall, h = width);
  264. }
  265. }
  266. }
  267. }
  268. // top of bridge
  269. translate([width / 2, 0, base_height]) {
  270. rotate([0, -90, 0]) {
  271. difference() {
  272. // curvy ceiling
  273. semi_cylinder(r = radius + col_wall, h = width);
  274. semi_cylinder(r = radius + col_wall - wall, h = width);
  275. // make a hole for the cables
  276. translate([0, 0, width / 2]) {
  277. rotate([0, 90, 0]) {
  278. cylinder(r = radius, h = 10, $fn = facets);
  279. }
  280. }
  281. }
  282. }
  283. }
  284. // caps at ends
  285. for (m = [0, 1]) mirror([m, 0, 0]) {
  286. translate([width / 2, 0, base_height]) {
  287. difference() {
  288. quarter_sphere(r = radius + col_wall);
  289. quarter_sphere(r = radius + col_wall - wall);
  290. }
  291. }
  292. }
  293. // base of bridge
  294. translate([0, 0, 0]) {
  295. for (m = [0, 1]) mirror([m, 0, 0]) {
  296. translate([width / 2, 0, 0]) {
  297. cylcube(width / 2, radius + col_wall, base_height, wall);
  298. }
  299. }
  300. }
  301. // reinforcement beams at the base
  302. translate([-col_wall / 2, -(radius + wall), 0]) {
  303. cube([col_wall, (radius + wall) * 2, col_wall]);
  304. }
  305. for (m = [0, 1]) mirror([m, 0, 0]) {
  306. translate([-width / 2 + radius + wall, -(radius + wall), 0]) {
  307. cube([col_wall, (radius + wall) * 2, col_wall]);
  308. }
  309. }
  310. }
  311. // render the whole thing
  312. difference() {
  313. union() {
  314. h2n_ring(h2n_width_m, h2n_depth_m, h2n_depth * 0.425, h2n_band_height, h2n_col_tilt,
  315. h2n_side_band_w, h2n_side_band, h2n_band_wall, wall, mount_radius, h2n_col_wall);
  316. h2n_columns(h2n_width_m, h2n_column_height, h2n_band_height, h2n_col_tilt,
  317. transition_height, h2n_mount_radius, h2n_col_wall, wall);
  318. translate([0, 0, h2n_column_height]) {
  319. h2n_bridge((h2n_width_m / 2 + mount_radius - h2n_col_wall - h2n_column_height * tan(h2n_col_tilt)) * 2,
  320. h2n_bridge_base_height, h2n_bridge_stalk_height, mount_radius, h2n_col_wall, wall);
  321. }
  322. rotate([0, 0, 0]) {
  323. render_tetra_capsule_array(h2n_column_height + h2n_bridge_base_height + h2n_bridge_stalk_height + 27);
  324. }
  325. }
  326. *translate([-40, -50, 0]) {
  327. cube([80, 50, 80]);
  328. }
  329. }
  330. // make sure dimensions are fine
  331. *translate([-(h2n_width_m - 0.1) / 2, - 0.5, 0]) {
  332. cube([h2n_width_m - 0.1, 1, 1]);
  333. }
  334. *translate([-0.5, -(h2n_depth_m - 0.1) / 2, 0]) {
  335. cube([1, h2n_depth_m - 0.1, 1]);
  336. }
  337. // some tests with traced profiles
  338. *difference() {
  339. translate([0, -2.5, 0]) {
  340. scale([2.15, 2.15, 1.0]) {
  341. H2N_top_up_outline(5.0);
  342. }
  343. }
  344. // scale([1.75, 1.75, 1.0]) {
  345. translate([0, -2.4, 0]) {
  346. scale([2.02, 2.02, 1.0]) {
  347. H2N_top_up_outline(5.0);
  348. }
  349. }
  350. }
  351. *scale(1.665) {
  352. translate([0, 10, -0]) {
  353. rotate([0, 0, 0]) {
  354. H2N_front_outline(1.0);
  355. }
  356. }
  357. }
  358. *rotate([0, 0, 4]) translate([35, 0, 0])
  359. cube([2, 80, 4]);