set '$fn' globally based on develop or print for wheel
[challenge-bot] / wheel.scad
CommitLineData
bc02cd24 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
136c3fb0 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 = 20;
11
e93f053a 12wheel_depth = 6;
0d781ab9 13wheel_radius = 68/2;
14
bc02cd24 15module encoder_shaft(){
6af76e9d 16 // measured with calipers, checked against the motor shaft
ac757602 17 motor_shaft_big = 3.7; // radius, gets doubled in cylinder
18 motor_shaft_small = 4.8; // total length of box
6af76e9d 19 motor_shaft_length = wheel_depth * 3 / 4;
bc02cd24 20
21 intersection(){
136c3fb0 22 cylinder(h = motor_shaft_length, r = motor_shaft_big, center = true);
6af76e9d 23 // x direction is multiplied by 2 because the radius of the cylinder
24 // goes in both directions. the extra .1 is for overlap
bc02cd24 25 cube([motor_shaft_big * 2.1, motor_shaft_small, motor_shaft_length],
26 center = true);}}
27
0d781ab9 28module mounting_screw(){
136c3fb0 29 cylinder(h = wheel_depth * 1.1, r = 1, center = true);}
0d781ab9 30
bc02cd24 31module wheel(){
0d781ab9 32 translate([0, 0, wheel_depth / 2]){
33 difference(){
136c3fb0 34 cylinder(h = wheel_depth, r = wheel_radius, center = true);
e93f053a 35 translate([0, 0, wheel_depth / 4]){
6af76e9d 36 scale([1, 1, 1.1]){
0d781ab9 37 encoder_shaft();}}
38 mounting_screw();
e93f053a 39 for(i = [1 : 5]){
0d781ab9 40 rotate(i * 360/5, [0, 0, 1]){
41 translate([0, 0, -0.6 * wheel_depth])
e93f053a 42 between_spokes();}}
43 translate([0, 0, wheel_depth / 4]){
44 difference(){
45 cylinder(h = wheel_depth / 1.2,
46 r = 0.85 * wheel_radius,
47 center = true);
48 cylinder(h = wheel_depth / 1.2,
49 r = 0.23 * wheel_radius,
50 center = true);}}}}}
0d781ab9 51
52module wheel_block(){
53 cube([wheel_radius, wheel_radius, wheel_depth]);}
54
55module pie_slice(){
56 intersection(){
57 translate([0, 0, wheel_depth / 2]){
58 cylinder(h = wheel_depth,
e93f053a 59 r = 0.85 * wheel_radius,
0d781ab9 60 center = true);}
61 translate([0, wheel_radius * 0.3, 0]){
e93f053a 62 rotate([0, 0, (360 / 5) / 2]){
0d781ab9 63 intersection(){
64 wheel_block();
e93f053a 65 rotate([0, 0, 90 - 360 / 5])
0d781ab9 66 wheel_block();}}}}}
67
68module between_spokes(){
69 minkowski(){
70 pie_slice();
136c3fb0 71 cylinder(h = wheel_depth / 2, r = 1);}}
0d781ab9 72
73wheel();