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