First draft for clippy sonar
[challenge-bot] / 3d-printables / sonar-table-top-holder-data.scad
1 /*
2 Copyright (C) 2015 Daniel Watson
3 See the end of the file for license conditions.
4 */
5 // challenge-bot
6 // GNU AGPLv3 (or later at your option)
7 // project available here:
8 // https://challenge-bot.com/
9
10 /*
11 this holds an hc-sr04 sonar sensor to a 3/16 inch deck.
12 http://fritzing.org/projects/hc-sr04-project
13 it can hold the sonar sensor either facing down, or forwards.
14 when facing down, it can detect if it passes over the edge of a table.
15 when facing forwards, it can detect and follow something in front of it.
16 */
17
18 $fn = 60;
19
20 // 3/16 inch in mm deck_depth = 4.7625;
21 // 1/4 inch in mm = 6.35
22 // subtract a little to be a squeeze fit
23 deck_depth = 4.7625 - 0.4;
24 // sonar sensor measurements taken with calipers:
25 // 10.82 in between, 42.33 outside, 15.82 diameter
26 // measured diameter of 15.82 with calipers,
27 // but when printed ends up being too small, so add some
28 sonar_diameter = 15.82 + 0.4;
29 sonar_radius = sonar_diameter / 2;
30 sonar_height = 13.8;
31 between_sonar_centers = sonar_diameter + 10.82;
32 // the sonar cylinders are placed on the pcb at slightly different positions
33 // from one sensor to the next, so this allows for that variance.
34 between_sonar_centers_variance = 2;
35 // keep at least this much plastic surrounding the sonar cylinder on all sides
36 buffer = 3;
37 binder_clip_attacher_length = 30; // not measured; just a rough estimate
38 screw_hole = 2.2;
39 sonar_holder_length = buffer + between_sonar_centers + sonar_diameter + buffer + binder_clip_attacher_length;
40 sonar_holder_width = buffer + sonar_diameter + buffer;
41 // sonar_holder_depth is deck_depth minus a little bit to make arm fit
42 // into deck holder
43 sonar_holder_depth = deck_depth - 0.7875;
44
45 deck_holder_length = sonar_holder_depth * 2 + deck_depth + 15;
46 module sonar_holder_2d() {
47 difference() {
48 square([sonar_holder_length, sonar_holder_width]); } }
49
50 module sonars() {
51 translate([between_sonar_centers / 2, 0, 0]) {
52 cylinder(r = sonar_radius, h = sonar_height); }
53 // for the variance with which the physical sonar cylinders are placed
54 translate([between_sonar_centers / 2 - between_sonar_centers_variance, 0, 0]) {
55 cylinder(r = sonar_radius, h = sonar_height);
56 translate([0, -sonar_radius, 0]) {
57 cube([between_sonar_centers_variance, sonar_diameter, sonar_height]); } }
58 translate([-between_sonar_centers / 2, 0, 0]) {
59 cylinder(r = sonar_radius, h = sonar_height); } }
60
61 module sonar_holder() {
62 difference() {
63 difference() {
64 cube([sonar_holder_length, sonar_holder_width, sonar_holder_depth]);
65 translate([sonar_holder_length - between_sonar_centers, sonar_holder_width / 2, -0.05]) {
66 sonars(); } }
67 translate([binder_clip_attacher_length / 2, sonar_holder_width / 2], 0) {
68 cylinder(r = screw_hole, h = sonar_holder_depth); } } }
69
70 module attaching_piece() {
71 linear_extrude(height = sonar_holder_depth) {
72 difference() {
73 square(sonar_holder_width, center = true);
74 circle(screw_hole); } } }
75
76 /*
77 This file is part of challenge-bot.
78
79 Challenge-bot is free software: you can redistribute it and/or modify
80 it under the terms of the GNU Affero General Public License as published by
81 the Free Software Foundation, either version 3 of the License, or
82 (at your option) any later version.
83
84 GNU Affero Emacs is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 GNU Affero General Public License for more details.
88
89 You should have received a copy of the GNU Affero General Public License
90 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.
91 */