separate data into *-data.scad for 3d models
[challenge-bot] / 3d-printables / deck-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
17use <oshw.scad>
18// 3/16 inch in mm deck_depth = 4.7625;
19// 1/4 inch in mm = 6.35
20// subtract a little to be a squeeze fit
21deck_depth = 4.7625 - 0.4;
22// sonar sensor measurements taken with calipers:
23// 10.82 in between, 42.33 outside, 15.82 diameter
24// measured diameter of 15.82 with calipers,
25// but when printed ends up being too small, so add some
26sonar_diameter = 15.82 + 0.4;
27sonar_radius = sonar_diameter / 2;
28sonar_height = 13.8;
29between_sonar_centers = sonar_diameter + 10.82;
30// the sonar cylinders are placed on the pcb at slightly different positions
31// from one sensor to the next, so this allows for that variance.
32between_sonar_centers_variance = 2;
33// keep at least this much plastic surrounding the sonar cylinder on all sides
34buffer = 3;
35sonar_holder_length = buffer + between_sonar_centers + sonar_diameter + buffer;
36sonar_holder_width = buffer + sonar_diameter + buffer;
37// sonar_holder_depth is deck_depth minus a little bit to make arm fit
38// into deck holder
39sonar_holder_depth = deck_depth - 0.7875;
40
41deck_holder_length = sonar_holder_depth * 2 + deck_depth + 15;
42
43oshw_dy = 120.366;
44oshw_dx = 133.888;
45
46// 3/16 inch in mm deck_depth = 4.7625;
47// 1/4 inch in mm = 6.35
48// subtract a little to be a squeeze fit
49deck_depth = 4.7625 - 0.4;
50// sonar sensor measurements taken with calipers:
51// 10.82 in between, 42.33 outside, 15.82 diameter
52// measured diameter of 15.82 with calipers,
53// but when printed ends up being too small, so add some
54sonar_diameter = 15.82 + 0.4;
55sonar_radius = sonar_diameter / 2;
56sonar_height = 13.8;
57between_sonar_centers = sonar_diameter + 10.82;
58// the sonar cylinders are placed on the pcb at slightly different positions
59// from one sensor to the next, so this allows for that variance.
60between_sonar_centers_variance = 2;
61// keep at least this much plastic surrounding the sonar cylinder on all sides
62buffer = 3;
63sonar_holder_length = buffer + between_sonar_centers + sonar_diameter + buffer;
64sonar_holder_width = buffer + sonar_diameter + buffer;
65// sonar_holder_depth is deck_depth minus a little bit to make arm fit
66// into deck holder
67sonar_holder_depth = deck_depth - 0.7875;
68
69deck_holder_length = sonar_holder_depth * 2 + deck_depth + 15;
70
71module sonars() {
72 translate([between_sonar_centers / 2, 0, 0]) {
73 cylinder(r = sonar_radius, h = sonar_height); }
74 // for the variance with which the physical sonar cylinders are placed
75 translate([between_sonar_centers / 2 - between_sonar_centers_variance, 0, 0]) {
76 cylinder(r = sonar_radius, h = sonar_height);
77 translate([0, -sonar_radius, 0]) {
78 cube([between_sonar_centers_variance, sonar_diameter, sonar_height]); } }
79 translate([-between_sonar_centers / 2, 0, 0]) {
80 cylinder(r = sonar_radius, h = sonar_height); } }
81
82module sonar_holder() {
83 elbow_length = deck_depth;
84 rounded_corner_radius = buffer;
85 difference() {
86 cube([sonar_holder_length, sonar_holder_width, sonar_holder_depth]);
87 translate([sonar_holder_length / 2, sonar_holder_width / 2, -0.05]) {
88 sonars(); }
89 translate([sonar_holder_length - rounded_corner_radius,
90 sonar_holder_width - rounded_corner_radius,
91 0]) {
92 corner_rounder(rounded_corner_radius, sonar_holder_depth); } }
93 translate([sonar_holder_length, 0, 0]) {
94 cube([elbow_length, deck_depth, sonar_holder_depth]);
95 translate([elbow_length, 0, 0]) {
96 linear_extrude(height = sonar_holder_depth) {
97 polygon([[ 0, 0],
98 [sonar_holder_depth, 0],
99 [sonar_holder_depth, sonar_holder_width / 2],
100 [ 0,
101 sonar_holder_width / 2 + sonar_holder_depth]]); }
102 translate([0, (sonar_holder_width + sonar_holder_depth) / 2, 0]) {
103 cube([sonar_holder_depth / 2,
104 (sonar_holder_width - sonar_holder_depth) / 2 + 0.8,
105 sonar_holder_depth]); }
106 translate([-1.7, sonar_holder_width + 0.8, 0]) {
107 linear_extrude(height = sonar_holder_depth) {
108 polygon([[ 0, 0],
109 [sonar_holder_depth / 2 + 1.7, 4],
110 [sonar_holder_depth / 2 + 1.7, 0]]); } } } } }
111
112module deck_holder() {
113 deck_holder_width = sonar_holder_width - deck_depth;
114 deck_holder_height = sonar_holder_depth * 2 + deck_depth;
115 linear_extrude(height = deck_holder_width) {
116 difference() {
117 square([deck_holder_length, deck_holder_height]);
118 translate([sonar_holder_depth - 0.15, sonar_holder_depth - 0.15]) {
119 square(deck_depth + 0.3); }
120 translate([deck_holder_height, sonar_holder_depth - 0.3]) {
121 square([deck_holder_length - (deck_holder_height),
122 deck_depth + 0.6]); } } }
123 translate([deck_holder_length - oshw_dy * 0.05, 0, deck_holder_width / 2])
124 scale([0.1, 1, 0.1])
125 rotate(v = [1, 0, 0], a = 90)
126 rotate(90)
127 linear_extrude(height = 0.5)
128 oshw();
129 translate([deck_holder_length - oshw_dy * 0.05,
130 deck_holder_height + 0.5,
131 deck_holder_width / 2])
132 rotate(v = [1, 0, 0], a = 90)
133 rotate(90)
134 scale([0.1, 0.1, 1])
135 linear_extrude(height = 0.5)
136 oshw(); }
137
138module corner_rounder_2d(radius) {
139 difference() {
140 square(radius);
141 circle(radius); } }
142
143module corner_rounder(radius, height) {
144 linear_extrude(height = height) {
145 corner_rounder_2d(radius); } }