define wiring in separate file
[challenge-bot] / 3d-printables / sonar-binder-clip-holder-data.scad
CommitLineData
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
26sonar_diameter_measured = 15.82;
67916b8d 27sonar_diameter_print_fudge = 0.4;
d899cf8b 28sonar_diameter = sonar_diameter_measured + sonar_diameter_print_fudge;
29sonar_radius = sonar_diameter / 2;
30
ba144414 31between_sonar_cans = 10.82;
32between_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.
36between_sonar_centers_variation = 2;
37
ca851d51 38wall_thickness = 4;
d7732ded 39
52560c6a 40screw_diameter_measured = 3.45;
250f2c1f 41screw_radius_measured = screw_diameter_measured / 2;
f0624ee0 42screw_radius_print_fudge = 0.4;
bfdc15e7 43screw_radius = screw_radius_measured + screw_radius_print_fudge;
44
422764ef 45sonar_binder_clip_holder_height = 3;
cc1b210f 46
a7f8c96d 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
57module sonar_holder_holes_2d(sonar_radius,
64c38a30 58 between_sonar_centers,
59 between_sonar_centers_variation) {
d7732ded 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
64c38a30 67module sonar_holder_outline_2d(holder_radius,
68 between_sonar_centers) {
239eea4b 69 smaller_radius = holder_radius / 4;
70 inside_radius = holder_radius - smaller_radius;
d7732ded 71 hull() {
239eea4b 72 offset(r = smaller_radius){
73 square([inside_radius * 2, inside_radius * 2], center=true); }
f62bc6ee 74 translate([between_sonar_centers, 0]) {
75 circle(holder_radius); } } }
76
239eea4b 77module sonar_holder_2d(holder_radius,
78 between_sonar_centers,
79 sonar_radius,
80 between_sonar_centers_variation) {
81 difference() {
82 sonar_holder_outline_2d(holder_radius,
83 between_sonar_centers);
84 sonar_holder_holes_2d(sonar_radius,
85 between_sonar_centers,
86 between_sonar_centers_variation); } }
f62bc6ee 87
64c38a30 88module binder_clip_holder_holes_2d(screw_radius) {
89 circle(screw_radius); }
f62bc6ee 90
239eea4b 91module binder_clip_holder_outline_2d(holder_radius) {
92 smaller_radius = holder_radius / 4;
93 inside_radius = holder_radius - smaller_radius;
94 offset(r = smaller_radius){
95 square([inside_radius * 2, inside_radius * 2], center=true); } }
96
64c38a30 97module binder_clip_holder_2d(holder_radius,
98 screw_radius) {
f62bc6ee 99 difference() {
239eea4b 100 binder_clip_holder_outline_2d(holder_radius);
101 binder_clip_holder_holes_2d(screw_radius); } }
d7732ded 102
64c38a30 103module binder_clip_holder(holder_radius,
104 screw_radius,
105 sonar_binder_clip_holder_height) {
106 linear_extrude(height = sonar_binder_clip_holder_height) {
107 binder_clip_holder_2d(holder_radius,
108 screw_radius); } }
109
cc1b210f 110module sonar_binder_clip_holder_2d(sonar_radius,
111 between_sonar_centers,
112 between_sonar_centers_variation,
64c38a30 113 screw_radius,
cc1b210f 114 wall_thickness) {
239eea4b 115 holder_radius = sonar_radius + wall_thickness;
116 sonar_holder_2d(holder_radius,
117 between_sonar_centers,
118 sonar_radius,
119 between_sonar_centers_variation);
120 arm_length = between_sonar_centers + 2 * holder_radius;
121 difference() {
122 translate([0, -holder_radius]) {
123 square([arm_length, holder_radius * 2]); }
124 sonar_holder_outline_2d(holder_radius, between_sonar_centers);
125 translate([arm_length, 0]) {
126 binder_clip_holder_outline_2d(holder_radius); } }
127 translate([arm_length, 0]) {
128 binder_clip_holder_2d(holder_radius, screw_radius); } }
d899cf8b 129
cc1b210f 130module sonar_binder_clip_holder(sonar_radius,
131 between_sonar_centers,
132 between_sonar_centers_variation,
64c38a30 133 screw_radius,
cc1b210f 134 wall_thickness,
135 sonar_binder_clip_holder_height) {
239eea4b 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); } }
cc1b210f 142
d899cf8b 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*/