2

I making an Arduino-based X-Y laser cutter. I've built the mechanics for it and accomplished basic motion, but I am having trouble getting it to plot lines and curves. I eventually want to be able to convert SVG or Illustrator files to Gcode or have the Arduino interpret and plot them directly

A picture of my setup.

There are libraries like GRBL and Rstepper that provide 2-wire (step and direction) instructions based on Gcode. The problems is that I'm driving two stepper motors using ULN2003 chips, which use 4 wires to step through the phases of the motor.

Could I make either of these libraries work for 4-wire control?


If not, I will need to find another way to plot my designs.

How I'm currently thinking of making functions for SVG or G-code style instructions.

//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 that be too slow?

Corey
  • 29
  • 3

2 Answers2

1

Having been down this road and wasted much time, I would strongly suggest that you just get a couple of Easy Drivers for $15-$20 ea. and move on with your project using GRBL. It is a great library and there is a nice Java-based open source laser cutter front end project called Visicut. Visicut can handle either SVG files or gcode.

If you must use the chips you have, the Connecting Grbl pages lists this site Driving stepper motor using ULN2003 but cautions: "It is out-dated and uses Grbl v0.7."

(But seriously, hardware choices because "that is what one has" rather than what might be easier to implement can really suck the joy out of a fun hacker project like you have going)

spring
  • 18,009
  • 15
  • 80
  • 160
  • I would upvote if I had enough reputation. Thanks for the comment. As for the Easy Drivers, I had feared as much. Visicut is a great lead. I might still try to solve the X-Y plotting for ULN2003 problem to avoid putting my sub-$100 project over. It might still be a fun way to learn more about engineering using geometry. Unfortunately, the links provided (which I've seen a couple other places) don't seem to contain the actual info. The content must have been gutted or moved. Thanks again! – Corey Aug 06 '14 at 18:10
  • @Corey - heh...ok, so you are going down the rabbit hole. take notes! (seriously). You will want to check out Bresenham + DDA line algorithms (breaking curves into straight lines - that is how it is done). The GRBL source code also has good comments in it @ motion profiles (acceleration control). The RepRap project has various open source branches which do motion control and which might be easier to understand/hack (because they are more verbose/less efficient than GRBL) Have fun! :-) – spring Aug 06 '14 at 23:43
  • You replied forever ago. Your answer was great. For anyone else looking, I've stuck with GRBL for both this laser cutter and a 3D printing project. GRBL executes GCode and a variety of things can interface with it. I use Illustrator to make an SVG then convert it using either Inkscape with a GCode plugin called Unicorn. To send this GCode to the microcontroller running GRBL, I use UGS (Universal GCode Sender) when I have a file or gctrl for Processing for custom programs (like auto-generating zen garden patterns on a sand drawing bot). – Corey Sep 08 '15 at 15:44
0

I might be late, but there are a few modified versions of GRBL that support unipolars now. Here are the links:

Note that in my testing the x/y axis invert messed everything up. It might be because I'm using a coreXY setup though.

Arca Ege Cengiz
  • 315
  • 3
  • 16