Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Probe Camera Alignment
Probe Camera Alignment
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: 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. One option is to buy an USB endoscopic camera. They are cheap and come with a long cable and LEDs. Resolution should be 640x480. Note that the wiring for these cameras is very susceptible to electromagnetic interference, which could cause your camera to malfunction, especially when the gantry is moved and/or the spindle is on. It is critical that the machine be properly grounded to prevent damage to the system.
Another option is this:
- I've bought a cheap web camera, with a clip that mounts on top of the laptop screen. The resolution is a bit crappy 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 centre the hole.
- At this point you can set the Diameter of the tool used in the Camera dialogue
- 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.
Advanced camera calibration (experimental and subject to change)
If you can't set your camera straight, you can follow the step-by-step procedure below. The theory behind this method is that if the camera is not too tilted, there is always a line orthogonal to the bed and passing through the camera lens.
Jog the gantry to align the camera on top of a "vertical" or "horizontal" line (along the X or Y axis). You can mill (or engrave with a laser) such a line beforehand.
Set the rotation in the Probe/Camera form, so that the line looks straight on the picture.
Now jog the camera on top of a point. You can mill or engrave it beforehand.
Jog(Z) the gantry as low as possible, and jog(X+Y) so that the point is in the center of the haircross.
Jog(Z) the gantry as high as possible.
Adjust the Haircross Offset values (X and Y) so that the haircross match the point.
Go back to 4., repeat until the haircross match the point at any Z height.
Alternate method to find Haircross Offset: 3. Place a mirror flat under the camera 4. Jog(Z) the camera as high as possible 5. Adjust Haircross Offset to match the haircross and the camera lens