-
Notifications
You must be signed in to change notification settings - Fork 541
Probe Camera Alignment
flaplante edited this page Apr 3, 2016
·
14 revisions
The Camera alignment system permits the user to align in X/Y with accuracies of the order of tens of micrometer using a web camera mounted on the Z-axis next to the spindle.
- The camera alignment system requires the presence of python-opencv module
- Select the camera from "Tools -> Config -> Camera".
- Select the appropriate rotation.
- Note: for the moment v0.9.2 the configuration is disabled, you have to manually edit the .bCNC file
note: Be sure you have also installed PIL, OpenCv, ImageTk for your Python.
Any USB camera that can be recognized by opencv will work with bCNC. In my machine
- I've bought a cheap web camera, with a clip that mounts on top of the laptop screen. The resolution is a bit crapy 352x288, despite that it gives very nice results.
- I removed the plastic cover and milled a plexiglass base.
- I've inserted the camera PCB using a double sided adhesive tape.
- On the side I've added 2 high power leds connected to the USB 5V via a 100Ohm resistor. The resistors are used to reduce a bit the light from the high power leds otherwise the camera is blinded.
- I've adjust the lens of the camera to focus to the appropriate distance.
- Note: Focusing at small distances the camera distorts a lot the image like a fish eye lens
- The plastic base is mounted on an aluminium angle with 3 screws and a spring in between to align the camera perpendicular to the X-Y plate.
- I've mounted the camera with an aluminium bar that I've drilled a few holes to adjust the height. I can go from 1cm up to 4cm height with respect to the spindle. At 1cm I have a spatial resolution of about 20um and at 4cm around 80um. Most of the time I keep it at 4cm to have bigger clearance with respect to the spindle.
- Turn on the camera visualization from the tool bar on top of the Canvas.
- First jog the spindle to some location on top of a scrap material.
- Turn on the spindle and jog inside the scrap to drill a small hole 1-2mm is enough.
- Move upwards the spindle to a safe height.
- Note: All calibration and motion of the camera will be performed with this height.
- Go to 'Probe->Camera' and click on 'Register' 1.Spindle
- Jog the camera to center the hole.
- At this point you can set the Diameter of the tool used in the Camera dialog
- Experiment with the Scale so that the cross hair circle fits exactly the hole. Note: this step is not important but gives nicer visual results.
- With the hole fitting exactly on the cross hair, click on 'Register' 2.Camera
- The offset of the camera with respect to the spindle should be displayed in the input fields.
- Calibration is complete.
- This is an example on how to orientate the g-code to fit the object present in the machine.
- For testing I've placed at a random position and orientation a PCB that I've made some time ago.
- Switch to the camera system, by clicking the "Switch" button on the ribbon. The button is creating a virtual offset with G92 on the present workspace so as the center is moved to the camera location.
- By switching back to the spindle, the offset is canceled with a G92.1 command
- Change to the "Probe -> Probe" tab
- In the PCB the holes are 0.6mm, so I set the Diameter to 0.6mm
- Jog the camera to a known location. In this example I've used a couple of drilled holes.
- Click on the Orient -> Add button
- Click with the mouse to the line on the center of the hole. Note: there is a snapping mechanism in bCNC, that will snap to the closest gcode control point
- Jog to the 2nd marker
- Zoom and align the camera on the second marker
- In this quick example I had to make steps of 20um to align the holes
- Click on Orient->Add
- Click on the second marker gcode point on the canvas
- Repeat with a 3rd marker
- Add the 3rd marker
- Note: 2 markers are sufficient, but the more you provide the more accurate the system is going to be determined. bCNC is solving an overdetermined system to find the best match.
- Note: observe always the error for each marker. If too high you can move the marker with the mouse or delete and add again.
- At this point clicking on the Orient -> Orient button the gcode will be transformed to match the markers.
- I've changed the location of the Camera display from Bottom Right to Gantry so that the camera image follows the gantry location when displayed in X-Y
- Inspect some points and see the camera image with the gcode overlay.
- Note: The image distortion from the macro focusing is visible. The gcode is matching close to the center but at larger distances is distorted.