diff --git a/examples/PT_camera/PT_camera.scad b/examples/PT_camera/PT_camera.scad new file mode 100644 index 0000000..a4a287d --- /dev/null +++ b/examples/PT_camera/PT_camera.scad @@ -0,0 +1,54 @@ +include <../../vitamins/geared_steppers.scad> +include <../../core.scad> +include <../../vitamins/cameras.scad> +use <../../vitamins/pcb.scad> + +module ptc(ang2) { + rotate([180,0,0]) + union(){ + geared_stepper(28BYJ_48,ang2); + rotate([90,0,180-ang2]) + translate([9.8,-16.5,1.7]) + rotate([0,0,90]) + camera(cameras[0]); + } +} + +module pt(ang,ang2) { + rotate([180,0,0]) geared_stepper(28BYJ_48,ang); + rotate([0,0,ang]) rotate([270,0,0]) translate([0,-29.0,-1.5]) ptc(ang2); +} + +deg=90; +c=90; + +if($t<0.125){ + a=180+$t/0.125*deg; + pt(a,c); +}else if ($t<0.25){ + a=180+deg-($t-0.125)/0.125*deg; + pt(a,c); +}else if ($t<0.375){ + b=c+($t-0.25)/0.125*deg; + pt(180,b); +}else if ($t<0.5){ + b=c+deg-($t-0.375)/0.125*deg; + pt(180,b); +} +else if($t<0.625){ + a=180+($t-0.5)/0.125*deg; + b=c+deg-90+($t-0.5)/0.125*deg; + pt(a,b); +}else if ($t<0.75){ + a=180+deg-($t-0.625)/0.125*deg; + b=c+deg-($t-0.625)/0.125*deg; + pt(a,b); +}else if ($t<0.875){ + a=180-($t-0.75)/0.125*deg; + b=c-($t-0.75)/0.125*deg; + pt(a,b); +}else{ + a=90+($t-0.875)/0.125*deg; + b=c+deg-180+($t-0.875)/0.125*deg; + pt(a,b); +} diff --git a/gallery/PT_camera.anim.gif b/gallery/PT_camera.anim.gif new file mode 100644 index 0000000..1abf8e0 Binary files /dev/null and b/gallery/PT_camera.anim.gif differ diff --git a/gallery/readme.md b/gallery/readme.md index 6d0982b..de92e73 100644 --- a/gallery/readme.md +++ b/gallery/readme.md @@ -106,6 +106,10 @@ A base and shroud to make PSU safe to sit on a desk ![](PSU_tube.png) +## PT_camera +Two 28BYJ_48 geared stepper motors and a Raspberry v1 camera, combined with [4 drops of superglue](https://forums.raspberrypi.com/viewtopic.php?p=1810000#p1810000). Script [PT_camera.scad](../examples/PT_camera/PT_camera.scad) nicely demonstrates new 2nd optional arg (motor shaft angle) of ```geared_stepper()```. +![](PT_camera.anim.gif) + ## PotBox Potentiometer box with course and fine controls and three 4mm binding posts