Welcome! Log In Create A New Profile

Advanced

Question about using marlin in laser cutting applications

Posted by mamech 
Question about using marlin in laser cutting applications
January 21, 2017 03:34PM
hello

I found a plugin for inkscape that enables the user from generating a code for laser cutter that can be read by repetier. I drew a square and I generated this simple code:

M452
M3 S255

G90
G21
G0 F1500
G0 X47.5746 Y229.8095

G0 F100.000000
G1 X157.2381 Y229.8095
G1 X157.2381 Y133.0476
G1 X47.5746 Y133.0476
G1 X47.5746 Y229.8095
G0 F1500
G91
G90
M5 S0
G0 X0 Y0
M18


my question is, if I am using marlin with ramps 1.4, how the output will go to laser head to make it on or off ?? if I understand correctly, I will have to deactivate z axis in marlin firmware, but will the on-off signal of the laser head go to the extruder0 output in ramps?
and if this is the case, can I modify in marlin code to make the output is just a pin that goes high for on and low for off? if yes, where I need to modify this into marlin?

many thanks
Re: Question about using marlin in laser cutting applications
January 21, 2017 08:44PM
NB this is generating code for Repetier firmware M452 is only in that firmware (at least as far as teh g-code wiki is concerned)

Your code is using spindle commands to turn the laser power on/off, but it also has an enable pin (see below)

M3: Spindle On, Clockwise (CNC specific)
M5: Spindle Off (CNC specific)

see [github.com]

In the current firmware "Here G1/G2/G3 moves have laser enabled and G0 moves have it disables."

ie you need to find and update

#define SUPPORT_LASER 0 // set 1 to enable laser support
#define LASER_PIN -1 // set to pin enabling laser
#define LASER_ON_HIGH 1 // Set 0 if low signal enables laser

So if your just turning your laser on and off (because it doesn’t have a digital enable pin) use the enable pin to turn it off/on.

Hint, if your laser needs lots of power or a weird voltage use D8 on the ramps, as you can feed in any required voltage into the 11amp normally 12v supply, and it only goes to the heated bed. Don't just try and run it from an IO pin, that will probably draw to much power and kill the IO pin.

You don't lose z, you need that for focusing, you just set it to the correct height manually then hit print and it stays at that height.

Marlin doesn’t support this. (as far as im aware) you need something else, normally I've see them use a fan output and it explicitly turns the laser on and off as needed. No magic G0/G1 stuff

What plug in are you using ? this [jtechphotonics.com] ?

Edited 4 time(s). Last edit at 01/21/2017 08:59PM by Dust.
Re: Question about using marlin in laser cutting applications
January 22, 2017 12:50AM
I do not remember from where I downloaded the plugin, but it seems that what I have in an older version of the plugin that you sent me of jtechphotonics. the plugin that I have does not have "Laser On Command", and "Laser Off Command" text area.

so if I understand well now, I will need to connect the laser head to fan output, and in th plugin I will make the on command is M106 S255 and off command is M106 S00 ? This will give on-off signal during moves when needed to the laser?
Re: Question about using marlin in laser cutting applications
January 22, 2017 01:06AM
another point. I remembered why I was using the old plug in. It was dedicated for generating G code that can be read with repetier. I tried the laser plugin that you sent me, and I generated a simple output of 3 squares drawing:
M107 S0

G90
G21
G1 F3000
G1 X45.9619 Y81.4413
G4 P0
M106 S255
G4 P0
G1 F100.000000
G1 X105.6317 Y81.4413
G1 X105.6317 Y41.1238
G1 X45.9619 Y41.1238
G1 X45.9619 Y81.4413
G4 P0
M107 S0
G1 F3000
G1 X80.6349 Y178.2032
G4 P0
M106 S255
G4 P0
G1 F100.000000
G1 X152.4 Y178.2032
G1 X152.4 Y129.8222
G1 X80.6349 Y129.8222
G1 X80.6349 Y178.2032
G4 P0
M107 S0
G1 F3000
G1 X49.9936 Y266.0952
G4 P0
M106 S255
G4 P0
G1 F100.000000
G1 X99.181 Y266.0952
G1 X99.181 Y227.3905
G1 X49.9936 Y227.3905
G1 X49.9936 Y266.0952
G4 P0
M107 S0
G1 F3000
G1 X0 Y0
M18


but when I copy and past this now in repetier, the visualization does not show anything, as if it does not recognize the code!
but when I added manually in the beginning of the code :
M452
M3 S255
then repetier could darw visualization of the the code.
why is this happening? ae not there any way that the plugin put these 2 lines automatically?

Edited 1 time(s). Last edit at 01/22/2017 01:12AM by mamech.
Re: Question about using marlin in laser cutting applications
January 22, 2017 03:22AM
No idea why repetier is being brain dead... you would have to ask the developers.

The plugin is just python code.. you can edit it in a text editor, so is easy to add in the two lines

open up laser.py

find the section:
'header': """
G90
""",

replace with:
'header': """
G90
M452
M3 S255
""",

NB this is just a educated guess... but should work.


Quote
Quote:
so if I understand well now, I will need to connect the laser head to fan output, and in the plugin I will make the on command is M106 S255 and off command is M106 S00 ? This will give on-off signal during moves when needed to the laser?

Yes this is now using fan gcode command to turn the laser on and off
eg
M106 S255 laser on full
G4 P0 pause a moment
G1 F100.000000 set the feed rate (speed of move, but also how dark/deap the cut)
G1 X105.6317 Y81.4413 move
G1 X105.6317 Y41.1238 move
G1 X45.9619 Y41.1238 move
G1 X45.9619 Y81.4413 move
G4 P0 pause a moment
M107 S0 laser off

It will use what ever IO pin you have defined as the fan PIN. This is controlled by what motherboard name you give it in your firmware
egs
#define BOARD_RAMPS_14_EFB 43 // RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
#define BOARD_RAMPS_14_EEB 44 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
#define BOARD_RAMPS_14_EFF 45 // RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
#define BOARD_RAMPS_14_EEF 46 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMPS_14_SF 48 // RAMPS 1.4 (Power outputs: Spindle, Controller Fan)

Remember that D8 is what ever voltage you apply to the 11amp 12v power pins
But D9 and D10 are what ever voltage you apply to the 5amp 12v power pins, and will be 12v on normal systems. (needed by stepper driver)

I don’t know what your laser takes to power, but if this was me I would use BOARD_RAMPS_14_EEF so the laser is on D8 and you can set what ever supply it needs to the 11amp 12v power plug

If your doing something totally custom, you can edit what pin is being used for the fan by editing pins_RAMPS.h and compiling a custom firmware

NB if you get this working, please post results

Edited 1 time(s). Last edit at 01/22/2017 03:27AM by Dust.
Re: Question about using marlin in laser cutting applications
January 25, 2017 07:40AM
thank you so much, your information was very helpful!

regarding modification in plug in , I did as you said, and it seemd logical also to me, but it did not work and still the output does not change.

anyway, it is not a big problem. the hard part is already done!

thank you again
Sorry, only registered users may post in this forum.

Click here to login