Welcome! Log In Create A New Profile

Advanced

Mega RAMPS Marlin gcode & TTL laser

Posted by Xonk61 
Mega RAMPS Marlin gcode & TTL laser
January 29, 2018 05:53PM
I have been piecing together a machine that I hope will one day become a 3D printer, but for now am just wanting to get the X Y axes to enable a laser engraver/cutter to function. All the framework, steppers, and assorted electrical bits have come from repurposed parts, old scanners, photocopiers, printers, etc.

I did buy the Arduino Mega2650 with RAMPS board and LCD, as well as a laser module, which included the 450nm laser, lens assembly, driver board, with 3 wires for power supply and TTL control.

I've read a lot, on the Marlin pages, gotten the gcode plugin to work with Inkscape, and browsed through this forum, and found many useful tips.

However, I'm now at a loss for how to make the laser work once I give it a file to engrave.

The laser module's power source can use +12V, so it is connected to the RAMPS D9, and the TTL wire is connected to the servo pin 6. I've modified my marlin files to reflect the hardware I've set up. On the LCD module there is a controller that lets me set fan1 from 0-255 and fan2 from 0-255, and the laser comes on at full power. By reducing the value for fan2, I'm able to control the power output of the laser. However, when using a file on the SD card, the gcode is apparently not addressing those pins correctly, and the laser does not light up at all.

I'm not certain if I need to make further modifications to the Marlin firmware, or edit the gcode. Or perhaps I ought to use a different pin for the TTL, and use the M42 function in the gcode file to turn on a pin and adjust the power level there.
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
January 29, 2018 06:58PM
... I'm using the encoder motor step pin for TTL pulsing -- but too, with a small Arduino (Pro Mini clone) to set the pulse-width depending on wished power: mostly 5 to 30 Microseconds pulse duration for engraving, up to 300 Microseconds and slower speed for cutting ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
January 30, 2018 04:00AM
There are several inkscape plugins for lasers, which one do you use?
Can you give us a sample of a gcode file?
Re: Mega RAMPS Marlin gcode & TTL laser
January 30, 2018 10:00AM
The plugin I use is JTech Photonics,

a 100 mm square, exported to gcode yields the following:

M106 S0 S0

G90
G21
G1 F400
G1 X12.3929 Y31.9528
G4 P0
M106 S255 S120
G4 P0
G1 F400.000000
G1 X40.2671 Y31.9528
G1 X40.2671 Y4.0785
G1 X12.3929 Y4.0785
G1 X12.3929 Y31.9528
G4 P0
M106 S0 S0
G1 F400
G1 X0 Y0
M18
Re: Mega RAMPS Marlin gcode & TTL laser
January 30, 2018 12:19PM
The M106 lines look wrong to me. It seems like it wants to control both fans with one command. Never seen that before.
Also the size of the square is much smaller than 100mm.
Re: Mega RAMPS Marlin gcode & TTL laser
January 31, 2018 03:32PM
I see what you say about the M106 command. In the window for the Laser tool I have set M106 S0 to turn laser off, m106 S255 to turn it on, and then in the laser power 120. I'm not sure why it puts the S0 on the line twice, but when I edit the gcode file to remove the duplicates, it still doesn't turn the laser on. Gcode is not controlling the laser.
Re: Mega RAMPS Marlin gcode & TTL laser
May 14, 2018 09:53PM
i am in the same boat but slightly ahead of you...i think.

tevo tarantula, running marlin.
reassigned fan control to pin 11 (one of the servo outputs on the mks base v1.4 the tarantula uses)

i just saw this issue on the repetier forum, and it made me realise something...

when you run as a 3d printer...

if you enter the m106 s*** command via host, the laser comes on, m107 turns it off. or the fan in a standard configuration.

but when you are printing from g-code...it can take a few MINUTES for the fan to respond to the m106 command.

this appears to be the problem with the event timers or something, as well as the way the PWM is implemented.


coding for me is still like reading gobbledy gook...

as far as i can tell, you have to have the laser controlled by its own event timer that takes priority and responds to the m106 command instantly rather than having this several line lag like the fan does.

as a cooling fan, its not terribly critical to have it come on instantly to the required speed. (except for bridging moves?)

as a laser driver, it does.

then the PWM of marlin is way too low to be useable... at 500mm/min feed, i get almost a millimeter between pulses. i end up with a cool pattern but not a continuous line...

i will figure it out one day, but so far.... not much success.

Edited 1 time(s). Last edit at 05/14/2018 09:55PM by headsmess.
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
May 15, 2018 02:41AM
... guess, why I'm using the extruder STEP clocks to pulse my laserdrivers winking smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
June 02, 2018 12:28PM
VICTOR! can you develop the topic of TTL laser power control using STEP extruder? How does it look like?

Edited 1 time(s). Last edit at 06/02/2018 12:30PM by qulet.
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
June 02, 2018 04:08PM
... hmmm ... it's as simple, as feeding the pin for the extruder STEP to the TTL-input pin of the laser driver ... eventually you have to add a "level changer" (e.g. a TTL line driver or transistor circuit), if the TTL input of the lser driver won't run with the 3,3V from an ArduinoDue ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
August 12, 2018 09:17AM
Quote
VDX
... hmmm ... it's as simple, as feeding the pin for the extruder STEP to the TTL-input pin of the laser driver ... eventually you have to add a "level changer" (e.g. a TTL line driver or transistor circuit), if the TTL input of the lser driver won't run with the 3,3V from an ArduinoDue ...


how do you change the pwm to change the laser power? (assuming it's still running as a 3D printer but with the laser).

i'm thinking speed up the X and Y and the extruder speed speeds up to match?
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
August 12, 2018 09:39AM
... I'm using a small Arduino (Arduino Pro Mini clone) as an "intelligent" controller in my laser modules or as driver-interface.

The input signals are e.g. the STEP pulses, meant for the extruder stepper and an analogue voltage 0V-5V, regulated either by the CNC-controller (e.g. 12Bit-DAC of the ArduinoDue, "up-shifted" from 0-3,3V to 0-5V) or set with a trimpot ... and a "laserON" signal, to define, if the pulses have to be converted to laser output ...

With startup (or a reset-pulse) this "intelligent" laser controller reads the analogue voltage and defines the pulse-length between 5 microseconds at 0V to 300 microseconds at +5V.

Then, with the input "laserON"=+5V, every detected pulse will create a laser pulse with the set length (5 to 300µs) ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
August 12, 2018 09:41AM
Quote
VDX
... I'm using a small Arduino (Arduino Pro Mini clone) as an "intelligent" controller in my laser modules or as driver-interface.

The input signals are e.g. the STEP pulses, meant for the extruder stepper and an analogue voltage 0V-5V, regulated either by the CNC-controller (e.g. 12Bit-DAC of the ArduinoDue, "up-shifted" from 0-3,3V to 0-5V) or set with a trimpot ... and a "laserON" signal, to define, if the pulses have to be converted to laser output ...

With startup (or a reset-pulse) this "intelligent" laser controller reads the analogue voltage and defines the pulse-length between 5 microseconds at 0V to 300 microseconds at +5V.

Then, with the input "laserON"=+5V, every detected pulse will create a laser pulse with the set length (5 to 300µs) ...


ahhhh, ty.
Re: Mega RAMPS Marlin gcode & TTL laser
November 20, 2018 03:18PM
Can you share the arduino batch and connection scheme?

Edited 1 time(s). Last edit at 11/20/2018 03:20PM by qulet.
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
November 20, 2018 04:05PM
... no, sorry -- this "intelligent driver" is the core of my comercial modules too, so actually not meant for OS sad smiley

But, if you can handle the pulse control on your own, then my other "discrete" constant-current driver schematics could be usefull:








Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
November 22, 2018 11:02AM
Thank you, I am interested in controlling the TTL laser power with dir and step signals via arduino. I am looking for a working scheme and charge to the microprocessor.
Unfortunately, I can not program the microprocessor myself.
VDX
Re: Mega RAMPS Marlin gcode & TTL laser
November 22, 2018 02:22PM
... a simple hint - search for a sample to the interrupts -- then every level change on the interrupt pin will result in a call of a routine, which can set a pin for a specific time to HIGH and release it again ... so a short STEP-pulse (or simply the level change) routed to an interrupt pin will output a pulse with the set time to another pinwinking smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Mega RAMPS Marlin gcode & TTL laser
January 29, 2019 11:40AM
Hi Xonk61,

Sounds to me like I have a similar setup as you, but with a 2.5w laser.... I want to have the TTL control the laser.. so far I have tried the D9 with 7805 to TTL.. the remapping to pin 44 and I can't get the laser to do anything it just comes on a full power..no control..remapping didn't work either!

With your 12V connected to RAMPS D9 and TTL to pin 6 what Marlin firmware changes did you need to make? do you have a wiring pic you could show? what version of Marlin? I have 1.1.9 - I can also use the LCD to set fan from 0-255 under temperature - control - fan...I've done so much reading my head hurts!.. but I still can't figure it out sad smiley hope you may be able to assist...
Re: Mega RAMPS Marlin gcode & TTL laser
January 29, 2019 01:13PM
Is a 7805 going to be fast enough? I'd just take the 5V signal from the input to the MOSFET on the RAMPS.
Sorry, only registered users may post in this forum.

Click here to login