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