K40 not cutting curves

236 views
Skip to first unread message

Anthony Bolgar

unread,
Nov 22, 2015, 8:59:45 AM11/22/15
to Opensource Laser
I am having a major issue with Turnkey Tyranny's inkscape gcode exporter. I upgraded the controller of my K40 to an arduino/ramps rontroller, and when I use Turnkey's gcode exporter, the K40 will only power up the laser on straight lines. as soon as it reaches a curve or circle in the gcode, it powers down the CO2 laser, then powers back up as soon as it reaches another straight line. It will cut diagonal lines as well, only has a problem with curves. Any idea of what is going on with this?

ajf

unread,
Nov 22, 2015, 3:23:35 PM11/22/15
to Opensource Laser
Hi Anthony,

Please attach your gcode file.  

Also, are you running the latest version of the plugin (if not, which version) and what firmware and branch thereof are you running?

regards,
aj

Anthony Bolgar

unread,
Nov 26, 2015, 11:36:20 PM11/26/15
to Opensource Laser

Here is a gcode file it made of a simple circle.

circle.g

ajf

unread,
Nov 27, 2015, 12:23:42 AM11/27/15
to Opensource Laser
Okay, give this a try.

I have fix for this issue. Will post it to my GitHub as soon as a figure out fork a branch from a fork of my own fork... 
circle.g

Anthony Bolgar

unread,
Nov 27, 2015, 8:46:54 AM11/27/15
to Opensource Laser
Comparing the two files I noticed that the only difference was the addition of the M3 spindle start command. What was causing my installed version to omit this command?

ajf

unread,
Nov 27, 2015, 1:01:27 PM11/27/15
to Opensource Laser
I put that M3 in by hand.

Try this version: https://github.com/ajfoul/thlaser-inkscape-plugin/tree/Turnkey

Anthony Bolgar

unread,
Nov 27, 2015, 2:04:02 PM11/27/15
to Opensource Laser
One problem using the M3 command, it turns the laser on immediatly and cuts while rapid traveling to it's start position.


Anthony Bolgar

unread,
Nov 27, 2015, 2:19:44 PM11/27/15
to Opensource Laser
The new fork you posted does not cut circles, just like before. I have attached the gcode it produced. Thanks for all your help in trying to resolve this.


new_circles.g

ajf

unread,
Nov 27, 2015, 3:30:29 PM11/27/15
to Opensource Laser
Hmm, I'll take a closer look. 

I haven't been using Inkscape for cutting since I got the Fusion360 Smoothie post processor going.  Did the hack on this branch of the plugin just to do some vector etching from an image.

ajf

unread,
Nov 27, 2015, 5:51:30 PM11/27/15
to Opensource Laser
Okay, so I just pushed an update. But, it's really minor. Just placed the M3 properly on it's own line at the top of the block and added a space before the S parameter in a few spots where it was missing. Please note that I have not tested this very thoroughly, just a simple circle. Will send a pull request to Turnkey so others can have a closer look.

The attached gcode cuts as expected on my machine. Made the path such that it does G2 then G3 with G1 between.

Smoothie should never fire the laser on G0 (and it doesn't for me), there may be something going on with your config (please attach) or perhaps something on the hardware side.


On Friday, November 27, 2015 at 11:19:44 AM UTC-8, Anthony Bolgar wrote:
test_circ.g

Anthony Bolgar

unread,
Nov 28, 2015, 3:09:25 AM11/28/15
to Opensource Laser


I am not using a smoothieboard, I am using a ramps 1.4/arduino combo.

ajf

unread,
Nov 28, 2015, 7:15:50 AM11/28/15
to opensour...@googlegroups.com
Sorry, I didn't notice the S parameter in your gcode was RAMPS format.  Still, it shouldn't fire on G0 and I think the output is right.

Can you point me to the firmware version you are using? And any configuration changes you may have made. Also, info about your specific hardware setup i.e. if your PSU uses one pin for fire/intensity or two separate pins, fires on LOW or HIGH. Basically, the more info the quicker I can figure out what's going on.

I only had RAMPS/Marlin in my machine for a couple of days when I first got it in summer 2014, so I've forgotten some of the specifics.

Anthony Bolgar

unread,
Nov 28, 2015, 9:06:17 AM11/28/15
to Opensource Laser
OK, I will put together a list of firmware, hardware, software etc. for you. If I forget to put something in the list, just let me know and I will get the info to you as soon as possible, I really appreciate all the help you are giving me.


Anthony Bolgar

unread,
Nov 30, 2015, 3:11:42 AM11/30/15
to Opensource Laser
Here is my list of hardware/firmware/software.

Hardware:
K40 chinese laser with analog mA meter
Stock exhaust fan
Small airbrush compressor for air assist
3D printed air assist nozzle with laser alignment pointers
Arduino Mega 2560
Ramps 1.4

Firmware version:
https://github.com/TurnkeyTyranny/buildlog-lasercutter-marlin

Software version:
https://github.com/TurnkeyTyranny/laser-gcode-exporter-inkscape-plugin
also tried the forked version of yours that you linked to
PrintRun (formerly Pronterface)


Hope this info helps and if I have forgotten anything please let me know.


Regards,
Anthony Bolgar


ajf

unread,
Nov 30, 2015, 3:19:12 AM11/30/15
to Opensource Laser
How about the connection to the Laser PSU? Is it one or two pins? And are you firing on LOW or HIGH?  Also, could you attach the configuration.h from the Marlin build you installed if you made any changes there...

ajf

unread,
Nov 30, 2015, 3:09:37 PM11/30/15
to Opensource Laser
In buildlog-lasercutter-marlin/Marlin/Configuration.h make sure the following is uncommented, should be around line 91:

define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5

If it is commented that would explain why it only fires on straight lines (G01) and not arcs (G02/G03).  Wouldn't explain why it fires on traversal moves (G00) though...


On Monday, November 30, 2015 at 12:11:42 AM UTC-8, Anthony Bolgar wrote:

Anthony Bolgar

unread,
Dec 1, 2015, 12:14:36 PM12/1/15
to Opensource Laser
My connection to the PSU is as follows:

D5 from the ramps board connects to "Laser fire"
D6 from the ramps board connects to "Laser pwm"


I am pretty sure it is firing the laser on "High"
"define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5" is uncommented in config.h


Configuration.h

ajf

unread,
Dec 1, 2015, 12:49:18 PM12/1/15
to Opensource Laser
Hmm, the attached config shows:

//// The following defines select which G codes tell the laser to fire.  It's OK to uncomment more than one.
#define LASER_FIRE_G1 10 // fire the laser on a G1 move, extinguish when the move ends
#define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5
#define LASER_FIRE_E 12 // fire the laser when the E axis moves

//// Raster mode enables the laser to etch bitmap data at high speeds.  Increases command buffer size substantially.
#define LASER_RASTER
#define LASER_MAX_RASTER_LINE 68 // maximum number of base64 encoded pixels per raster gcode command
#define LASER_RASTER_ASPECT_RATIO 1.33 // pixels aren't square on most displays, 1.33 == 4:3 aspect ratio
#define LASER_RASTER_MM_PER_PULSE 0.2

Which doesn't make much sense as I don't think with that config Marlin would fire the laser at all.

I'd say good next step is to pull the latest version of Turnkey's Marlin, uncomment the above in the fresh configuration.h, build and flash board. Would recommend first uploading the Sketch>Import Library...>EEPROM sketch to the board to clear things out.

regards,
aj

Anthony Bolgar

unread,
Dec 3, 2015, 8:05:40 AM12/3/15
to Opensource Laser
It still has the same problem. One thing I noticed is that for curves, the inkscape pugin is creating G2 mnove commands, which in the config file is not defined, only G1, M3/M5 and Eaxis commands will fire the laser. How do I get around this, can I just add a new definition for the G2 command?


ajf

unread,
Dec 3, 2015, 10:45:44 AM12/3/15
to Opensource Laser
No. Just adding a define wouldn't do anything, as there would be no code behind it.

Just having laser_fire_spindle uncommented should be sufficient to work with the gcode we're generating.  

Laser_fire_G1 is really only useful if you're generating gcode that is all straight line cuts.  I think it's actually just there because the early version of the plugin didn't ever generate G2/G3, but turned arcs into a series of line segments. And, laser_fire_E is there to support gcode generated by a slicer. I don't think either are particularly useful now.

I get the feeling I'm missing something basic. Or there is some issue with feeding the machine via printrun, I've only ever used the LCD to run gcode off the SD card. Will make a mock RAMPS/Marlin machine later today and see if that helps me figure it out.

Though I don't think the issue is the gcode itself, now that M3 is there, please give the attached file a go.  It's a simple rectangle with some holes, a part I made as a replacement bed for my MOD-t 3D printer and generated from Fusion360.  It's got intensity set at 30% and pretty rapid movement, so I'd run it on some cardboard.

regards,
aj
mod-t_bed.g

ajf

unread,
Dec 3, 2015, 4:22:14 PM12/3/15
to Opensource Laser
Um, yeah, I'm an idiot! I'd totally forgotten # isn't a comment for Arduino/cpp...

ajf

unread,
Dec 3, 2015, 4:36:23 PM12/3/15
to Opensource Laser
And..., to embarrass myself further!: The EEPROM clear sketch is at File>Examples>EEPROM>eeprom_clear

Suppose that's what I get for not working with Arduino for 18+mos...

Sorry.

Anthony Bolgar

unread,
Dec 3, 2015, 7:06:31 PM12/3/15
to Opensource Laser
Manually adding M3/M5 commands works just fine, but I don't want to have to hand edit each gcode file.

ajf

unread,
Dec 3, 2015, 8:34:25 PM12/3/15
to Opensource Laser
Wait. What? I'm confused now.  I thought the gcode from my fork of Turnkey's plugin was inserting M3/M5 properly, but that your machine was still not firing on arcs.

Did the mod-t_bed.g file work?

Anthony Bolgar

unread,
Dec 4, 2015, 12:46:45 AM12/4/15
to Opensource Laser
Sorry about that, I thought that you had manually added the M3/M5 commands to that file. I want to reflash my arduino board and will test the file again in the morning. Once again sorry for the confusion.

ajf

unread,
Dec 4, 2015, 12:56:34 AM12/4/15
to Opensource Laser
No worries! I only manually edited the first gcode file you attached (circle.g), everything else was generated by either my fork of Turnkey's plugin or Fusion360. Fusion360 (free for non-commercial use) is worth a look for vector cutting, might have a steeper learning curve than Inkscape, but it's very powerful and there are lots of tutorial videos.  I've got a Marlin compatible post processor posted at GitHub (marlin.cps)

Anthony Bolgar

unread,
Dec 4, 2015, 1:41:29 AM12/4/15
to Opensource Laser
OK, loaded the gcode file you attached and it cut a straight linr from top to bottom on the left hand side, cut the first circle, but after that it only cut straight lines. It seens that it needs an M3 command befor every arc command.


ajf

unread,
Dec 4, 2015, 1:46:10 AM12/4/15
to Opensource Laser
Darn! That shouldn't be.  

I've only got the motion part of my mock up done so far, need to wire up a couple LEDs to signal fire and intensity. Hope to get that done tomorrow.

But, at least it didn't fire on the G00 traversal moves, right?

regards,
aj

Anthony Bolgar

unread,
Dec 4, 2015, 2:41:10 AM12/4/15
to Opensource Laser
Correct, at least the G0 moves do not fire....baby steps....one at a time....lol!

ajf

unread,
Dec 5, 2015, 4:43:20 PM12/5/15
to opensour...@googlegroups.com
Okay, so the mock up wasn't as useful as I'd hoped. The LEDs aren't giving me the feedback I was expecting nor is the multimeter.  However, the LCD seems to be indicating that it's firing when expected.  Will tinker more...

Anthony Bolgar

unread,
Dec 5, 2015, 5:31:38 PM12/5/15
to Opensource Laser
What are my other options in the way of software to use with an arduino/ramps setup?

ajf

unread,
Dec 5, 2015, 6:46:53 PM12/5/15
to Opensource Laser
I think there is a Repetier version for lasers, but honestly I'm not sure...  You might try posting a new topic and/or filing an issue on Turnkey's github.  

I'll keep looking in to it, but I'm pretty out-of-date...

Anthony Bolgar

unread,
Dec 7, 2015, 2:02:12 PM12/7/15
to Opensource Laser
Found this on Turnkey Tyranny's inkscape plugin main page:

07-March-2015 - Marlin codebase mod : You need to patch the Marlin codebase to turn on the laser before moving for G02 and G03 commands. This plugin assumes this has been done. More details to come in the future. Copy the code from the G01 above in marlin_main.cpp - This change has been put into my version of the Marlin Laser firmware found here https://github.com/TurnkeyTyranny/buildlog-lasercutter-marlin


This is exactly the problem I have been having, not sure why my installation does not do this, I am running the firmware he linked to in which this change was supposed to be made.


Anthony Bolgar

unread,
Dec 7, 2015, 3:08:33 PM12/7/15
to Opensource Laser
Success!!!! For some reason the arduino IDE was using an old version of the file, deleted that one, re dowbnloaded current one and presto...it works. Thanks for all the help you have given me.

ajf

unread,
Dec 7, 2015, 3:16:44 PM12/7/15
to Opensource Laser
Great!

I was just about to post that the configuration.h you attached didn't seem to match the current version of Turnkey's

Anthony Bolgar

unread,
Dec 7, 2015, 5:22:56 PM12/7/15
to Opensource Laser
New issue, circles do not process correctly, the laser head jogs in a straightline about 20% into the file, and then continues the circle, kind of looks like a PacMan.

ajf

unread,
Dec 7, 2015, 6:12:21 PM12/7/15
to Opensource Laser
Could you post it as a new topic and provide the relevant files please. This sounds more like an Inkscape/plugin issue.

Anthony Bolgar

unread,
Dec 9, 2015, 7:22:12 AM12/9/15
to Opensource Laser
Resolved the pacman issue, it was a corrupt installation of inkscape, re installed and it is working perfectly. Love being able to have a workflow that doesn't use the craptacular K40 corel plugin. My process is now:

Design in CorelDraw X7
Export as SVG file
Load file in Inkscape
Run Turnkey's plugin
Load onto SD card and cut/engrave from card, or load using Pronterface and cut/engrave

Reply all
Reply to author
Forward
0 new messages