use qr code for wheel
[challenge-bot] / 3d-printables / wheel.scad
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 // use $fn = 20 while developing, 100 when about to print
8 // 20 will make previews fast
9 // 100 will make printing smooth
10 $fn = 100;
11
12 use <qr.scad>
13
14 qr_size = 54;
15 qr_height = 2;
16
17 wall_width = 3;
18
19 wheel_width = 6;
20 wheel_radius = sqrt(2 * pow(qr_size / 2, 2)) + wall_width / 2;
21
22 motor_shaft_radius = 3.7;
23 motor_shaft_flat_width = 4.8;
24
25 module mounting_screw_flat(){
26 square(2, center = true);}
27
28 module motor_shaft_flat(radius, flat_width){
29 intersection(){
30 circle(radius);
31 square([flat_width, radius * 2], center = true);}}
32
33 module motor_shaft(radius,
34 flat_width,
35 shaft_length){
36 linear_extrude(height = shaft_length){
37 motor_shaft_flat(radius, flat_width);}}
38
39 module rim(radius, wall_width, wheel_width){
40 linear_extrude(height = wheel_width){
41 difference(){
42 circle(radius);
43 circle(radius - wall_width);}}}
44
45 module motor_shaft_holder_flat(radius, flat_width, wall_width){
46 difference(){
47 motor_shaft_flat(radius + wall_width,
48 flat_width + wall_width);
49 motor_shaft_flat(radius, flat_width);}}
50
51 module motor_shaft_holder(radius, flat_width, wall_width, height){
52 linear_extrude(height = height){
53 motor_shaft_holder_flat(radius, flat_width, wall_width);}}
54
55 module wheel_black(radius, width, shaft_radius, shaft_flat_width, wall_width){
56 color("black"){
57 rim(radius, wall_width, width);
58 linear_extrude(height = qr_height){
59 difference(){
60 qr_black_flat();
61 mounting_screw_flat();}}
62 translate([0, 0, qr_height]){
63 motor_shaft_holder(shaft_radius,
64 shaft_flat_width,
65 wall_width,
66 width - qr_height);}}}
67
68 module wheel_white(){
69 color("white"){
70 linear_extrude(height = qr_height){
71 difference(){
72 qr_white_flat();
73 mounting_screw_flat();}}}}
74
75 module wheel(radius, width, shaft_radius, shaft_flat_width, wall_width){
76 wheel_black(radius,
77 width,
78 shaft_radius,
79 shaft_flat_width,
80 wall_width);
81 wheel_white();}
82
83 wheel(wheel_radius,
84 wheel_width,
85 motor_shaft_radius,
86 motor_shaft_flat_width,
87 wall_width);