How to make smooth curves for CNC?
I am making an Arduino based XY laser cutter. I built a mechanic for this and did some basic movement, but I am having trouble drawing lines and curves with it. Ultimately I want to be able to convert SVG or Illustrator files to Gcode, or interpret Arduino and build them directly
There are libraries like GRBL and Rstepper that provide two-wire (step and direction) instructions based on Gcode. The problem is that I am driving two stepper motors using ULN2003 chips that use 4 wires to pass the motor phases.
Can I get any of these libraries to work for 4-wire control?
If not, I will need to find another way to build my projects.
How am I currently thinking about creating functions for SVG or G-code style statements.
//given a new position to go to and how we want to get there (i.e. curves)
for (i=0;xposition!==newx;i++) //run until x gets to the right spot
{
//get the values for X, Y, NewX, NewY, and any other parameters (e.g. for curves)
//figure out how many steps (say, +1 or -1) x should take for cycle number i
//figure out how many steps y should move given new x
//make the x stepper step the right number of steps
//make the y stepper step the right number of steps
//delay (control speed for adequate laser burning & don't make the steppers angry)
}
Will it be too slow?
source to share
After this road and spent a lot of time, I would strongly suggest you just get a pair of Easy Drivers for $ 15- $ 20 ea. and go to the project with GRBL. It's a great library and there is a nice open source Java project for laser cutters called Visicut . Visicut can handle SVG or gcode files.
If you must use the chips you have, the Grbl Connecting pages list this site Stepper Motor Drive using ULN2003 , but cautions: "It's outdated and uses Grbl v0.7."
(But seriously, hardware choices, because "what has who" rather than what might be easier to implement can really quench the joy of a fun hacking project the way you do it)
source to share