2 Copyright (C) 2015 Daniel Watson
3 See the end of the file for license conditions.
6 // GNU AGPLv3 (or later at your option)
7 // project available here:
8 // https://challenge-bot.com/
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.
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.5;
29 sonar_radius
= sonar_diameter
/ 2;
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
37 sonar_holder_length
= buffer
+ between_sonar_centers
+ sonar_diameter
+ buffer
;
38 sonar_holder_width
= buffer
+ sonar_diameter
+ buffer
;
39 // sonar_holder_depth is deck_depth minus a little bit to make arm fit
41 sonar_holder_depth
= deck_depth
- 0.7875;
43 deck_holder_length
= sonar_holder_depth
* 2 + deck_depth
+ 15;
44 module
sonar_holder_2d() {
46 square([sonar_holder_length
, sonar_holder_width
]); } }
49 translate([between_sonar_centers
/ 2, 0, 0]) {
51 cylinder(r
= sonar_radius
, h
= sonar_height
);
52 // for the variance with which the physical sonar cylinders are placed
53 translate([ -between_sonar_centers_variance
, 0, 0]) {
54 cylinder(r
= sonar_radius
, h
= sonar_height
); } } }
55 translate([-between_sonar_centers
/ 2, 0, 0]) {
56 cylinder(r
= sonar_radius
, h
= sonar_height
); } }
58 module
sonar_holder() {
59 elbow_length
= deck_depth
- 0.2;
60 rounded_corner_radius
= buffer
;
62 cube([sonar_holder_length
, sonar_holder_width
, sonar_holder_depth
]);
63 translate([sonar_holder_length
/ 2, sonar_holder_width
/ 2, -0.05]) {
65 translate([sonar_holder_length
,
68 corner_rounder(rounded_corner_radius
,
71 translate([sonar_holder_length
, 0, 0]) {
72 cube([elbow_length
, deck_depth
, sonar_holder_depth
]);
73 translate([elbow_length
, 0, 0]) {
74 linear_extrude(height
= sonar_holder_depth
) {
76 [sonar_holder_depth
, 0],
77 [sonar_holder_depth
, sonar_holder_width
/ 2],
78 [ 0, sonar_holder_width
/ 2
79 + sonar_holder_depth
]]); }
80 translate([0, (sonar_holder_width
+ sonar_holder_depth
) / 2, 0]) {
81 cube([sonar_holder_depth
/ 2,
82 (sonar_holder_width
- sonar_holder_depth
) / 2 + 0.8,
83 sonar_holder_depth
]); }
84 translate([-1.7, sonar_holder_width
+ 0.8, 0]) {
85 linear_extrude(height
= sonar_holder_depth
) {
87 [sonar_holder_depth
/ 2 + 1.7, 4],
88 [sonar_holder_depth
/ 2 + 1.7, 0]]); } } } } }
90 module
corner_rounder_2d(radius
, corner_name
= "top-left") {
91 rotate_for_corner
= (corner_name
== "top-left") ? 0 :
92 ((corner_name
== "top-right") ? -90 :
93 ((corner_name
== "bottom-left") ? 90 :
94 ((corner_name
== "bottom-right") ? 180 :
96 rotate(rotate_for_corner
) {
99 translate([radius
, radius
]) {
100 circle(radius
); } } } }
102 module
corner_rounder(radius
, height
, corner_name
= "top-left") {
103 linear_extrude(height
= height
) {
104 corner_rounder_2d(radius
, corner_name
); } }
107 This file is part of challenge-bot.
109 Challenge-bot is free software: you can redistribute it and/or modify
110 it under the terms of the GNU Affero General Public License as published by
111 the Free Software Foundation, either version 3 of the License, or
112 (at your option) any later version.
114 GNU Affero Emacs is distributed in the hope that it will be useful,
115 but WITHOUT ANY WARRANTY; without even the implied warranty of
116 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117 GNU Affero General Public License for more details.
119 You should have received a copy of the GNU Affero General Public License
120 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.