d899cf8b |
1 | /* |
2 | Copyright 2016 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 |
16 | of it. |
17 | */ |
18 | |
ba144414 |
19 | $fn = 50; |
d899cf8b |
20 | |
21 | sonar_diameter_measured = 15.82; |
22 | sonar_diameter_print_fudge = 0.5; |
23 | sonar_diameter = sonar_diameter_measured + sonar_diameter_print_fudge; |
24 | sonar_radius = sonar_diameter / 2; |
25 | |
ba144414 |
26 | between_sonar_cans = 10.82; |
27 | between_sonar_centers = sonar_diameter + between_sonar_cans; |
28 | |
8d53fefd |
29 | // the sonar cylinders are placed on the pcb at slightly different positions |
30 | // from one sensor to the next, so this allows for that variance. |
31 | between_sonar_centers_variation = 2; |
32 | |
d7732ded |
33 | wall_thickness = 3; |
34 | |
bfdc15e7 |
35 | screw_radius_measured = 2.8; |
e92772f9 |
36 | screw_radius_print_fudge = 0.0; |
bfdc15e7 |
37 | screw_radius = screw_radius_measured + screw_radius_print_fudge; |
38 | |
a92105bf |
39 | sonar_binder_clip_holder_height = 4; |
cc1b210f |
40 | |
64c38a30 |
41 | module sonar_sensor_holes_2d(sonar_radius, |
42 | between_sonar_centers, |
43 | between_sonar_centers_variation) { |
d7732ded |
44 | hull(){ |
45 | circle(sonar_radius); |
46 | translate([between_sonar_centers_variation, 0]){ |
47 | circle(sonar_radius); } } |
48 | translate([between_sonar_centers, 0]) { |
49 | circle(sonar_radius); } } |
50 | |
64c38a30 |
51 | module sonar_holder_outline_2d(holder_radius, |
52 | between_sonar_centers) { |
d7732ded |
53 | hull() { |
54 | circle(holder_radius); |
f62bc6ee |
55 | translate([between_sonar_centers, 0]) { |
56 | circle(holder_radius); } } } |
57 | |
58 | module binder_clip_holder_outline_2d(holder_radius) { |
59 | circle(holder_radius); } |
60 | |
64c38a30 |
61 | module sonar_binder_clip_holder_outline_2d(holder_radius, |
62 | between_sonar_centers) { |
63 | sonar_holder_length = between_sonar_centers + 2 * holder_radius; |
f62bc6ee |
64 | hull(){ |
64c38a30 |
65 | sonar_holder_outline_2d(holder_radius, between_sonar_centers); |
66 | translate([sonar_holder_length, 0]) { |
67 | binder_clip_holder_outline_2d(holder_radius); } } } |
f62bc6ee |
68 | |
64c38a30 |
69 | module binder_clip_holder_holes_2d(screw_radius) { |
70 | circle(screw_radius); } |
f62bc6ee |
71 | |
64c38a30 |
72 | module binder_clip_holder_2d(holder_radius, |
73 | screw_radius) { |
f62bc6ee |
74 | difference() { |
64c38a30 |
75 | binder_clip_holder_outline_2d(holder_radius); |
76 | binder_clip_holder_holes_2d(screw_radius); } } |
d7732ded |
77 | |
64c38a30 |
78 | module binder_clip_holder(holder_radius, |
79 | screw_radius, |
80 | sonar_binder_clip_holder_height) { |
81 | linear_extrude(height = sonar_binder_clip_holder_height) { |
82 | binder_clip_holder_2d(holder_radius, |
83 | screw_radius); } } |
84 | |
85 | module sonar_binder_clip_holder_holes_2d(sonar_radius, |
86 | between_sonar_centers, |
87 | between_sonar_centers_variation, |
88 | screw_radius, |
89 | wall_thickness) { |
90 | holder_radius = sonar_radius + wall_thickness; |
91 | holder_diameter = holder_radius * 2; |
92 | holder_length = between_sonar_centers + holder_diameter; |
93 | sonar_sensor_holes_2d(sonar_radius, |
94 | between_sonar_centers, |
95 | between_sonar_centers_variation); |
96 | translate([holder_length, 0]){ |
97 | binder_clip_holder_holes_2d(screw_radius); } } |
e04f30fb |
98 | |
cc1b210f |
99 | module sonar_binder_clip_holder_2d(sonar_radius, |
100 | between_sonar_centers, |
101 | between_sonar_centers_variation, |
64c38a30 |
102 | screw_radius, |
cc1b210f |
103 | wall_thickness) { |
e04f30fb |
104 | holder_radius = sonar_radius + wall_thickness; |
64c38a30 |
105 | difference() { |
106 | sonar_binder_clip_holder_outline_2d(holder_radius, |
107 | between_sonar_centers); |
108 | sonar_binder_clip_holder_holes_2d(sonar_radius, |
109 | between_sonar_centers, |
110 | between_sonar_centers_variation, |
111 | screw_radius, |
112 | wall_thickness); } } |
d899cf8b |
113 | |
cc1b210f |
114 | module sonar_binder_clip_holder(sonar_radius, |
115 | between_sonar_centers, |
116 | between_sonar_centers_variation, |
64c38a30 |
117 | screw_radius, |
cc1b210f |
118 | wall_thickness, |
119 | sonar_binder_clip_holder_height) { |
64c38a30 |
120 | linear_extrude(height = sonar_binder_clip_holder_height) { |
121 | sonar_binder_clip_holder_2d(sonar_radius, |
122 | between_sonar_centers, |
123 | between_sonar_centers_variation, |
124 | screw_radius, |
125 | wall_thickness); } } |
cc1b210f |
126 | |
d899cf8b |
127 | /* |
128 | This file is part of challenge-bot. |
129 | |
130 | Challenge-bot is free software: you can redistribute it and/or modify |
131 | it under the terms of the GNU Affero General Public License as published by |
132 | the Free Software Foundation, either version 3 of the License, or |
133 | (at your option) any later version. |
134 | |
135 | GNU Affero Emacs is distributed in the hope that it will be useful, |
136 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
137 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
138 | GNU Affero General Public License for more details. |
139 | |
140 | You should have received a copy of the GNU Affero General Public License |
141 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
142 | */ |