round the corner of sonar table top holder
[challenge-bot] / 3d-printables / sonar-table-top-holder.scad
CommitLineData
dac38b58 1// challenge-bot
2// GNU AGPLv3 (or later at your option)
3// project available at these locations:
4// https://gitorious.org/ozzloy/challenge-bot
5// https://github.com/waynegramlich/challenge-bot
6
3d01ee80 7/*
8 this holds an hc-sr04 sonar sensor to a 3/16 inch deck.
9 http://fritzing.org/projects/hc-sr04-project
10 it can hold the sonar sensor either facing down, or forwards.
11 when facing down, it can detect if it passes over the edge of a table.
12 when facing forwards, it can detect and follow something in front of it.
13 */
14
978bd219 15$fn = 60;
16
4390b08c 17use <oshw.scad>
18oshw_dy = 120.366;
19oshw_dx = 133.888;
20
978bd219 21// 3/16 inch in mm deck_depth = 4.7625;
be16f419 22// 1/4 inch in mm = 6.35
23// subtract a little to be a squeeze fit
8b340909 24deck_depth = 4.7625 - 0.4;
8ca271e9 25// sonar sensor measurements taken with calipers:
49bffb72 26// 10.82 in between, 42.33 outside, 15.82 diameter
8ca271e9 27// measured diameter of 15.82 with calipers,
8b84f6f3 28// but when printed ends up being too small, so add some
651bbf4b 29sonar_diameter = 15.82 + 0.4;
8b84f6f3 30sonar_radius = sonar_diameter / 2;
31sonar_height = 13.8;
32between_sonar_centers = sonar_diameter + 10.82;
33// the sonar cylinders are placed on the pcb at slightly different positions
34// from one sensor to the next, so this allows for that variance.
35between_sonar_centers_variance = 2;
36// keep at least this much plastic surrounding the sonar cylinder on all sides
bc750455 37buffer = 3;
8b84f6f3 38sonar_holder_length = buffer + between_sonar_centers + sonar_diameter + buffer;
39sonar_holder_width = buffer + sonar_diameter + buffer;
bc750455 40// sonar_holder_depth is deck_depth minus a little bit to make arm fit
41// into deck holder
34e9f480 42sonar_holder_depth = deck_depth - 0.7875;
8ca271e9 43
bc750455 44deck_holder_length = sonar_holder_depth * 2 + deck_depth + 15;
74f8c088 45
8b84f6f3 46module sonars(){
47 translate([between_sonar_centers / 2, 0, 0]){
48 cylinder(r = sonar_radius, h = sonar_height);}
49 // for the variance with which the physical sonar cylinders are placed
50 translate([between_sonar_centers / 2 - between_sonar_centers_variance, 0, 0]){
51 cylinder(r = sonar_radius, h = sonar_height);
52 translate([0, -sonar_radius, 0]){
53 cube([between_sonar_centers_variance, sonar_diameter, sonar_height]);}}
54 translate([-between_sonar_centers / 2, 0, 0]){
55 cylinder(r = sonar_radius, h = sonar_height);}}
74f8c088 56
8b84f6f3 57module sonar_holder(){
34e9f480 58 elbow_length = deck_depth - 0.5;
7888bdfb 59 rounded_corner_radius = buffer;
49bffb72 60 difference(){
61 cube([sonar_holder_length, sonar_holder_width, sonar_holder_depth]);
62 translate([sonar_holder_length / 2, sonar_holder_width / 2, -0.05]){
7888bdfb 63 sonars();}
64 translate([sonar_holder_length - rounded_corner_radius,
65 sonar_holder_width - rounded_corner_radius,
66 0]){
67 corner_rounder(rounded_corner_radius, sonar_holder_depth);}}
8b84f6f3 68 translate([sonar_holder_length, 0, 0]){
34e9f480 69 cube([elbow_length, deck_depth, sonar_holder_depth]);
8b84f6f3 70 translate([elbow_length, 0, 0]){
71 linear_extrude(height = sonar_holder_depth){
34e9f480 72 polygon([[ 0, 0],
8b84f6f3 73 [sonar_holder_depth, 0],
74 [sonar_holder_depth, sonar_holder_width / 2],
34e9f480 75 [ 0,
76 sonar_holder_width / 2 + sonar_holder_depth]]);}
8b84f6f3 77 translate([0, (sonar_holder_width + sonar_holder_depth) / 2, 0]){
78 cube([sonar_holder_depth / 2,
79 (sonar_holder_width - sonar_holder_depth) / 2 + 0.8,
80 sonar_holder_depth]);}
60061640 81 translate([-1.7, sonar_holder_width + 0.8, 0]){
8b84f6f3 82 linear_extrude(height = sonar_holder_depth){
34e9f480 83 polygon([[ 0, 0],
8b84f6f3 84 [sonar_holder_depth / 2 + 1.7, 4],
85 [sonar_holder_depth / 2 + 1.7, 0]]);}}}}}
49bffb72 86
74f8c088 87module deck_holder(){
be16f419 88 deck_holder_width = sonar_holder_width - deck_depth;
4390b08c 89 deck_holder_height = sonar_holder_depth * 2 + deck_depth;
bc750455 90 linear_extrude(height = deck_holder_width){
91 difference(){
4390b08c 92 square([deck_holder_length, deck_holder_height]);
bc750455 93 translate([sonar_holder_depth, sonar_holder_depth]){
94 square(deck_depth);}
4390b08c 95 translate([deck_holder_height, sonar_holder_depth]){
96 square([deck_holder_length - (deck_holder_height), deck_depth]);}}}
97 translate([deck_holder_length - oshw_dy * 0.05, 0, deck_holder_width / 2])
98 scale([0.1, 1, 0.1])
99 rotate(v = [1, 0, 0], a = 90)
100 rotate(90)
101 linear_extrude(height = 0.5)
102 oshw();
103 translate([deck_holder_length - oshw_dy * 0.05,
104 deck_holder_height + 0.5,
105 deck_holder_width / 2])
106 rotate(v = [1, 0, 0], a = 90)
107 rotate(90)
108 scale([0.1, 0.1, 1])
109 linear_extrude(height = 0.5)
110 oshw();}
74f8c088 111
7888bdfb 112module corner_rounder_2d(radius){
113 difference (){
114 square (radius);
115 circle (radius);}}
116
117module corner_rounder(radius, height){
118 linear_extrude(height = height){
119 corner_rounder_2d(radius);}}
120
be16f419 121deck_holder();
7888bdfb 122
8b84f6f3 123translate([0, sonar_holder_depth * 2 + deck_depth + 2, 0]){
124 sonar_holder();}