diff --git a/common.scad b/common.scad index e7f6b19..eb0947b 100644 --- a/common.scad +++ b/common.scad @@ -211,4 +211,38 @@ module geared_motor () { translate([-(46 / 2) + 14.5, 0, -(1 / 2) - 10.5]) cylinder(r = 13 / 2, h = 1, center = true, $fn = 60); //mount pads translate([-0.5, 0, -(1.5 / 2) - 10.5]) motor_mounts(); +} + +module opto_endstop () { + difference(){ + union(){ + // base PCB + color("green") cube([33.0,1.6,10.5]); + // add the switch module + translate([8.4,1.6,10.5/2-6.4/2]) optoswitch(); + // connector + translate([0.2,-7,0]) color("white") cube([5.8,7,10.5]); + // led + translate([3.5,1.6,10.5/2-1.5/2]) color("red") cube([2,0.7,1.5]); + } + translate([8.4,0,10.5/2-6.4/2]) { + for ( hole = [2.75,24.5-2.75] ){ + rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40); + } + } + } +} + +// switch module +module optoswitch() { + difference(){ + union (){ + color("gray") cube([24.5,3.5,6.4]); + color("gray")translate([6.63,0,0]) cube([4.45,11.3,6.3]); + color("gray")translate([13.63,0,0]) cube([4.45,11.3,6.3]); + } + for ( hole = [2.75,24.5-2.75] ){ + rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40); + } + } } \ No newline at end of file