put left motor speed pin on 10 for pwm
[challenge-bot] / 3d-printables / sonar-table-top-holder-data.scad
CommitLineData
3d90aff0 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
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
15$fn = 60;
16
3d90aff0 17// 3/16 inch in mm deck_depth = 4.7625;
18// 1/4 inch in mm = 6.35
19// subtract a little to be a squeeze fit
20deck_depth = 4.7625 - 0.4;
21// sonar sensor measurements taken with calipers:
22// 10.82 in between, 42.33 outside, 15.82 diameter
23// measured diameter of 15.82 with calipers,
24// but when printed ends up being too small, so add some
25sonar_diameter = 15.82 + 0.4;
26sonar_radius = sonar_diameter / 2;
27sonar_height = 13.8;
28between_sonar_centers = sonar_diameter + 10.82;
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.
31between_sonar_centers_variance = 2;
32// keep at least this much plastic surrounding the sonar cylinder on all sides
33buffer = 3;
34sonar_holder_length = buffer + between_sonar_centers + sonar_diameter + buffer;
35sonar_holder_width = buffer + sonar_diameter + buffer;
36// sonar_holder_depth is deck_depth minus a little bit to make arm fit
37// into deck holder
38sonar_holder_depth = deck_depth - 0.7875;
39
40deck_holder_length = sonar_holder_depth * 2 + deck_depth + 15;
41module sonar_holder_2d() {
42 difference() {
43 square([sonar_holder_length, sonar_holder_width]); } }
44
45module sonars() {
46 translate([between_sonar_centers / 2, 0, 0]) {
47 cylinder(r = sonar_radius, h = sonar_height); }
48 // for the variance with which the physical sonar cylinders are placed
49 translate([between_sonar_centers / 2 - between_sonar_centers_variance, 0, 0]) {
50 cylinder(r = sonar_radius, h = sonar_height);
51 translate([0, -sonar_radius, 0]) {
52 cube([between_sonar_centers_variance, sonar_diameter, sonar_height]); } }
53 translate([-between_sonar_centers / 2, 0, 0]) {
54 cylinder(r = sonar_radius, h = sonar_height); } }
55
56module sonar_holder() {
57 elbow_length = deck_depth - 0.5;
58 rounded_corner_radius = buffer;
59 difference() {
60 cube([sonar_holder_length, sonar_holder_width, sonar_holder_depth]);
61 translate([sonar_holder_length / 2, sonar_holder_width / 2, -0.05]) {
62 sonars(); }
63 translate([sonar_holder_length,
64 sonar_holder_width,
65 0]) {
66 corner_rounder(rounded_corner_radius,
67 sonar_holder_depth,
68 "bottom-right"); } }
69 translate([sonar_holder_length, 0, 0]) {
70 cube([elbow_length, deck_depth, sonar_holder_depth]);
71 translate([elbow_length, 0, 0]) {
72 linear_extrude(height = sonar_holder_depth) {
73 polygon([[ 0, 0],
74 [sonar_holder_depth, 0],
75 [sonar_holder_depth, sonar_holder_width / 2],
78a38e00 76 [ 0, sonar_holder_width / 2
77 + sonar_holder_depth]]); }
3d90aff0 78 translate([0, (sonar_holder_width + sonar_holder_depth) / 2, 0]) {
79 cube([sonar_holder_depth / 2,
80 (sonar_holder_width - sonar_holder_depth) / 2 + 0.8,
81 sonar_holder_depth]); }
82 translate([-1.7, sonar_holder_width + 0.8, 0]) {
83 linear_extrude(height = sonar_holder_depth) {
84 polygon([[ 0, 0],
85 [sonar_holder_depth / 2 + 1.7, 4],
86 [sonar_holder_depth / 2 + 1.7, 0]]); } } } } }
87
3d90aff0 88module corner_rounder_2d(radius, corner_name = "top-left") {
89 rotate_for_corner = (corner_name == "top-left") ? 0 :
90 ((corner_name == "top-right") ? -90 :
91 ((corner_name == "bottom-left") ? 90 :
92 ((corner_name == "bottom-right") ? 180 :
93 1 / 0)));
94 rotate(rotate_for_corner) {
95 difference() {
96 square(radius);
97 translate([radius, radius]) {
98 circle(radius); } } } }
99
100module corner_rounder(radius, height, corner_name = "top-left") {
101 linear_extrude(height = height) {
102 corner_rounder_2d(radius, corner_name); } }