5b1d9261ba5966419f1ed3fd4a9f364a51ffc63d
[challenge-bot] / 3d-printables / sonar-binder-clip-holder-data.scad
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
19 $fn = 150;
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
26 between_sonar_cans = 10.82;
27 between_sonar_centers = sonar_diameter + between_sonar_cans;
28
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
33 wall_thickness = 3;
34
35 screw_diameter_measured = 3.45;
36 screw_radius_measured = screw_diameter_measured / 2;
37 screw_radius_print_fudge = 0.3;
38 screw_radius = screw_radius_measured + screw_radius_print_fudge;
39
40 sonar_binder_clip_holder_height = 4;
41
42 module sonar_sensor_holes_2d(sonar_radius,
43 between_sonar_centers,
44 between_sonar_centers_variation) {
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
52 module sonar_holder_outline_2d(holder_radius,
53 between_sonar_centers) {
54 hull() {
55 circle(holder_radius);
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
62 module sonar_binder_clip_holder_outline_2d(holder_radius,
63 between_sonar_centers) {
64 sonar_holder_length = between_sonar_centers + 2 * holder_radius;
65 hull(){
66 sonar_holder_outline_2d(holder_radius, between_sonar_centers);
67 translate([sonar_holder_length, 0]) {
68 binder_clip_holder_outline_2d(holder_radius); } } }
69
70 module binder_clip_holder_holes_2d(screw_radius) {
71 circle(screw_radius); }
72
73 module binder_clip_holder_2d(holder_radius,
74 screw_radius) {
75 difference() {
76 binder_clip_holder_outline_2d(holder_radius);
77 binder_clip_holder_holes_2d(screw_radius); } }
78
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); } }
99
100 module sonar_binder_clip_holder_2d(sonar_radius,
101 between_sonar_centers,
102 between_sonar_centers_variation,
103 screw_radius,
104 wall_thickness) {
105 holder_radius = sonar_radius + wall_thickness;
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); } }
114
115 module sonar_binder_clip_holder(sonar_radius,
116 between_sonar_centers,
117 between_sonar_centers_variation,
118 screw_radius,
119 wall_thickness,
120 sonar_binder_clip_holder_height) {
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); } }
127
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 */