Close
0%
0%

CV closeloop CNC

DC motors can drive CNC machines too!

Similar projects worth following
Most of the hobby CNC machines today uses openloop stepper motor controls, where the location is calibrated initially to a home position and then remains unchecked for the remaining run. This requires precise and accurate hardware calibration. This project aims to remove the calibration steps and replace stepper motors with the humble DC motors.

With a CNC the main goal is to get a platform to a location. This location can be specified by different coordinate systems. Currently I'm limiting the aim to a 2D plane. Most hobby CNCs use the two drive axis as the basis for the CNC's coordinate system. From a user perspective we want to print what we see on screen to a physical environment. On screen the basis are orthogonal, so we also expect the CNC's basis to also be orthogonal. This usually mean careful construction and calibration to ensure the two drive axis are orthogonal. On screen the units also constant, forming a uniform grid, this also means the CNCs have to ensure uniform 'steps', usually achieved by stepper motors.

With limited resources I was unable to construct a CNC which meets these requirements. Below is a visualization of the desired grid (black) and the grid from the uncalibrated hardware (red):

It might be slightly exaggerated but it makes a point. If the CNC was used as is to plot an item without calibration, the output will be badly distorted.

To solve this I add a feedback element which will then allow me to use the basis of the feedback device instead of the basis of the CNC. The feedback element I chose was the humble webcam. It was a iSight striped out of a long expired iMac. My experience with these cameras used OpenCV tells me that the spatial accuracy are quite impeccable. There are very little distortion, but even if there where distortion, OpenCV has a plethora of information to remove the distortion. So now the projected grid of the camera will become our reference to my CNC. A visualization with the ideal (black), camera (purple):

The two grids are close enough for now. So let the software start to implement this. The aim to to move the platform to a location observed by the webcam. Now all this might be a bit confusing right now but I'm sure a bit of code and a video will clear it all up.

  • 2 × Linear slides anything that can ensure a smooth 1D movement
  • 2 × Linear actuators anything that can convert a digital signal into linear movement
  • 1 × Webcam The higher the resolution the better
  • 1 × Calibration Checkerboard using the one used by OpenCV
  • 1 × Controller board anything to interface the computer with the linear actuators

View all 6 components

  • Plans...

    JLAM06/29/2014 at 13:41 0 comments

    After a little thinking, there is finally a direction for this project. The ideal outcome is to create a generic control board that will allow the use of any sensorless mechanical drive system in a closed loop system. The board will include basic H-bridge and servo PWM drivers so that users can just plug in simple DC motors and have a working CNC. It would be nice to have a full self calibration routine which allows the board to auto identify the axis to make it even easier to use. 

    The board will most likely have a camera, fpga and a micro. With a bit of luck the BOM should be less than $25. And with cheaper hardware, it should bring cheaper CNCs.

  • Too slow....

    JLAM04/29/2014 at 11:29 0 comments

    The dev. has slowed due to an inconsistent Z axis on the machine. The milling motor was too slow and has lead to damage to the cutting head and then the whole Z axis. And the X and Y is too slow. There are plans to upgrade the axis to a belt driven system from multiple inkjet printers. More to come when the hardware is replaced. 

  • Added a milling bit and gcode

    JLAM04/07/2014 at 12:48 0 comments

    The end goal of this CNC was to be able to mill PCB, make stencils and any other tedious tasks of fine cutting. So adding a V mill bit is getting the machine one step closer. The software has just been moved to a g-code input as oppose to a image input. 

    The bit is mounted in a head cut off from mini hand-drill, which has been soldered to the motor. The bit itself was a bit of rod with the tip ground to a V. There is very little lateral movement and can put a good scratch on a piece of aluminum. 

    The new software has issues with commanding the CNC. There are overshoots and Z-axis issues. New controls for cutting diagonal lines should also be considered. The current lines are in little steps.

  • Hardware is stable

    JLAM04/02/2014 at 21:25 0 comments

    It's not all bolted down, nor is it all off-breadboard, but the CNC is stable with ove 10hr operation time under its belt. The control board need to be isolated from the drive side due to power spiking issues, whcih may (or may not) need to be fixed. May also need add a few limit switches in case the CNC runs out of bounds while I'm out of the room. It's done it once resulting in the need to regear the motors...

    TIME FOR SOFTWARE DEV!

    Quite excited about it as the current software is horrible. Once the software is semi-presentable it will be uploaded.

View all 4 project logs

Enjoy this project?

Share

Discussions

hshawan wrote 08/23/2021 at 06:13 point

I am working on a new project and this CV project will be a helpful guide for me you can see my furniture removals website project for further details.

  Are you sure? yes | no

Adam Fabio wrote 08/11/2014 at 04:58 point

Hello JAM, You're doing great, but you need a few more details before you can move forward to the next phase of The Hackaday Prize.

By August 20th you must have the following:
- A video. It should be less than 2 minutes long describing your project. Put it on YouTube, and add a link to it on your project page. This is done by editing your project (edit link is at the top of your project page) and adding it as an "External Link"
- At least 4 Project Logs (You're golden here)
- A system design document
- Links to code repositories, and remember to mention any licenses or permissions needed for your project. For example, if you are using software libraries you need to document that information.

Don't forget to highlight how your project is 'Connected' and 'Open' in the details and video.

There are a couple of tutorial video's with more info here: http://hackaday.com/2014/07/26/4-minutes-to-entry/

Good luck!

  Are you sure? yes | no

Andrew Becker wrote 07/14/2014 at 17:12 point
I'm very interested in what you're doing, I would eventually like to include something like this on my robotic arm project. Message me if you're keen to collaborate.

  Are you sure? yes | no

JLAM wrote 07/16/2014 at 23:12 point
That sounds like a good idea. My focus currently is on a sister project to this one, the FPGA vision. Once that project is completed there should be a high speed feedback and then it's just the control loop from there.

  Are you sure? yes | no

samern wrote 07/05/2014 at 18:55 point
I am very interested to see how this goes. I've always wanted to find a use for all the motors I have harvested out of countless inkjet and laser printers. I'd also like to see how this would work if I added another axis (rotational) so that the part can be spun around and milled on any side.

  Are you sure? yes | no

JLAM wrote 07/10/2014 at 12:33 point
That is an interesting question. Maybe it would be an idea to have the camera mounted on the cutting head and then have the gray-code pattern on the work surface. This might be able to position the head relative to the work surface.

  Are you sure? yes | no

Adam Fabio wrote 06/25/2014 at 06:04 point
Thanks for dropping your endmill into The Hackaday Prize! I've often thought about doing some sort of closed loop CNC system - maybe with a wacom or other processor. Vision is really taking it to the next level.
It's been a couple of months since your last update - how is the project going? We need to hear more about it if you want to make it to space!

  Are you sure? yes | no

JLAM wrote 06/25/2014 at 21:34 point
I've been busy of late, but hopefully the next few months should see updates to this and its sister project, 'FPGA vision'. After the basic software is tidied up I am hoping to build some faster hardware to test the speed of the system.

  Are you sure? yes | no

VitoMakes wrote 06/24/2014 at 12:33 point
Good effort, what is the resolution you can achieve with the cam?
I've been thinking for some time about using an optical mouse for XY positioning. They are cheap, and they have dedicated hardware to detect at fast rates tiny movements on the surface. But you should find a way to focus the low-res camera of the mouse on the working surface, because the mouse will not lay on it. Or you can find some other arrangement for it, and let it move on another surface.
Or, if you still want to use your camera: instead of having a still camera looking at the entire working area, you could use the same principle of the optical mouse, i.e. to move the camera with the spindle, keeping the camera focused on a small area and detecting side movements. That would improve resolution.

  Are you sure? yes | no

JLAM wrote 06/24/2014 at 21:59 point
The camera is 800x600 and I was able to get ~0.1mm resolution over a 350x350mm workspace using a few subpixel routines in OpenCV. I did initially want to try the mouse sensors as I have managed to move them a far way off surface. But the sensor will only give me relative distance. I wanted an absolute XY and possibly Z location. This is why I wanted to build an FPGA vision system. Then I can use a combination of a 2D gray code and a local relative positioning system based on movement.

  Are you sure? yes | no

shlonkin wrote 05/17/2014 at 10:21 point
If you are thinking of salvaging belt systems from printers, why not pull out the rest of the hardware for their closed loop DC motor driven axes. Modern printers, at least the ones I've torn apart lately, work in exactly the way you described. They use very finely lined strips of plastic with optical sensors. You just have to find a datasheet for the sensors.

  Are you sure? yes | no

JLAM wrote 05/17/2014 at 14:19 point
Yes but that would still require acutate mounting of the axis. The idea behind this project is to use the accuracy of a camera to control two independent axis. This way the xy orthogonality is preserved without accurate hardware.

  Are you sure? yes | no

Eric Evenchick wrote 04/02/2014 at 00:26 point
From my very limited understanding of CNC machines, this is a tough challenge. Any chance we could have some more information on how you're doing the CV-based calibration?

  Are you sure? yes | no

JLAM wrote 04/02/2014 at 20:33 point
Of course, the results I've had are quite promising. I am currently tidying up the code to upload to git, after which I'll put a little more documentation on how it works.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates