use qr code for wheel
authordaniel watson <ozzloy@gmail.com>
Wed, 11 Dec 2013 08:00:33 +0000 (00:00 -0800)
committerdaniel watson <ozzloy@gmail.com>
Wed, 11 Dec 2013 08:06:39 +0000 (00:06 -0800)
3d-printables/qr.scad [new file with mode: 0644]
3d-printables/wheel-black.scad [new file with mode: 0644]
3d-printables/wheel-white.scad [new file with mode: 0644]
3d-printables/wheel.scad

diff --git a/3d-printables/qr.scad b/3d-printables/qr.scad
new file mode 100644 (file)
index 0000000..2e664f7
--- /dev/null
@@ -0,0 +1,91 @@
+module qr(){
+  2d = true;
+  fudge = 0.01;
+  block_z = 5;
+  block_size = 2;
+  matrix_rows = 37;
+  matrix_cols = 37;
+
+  matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
+  module block(bit, x, y, z, 2d) {
+    if(2d) {
+      square([x, y]);}
+    else {
+      cube([x, y, z*bit]);}}
+
+  scale([1, 1, 1]) translate([-block_size*matrix_cols/2, block_size*(matrix_rows/2-1), 0]) {
+    translate([0, 0, 1]) {
+      for(i = [0 : matrix_rows-1]) {
+        for(j = [0 : matrix_cols-1]) {
+          if(matrix[i][j] != 0) {
+            translate([block_size*j, -block_size*i, 0]) {
+              if(i == 0 && j == matrix_cols-1) {
+                // Draw the top right corner block normal size
+                block(matrix[i][j], block_size, block_size, block_z, 2d);}
+              else if(i == 0) {
+                // Draw blocks on the top row with a x fudge factor added
+                block(matrix[i][j], block_size+fudge, block_size, block_z, 2d);}
+              else if(j == matrix_cols-1) {
+                // Draw blocks on the right column with a y fudge factor added
+                block(matrix[i][j], block_size, block_size+fudge, block_z, 2d);}
+              else {
+                // For blocks that aren't on the edge,
+                //  add a fudge factor so they are connected to other blocks
+                block(matrix[i][j],
+                      block_size+fudge,
+                      block_size+fudge,
+                      block_z,
+                      2d);}}}}}}}}
+module qr_black_flat(){
+  qr();}
+module qr_black(){
+  color("black")
+    linear_extrude(height = 2){
+      qr_black_flat();}}
+
+module qr_white_flat(){
+  difference(){
+    square(54, center = true);
+    qr();}}
+module qr_white(){
+  color("white")
+    linear_extrude(height = 2){
+      qr_white_flat();}}
+qr_black();
+qr_white();
diff --git a/3d-printables/wheel-black.scad b/3d-printables/wheel-black.scad
new file mode 100644 (file)
index 0000000..98324e4
--- /dev/null
@@ -0,0 +1,25 @@
+// challenge-bot
+// GNU AGPLv3 (or later at your option)
+// project available at these locations:
+// https://gitorious.org/ozzloy/challenge-bot
+// https://github.com/waynegramlich/challenge-bot
+
+use <wheel.scad>
+
+qr_size = 54;
+qr_height = 2;
+
+wall_width = 3;
+
+wheel_width = 6;
+wheel_radius = sqrt(2 * pow(qr_size / 2, 2)) + wall_width / 2;
+
+motor_shaft_radius = 3.7;
+motor_shaft_flat_width = 4.8;
+
+translate([-30, -0.6, 0]){
+  wheel_black(wheel_radius,
+              wheel_width,
+              motor_shaft_radius,
+              motor_shaft_flat_width,
+              wall_width);}
diff --git a/3d-printables/wheel-white.scad b/3d-printables/wheel-white.scad
new file mode 100644 (file)
index 0000000..f56db19
--- /dev/null
@@ -0,0 +1,9 @@
+// challenge-bot
+// GNU AGPLv3 (or later at your option)
+// project available at these locations:
+// https://gitorious.org/ozzloy/challenge-bot
+// https://github.com/waynegramlich/challenge-bot
+
+use <wheel.scad>
+
+wheel_white();
index 87ec2865c38c456da267159bce0b19b41291c92d..0a922fd6c302dbfdb1a2ca7fefdbe7c05324a8be 100644 (file)
@@ -7,67 +7,81 @@
 // use $fn = 20 while developing, 100 when about to print
 //  20 will make previews fast
 //  100 will make printing smooth
-$fn = 20;
+$fn = 100;
 
-wheel_depth = 6;
-wheel_radius = 68/2;
+use <qr.scad>
 
-module encoder_shaft(){
-  // measured with calipers, checked against the motor shaft
-  motor_shaft_big = 3.7; // radius, gets doubled in cylinder
-  motor_shaft_small = 4.8; // total length of box
-  motor_shaft_length = wheel_depth * 3 / 4;
+qr_size = 54;
+qr_height = 2;
 
+wall_width = 3;
+
+wheel_width = 6;
+wheel_radius = sqrt(2 * pow(qr_size / 2, 2)) + wall_width / 2;
+
+motor_shaft_radius = 3.7;
+motor_shaft_flat_width = 4.8;
+
+module mounting_screw_flat(){
+  square(2, center = true);}
+
+module motor_shaft_flat(radius, flat_width){
   intersection(){
-    cylinder(h = motor_shaft_length, r = motor_shaft_big, center = true);
-    // x direction is multiplied by 2 because the radius of the cylinder
-    // goes in both directions.  the extra .1 is for overlap
-    cube([motor_shaft_big * 2.1, motor_shaft_small, motor_shaft_length],
-         center = true);}}
+    circle(radius);
+    square([flat_width, radius * 2], center = true);}}
 
-module mounting_screw(){
-  cylinder(h = wheel_depth * 1.1, r = 1, center = true);}
+module motor_shaft(radius,
+                   flat_width,
+                   shaft_length){
+  linear_extrude(height = shaft_length){
+    motor_shaft_flat(radius, flat_width);}}
 
-module wheel(){
-  translate([0, 0, wheel_depth / 2]){
+module rim(radius, wall_width, wheel_width){
+  linear_extrude(height = wheel_width){
     difference(){
-      cylinder(h = wheel_depth, r = wheel_radius, center = true);
-      translate([0, 0, wheel_depth / 4]){
-        scale([1, 1, 1.1]){
-          encoder_shaft();}}
-      mounting_screw();
-      for(i = [1 : 5]){
-        rotate(i * 360/5, [0, 0, 1]){
-          translate([0, 0, -0.6 * wheel_depth])
-            between_spokes();}}
-      translate([0, 0, wheel_depth / 4]){
-        difference(){
-          cylinder(h = wheel_depth / 1.2,
-                   r = 0.85 * wheel_radius,
-                   center = true);
-          cylinder(h = wheel_depth / 1.2,
-                   r = 0.23 * wheel_radius,
-                   center = true);}}}}}
-
-module wheel_block(){
-  cube([wheel_radius, wheel_radius, wheel_depth]);}
-
-module pie_slice(){
-  intersection(){
-    translate([0, 0, wheel_depth / 2]){
-      cylinder(h = wheel_depth,
-               r = 0.85 * wheel_radius,
-               center = true);}
-    translate([0, wheel_radius * 0.3, 0]){
-      rotate([0, 0, (360 / 5) / 2]){
-        intersection(){
-          wheel_block();
-          rotate([0, 0, 90 - 360 / 5])
-            wheel_block();}}}}}
-
-module between_spokes(){
-  minkowski(){
-    pie_slice();
-    cylinder(h = wheel_depth / 2, r = 1);}}
-
-wheel();
+      circle(radius);
+      circle(radius - wall_width);}}}
+
+module motor_shaft_holder_flat(radius, flat_width, wall_width){
+  difference(){
+    motor_shaft_flat(radius + wall_width,
+                     flat_width + wall_width);
+    motor_shaft_flat(radius, flat_width);}}
+
+module motor_shaft_holder(radius, flat_width, wall_width, height){
+  linear_extrude(height = height){
+    motor_shaft_holder_flat(radius, flat_width, wall_width);}}
+
+module wheel_black(radius, width, shaft_radius, shaft_flat_width, wall_width){
+  color("black"){
+    rim(radius, wall_width, width);
+    linear_extrude(height = qr_height){
+      difference(){
+        qr_black_flat();
+        mounting_screw_flat();}}
+    translate([0, 0, qr_height]){
+      motor_shaft_holder(shaft_radius,
+                         shaft_flat_width,
+                         wall_width,
+                         width - qr_height);}}}
+
+module wheel_white(){
+  color("white"){
+    linear_extrude(height = qr_height){
+      difference(){
+        qr_white_flat();
+        mounting_screw_flat();}}}}
+
+module wheel(radius, width, shaft_radius, shaft_flat_width, wall_width){
+  wheel_black(radius,
+              width,
+              shaft_radius,
+              shaft_flat_width,
+              wall_width);
+  wheel_white();}
+
+wheel(wheel_radius,
+      wheel_width,
+      motor_shaft_radius,
+      motor_shaft_flat_width,
+      wall_width);