Visual alignment mod for shapeoko
Posted: Wed Jan 02, 2013 10:36 pm
Hi,
One of the things I want to do with my ShapeOko is two sided PCBs or even more layers (stacking 1mm or 0.5 mm PCBs). One of the things I find frustrating is knowing where exactly the tool is specially when dealing with 0.2mm isolation and traces running next to each other if the 0.2mm spacing is not accurate one of the traces can be damage.
To help with this I have added a inexpensive USB microscope to use as an alignment assist, to get the image and cross-hair I used python and OpenCV libs (I want to do more, thus why creating my own program instead of using somethign off the shelve for image capture). It looks like this:

and it works like this:
Things to note:
1) For alignment purposes and specially when dealing whit 0.2mm you need to have your motors energized ($7=255), I found the magnetic backlash to be 0.3mm on my machine.
2) The knob to focus for these microscopes will move your image changing where the cross-hair is +/- 0.6mm, I used zip ties to hold this tightly in place. I use Z-axis to get closer or away form target, I have it set to 20.0 mm for the focus.
3) once you have attached and tight the USB microscope, measure and find out the true distance from your tool-bit to the center cross-hair, it this end being fractional you could move where the cross-hair center is so it is a more rounded number. For example my offset to target is 51.15 x-axis, 25.55 y-axis.
python code (linux):
FYI I have these packages installed. (python, python-gtk2, and python-opencv)
attaching the gcode for the USB microscope mount rings.
For the future:
By using python and Open Computer Vision Libraries (OpenCV) this opens a opportunity for some automation and computer visual recognition. Imagine being able to select something on the PCB as the target and have the machine align itself every time
hope this is useful to some one else
happy milling.
One of the things I want to do with my ShapeOko is two sided PCBs or even more layers (stacking 1mm or 0.5 mm PCBs). One of the things I find frustrating is knowing where exactly the tool is specially when dealing with 0.2mm isolation and traces running next to each other if the 0.2mm spacing is not accurate one of the traces can be damage.
To help with this I have added a inexpensive USB microscope to use as an alignment assist, to get the image and cross-hair I used python and OpenCV libs (I want to do more, thus why creating my own program instead of using somethign off the shelve for image capture). It looks like this:

and it works like this:
Things to note:
1) For alignment purposes and specially when dealing whit 0.2mm you need to have your motors energized ($7=255), I found the magnetic backlash to be 0.3mm on my machine.
2) The knob to focus for these microscopes will move your image changing where the cross-hair is +/- 0.6mm, I used zip ties to hold this tightly in place. I use Z-axis to get closer or away form target, I have it set to 20.0 mm for the focus.
3) once you have attached and tight the USB microscope, measure and find out the true distance from your tool-bit to the center cross-hair, it this end being fractional you could move where the cross-hair center is so it is a more rounded number. For example my offset to target is 51.15 x-axis, 25.55 y-axis.
python code (linux):
Code: Select all
import cv
capture = cv.CaptureFromCAM(0)
cv.WaitKey(200)
frame = cv.QueryFrame(capture)
font = cv.InitFont(cv.CV_FONT_HERSHEY_DUPLEX, 1, 1, 0, 2, 8)
while True:
frame = cv.QueryFrame(capture)
cv.PutText(frame, "ShapeOko CAM", (10,460), font, cv.RGB(17, 110, 255))
cv.Line(frame, (320,0), (320,480) , 255)
cv.Line(frame, (0,240), (640,240) , 255)
cv.Circle(frame, (320,240), 100, 255)
cv.ShowImage("Window",frame)
c = (cv.WaitKey(16) & 255)
if c==27: #Break if user enters 'Esc'.
break
Code: Select all
sudo apt-get install python python-gtk2 python-opencv
For the future:
By using python and Open Computer Vision Libraries (OpenCV) this opens a opportunity for some automation and computer visual recognition. Imagine being able to select something on the PCB as the target and have the machine align itself every time

hope this is useful to some one else
