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