| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- //
- // SphEAR, First Order (B-format) Ambisonics Microphone
- //
- // Copyright 2015, Fernando Lopez-Lezcano, All Rights Reserved
- //
- // Source code released under the GNU GPL License
- // http://www.gnu.org/licenses/gpl-3.0.en.html
- //
- // 3d models released under Creative Commons Non-Commercial Share-Alike
- // CC-NC-SA 3.0
- // http://creativecommons.org/licenses/by-nc-sa/3.0/
- //
- // https://en.wikipedia.org/wiki/Tetrahedron
- // angle capsule to vertical = atan(sqrt(2)) = 54.7356103172
- ////
- //// model parameters
- // dimensions of the EM182 electret microphone
- capsule_radius = 5;
- capsule_height = 4.5;
- // distance between face of capsule and center of array
- mic_radius = 10;
- // dimensions of capsule holder connection legs
- leg_width = 4;
- leg_thick = 2.5;
- // dimensions of microphone holder
- mount_radius = 3;
- // height of mount
- mount_height = 4;
- //// end of model parameters
- ////
- //// rendering control
- // what to render:
- // 0 -> ready to print
- // set = 0 -> one capsule, set = 1 -> four capsules
- // 1 -> the whole microhone with four capsules
- rendermic = 1;
- renderset = 0;
- // what type of connection between capsule holders:
- // 0 -> original cylinder beams
- // 1 -> interlocking beams (out)
- // 2 -> interlocking beams (in)
- connect = 1;
- //// end of rendering control
- ////
- // adjustment for the size of the capsule
- // (measured inside diameter was around 7.5 to 8.2 instead of 10, capsule diameter was 9.99)
- fudge = 0.15;
- // adjustment for fit of slots
- fit = 0.2;
- // wall thickness of cylinders
- wall = 1;
- // number of facets for cylinders
- facets = 64;
- // width of the ridge that connects to the mount
- ridge_width = 2;
- ridge_length = 3;
- // the rest of the leg geometry
- tetra = atan(sqrt(2));
- leg_length =
- connect == 0 ?
- mic_radius * sin(tetra) - capsule_radius * cos(tetra) :
- connect == 1 ?
- (mic_radius - capsule_height + leg_thick) * sin(tetra) / sin(90 - tetra) - capsule_radius :
- mic_radius - (capsule_radius / sqrt(2));
- slot_depth = connect == 1 ?
- leg_thick * 1.5 : leg_thick;
- // holder geometry
- capsule_sep_min = mic_radius * sin(tetra) - capsule_radius * cos(tetra);
- capsule_sep_max = capsule_sep_min + capsule_height * sin(tetra);
- capsule_bottom = mic_radius * cos(tetra) + capsule_radius * sin(tetra);
- ////////
- // microphone capsule holder
- // azimuth: orientation of the capsule
- // elevation: orientation of the capsure
- // twist: adjust the angle of the mounts so they match
- // mounts: number of mounts to create (2 or 3)
- module capsule (azimuth, elevation, twist, mounts) {
- rotate([0, 0, azimuth]) {
- rotate([0, (90 - elevation), 0]) {
- translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
- // the capsule holder
- difference () {
- union () {
- // main capsule holder
- cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
- // the attachment point to the other capsules
- for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
- rotate(a = rot + twist, v = [0, 0, 1]) {
- // connect with cylindrical beams, very pretty
- if (connect == 0) {
- translate([capsule_radius - wall, 0, capsule_height - wall]) {
- rotate([0, 90 + tetra, 0]) {
- cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
- }
- }
- }
- // connect with horizontal legs
- if (connect == 1) {
- translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
- rotate([0, -90, 0]) {
- difference() {
- // thickness, width
- cube([leg_thick, leg_width, leg_length]);
- // cut slot in connector
- translate([0, leg_width / 3 - (fit / 2), 0]) {
- cube([leg_thick, leg_width / 3 + fit, slot_depth]);
- }
- }
- }
- }
- }
- // connect with vertical legs
- if (connect == 2) {
- translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
- difference() {
- // thickness, width
- cube([leg_thick, leg_width, leg_length]);
- // cut slot in connector
- translate([0, leg_width / 3 - (fit / 2), 0]) {
- cube([leg_thick, leg_width / 3 + fit, slot_depth]);
- }
- }
- }
- }
- }
- }
- // add ridges for microphone mount
- if (mounts == 2) {
- rotate(a = 120 + twist, v = [0, 0, 1]) {
- translate([capsule_radius + fudge, - wall , 0]) {
- difference() {
- cube([ridge_length, ridge_width, capsule_height], center = false);
- rotate([0, tetra, 0]) {
- cube([ridge_length, ridge_width, capsule_height], center = false);
- }
- }
- }
- }
- }
- }
- // make the hole for the capsule
- translate ([0, 0, -2]) {
- cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
- }
- // remove any extra connecting beam material from the face of the holder
- if (connect == 0) {
- translate ([0, 0, capsule_height]) {
- cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
- }
- }
- }
- }
- }
- }
- }
- // microphone mount
- module mount (radius, length, wall, separation) {
- translate([0, 0, -(separation + 1)]) {
- difference() {
- union() {
- for (rot = [0 : 180 : 360]) {
- rotate([0, 0, rot - 45]) {
- translate([-(capsule_sep_max / 2), (ridge_width / 2) + fit, -mount_height]) {
- cube([capsule_sep_max, ridge_width / 2, mount_height]);
- }
- }
- }
- translate([0, 0, -mount_height]) {
- cylinder(r = mount_radius + wall, h = mount_height, $fn = facets);
- }
- }
- translate([0, 0, -mount_height]) {
- cylinder(r = mount_radius, h = mount_height, $fn = facets); }
- rotate([0, 0, -45]) {
- translate([-(capsule_sep_max / 2), 0, -mount_height]) {
- cube([capsule_sep_max, ridge_width / 2, mount_height]);
- }
- }
- }
- }
- }
- module mount_old (radius, length, wall, separation) {
- // mounting ring
- translate([0, 0, -separation]) {
- difference() {
- union() {
- cylinder(h = length, r = radius, center = true, $fn=128);
- // connection ridges
- for (rot = [0 : 180 : 360]) {
- rotate([0, 0, rot - 45]) {
- translate([0, - wall * 3 - fit, - length / 2]) {
- difference() {
- cube([wall * 6, wall * 2, length], center = false);
- }
- }
- translate([0, wall + fit, - length / 2]) {
- difference() {
- cube([wall * 6, wall * 2, length], center = false);
- }
- }
- }
- }
- }
- // the bore of the ring
- cylinder(h = length, r = radius - wall, center = true, $fn=128);
- // create the slopes in the ridges
- for (rot = [0 : 180 : 360]) {
- rotate([0, 0, rot]) {
- translate([- radius, radius, 3.5]) {
- rotate([tetra, 0, 45]) {
- cube([radius * 3, radius, radius * 3], center = true);
- }
- }
- }
- }
- }
- }
- }
- // some constants
- vang = atan(sqrt(2));
- // vectors pointing in the directions of the four capsules
- direction1 = [1, 1, 1];
- direction2 = [-1, 1, -1];
- direction3 = [-1, -1, 1];
- direction4 = [1, -1, -1];
- dist = sqrt(3);
- // azimuths
- az1 = atan2(1, 1);
- az2 = atan2(1, -1);
- az3 = atan2(-1, -1);
- az4 = atan2(-1, 1);
- // elevations
- el1 = asin(1/dist);
- el2 = -asin(1/dist);
- el3 = asin(1/dist);
- el4 = -asin(1/dist);
- // connect the four instances together
- if (rendermic == 1) {
- capsule(az1, el1, 60, 3);
- capsule(az2, el2, 240, 2);
- capsule(az3, el3, 60, 3);
- capsule(az4, el4, 240, 2);
- // the mount
- mount(hold_radius, capsule_height, 1, capsule_bottom);
- }
- part_sep = capsule_radius * 2 * 3;
- echo("az = ", az1, az2, az3, az4, "elev = ", el1, el2, el3, el4);
- // just one to test
- if (rendermic == 0) {
- capsule(0, 90, 0, 3);
- //translate([0, part_sep, 0]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
- //translate([part_sep, 0, 0]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
- //translate([part_sep, part_sep]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
- }
|