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 02: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 03: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
Re: Mega RAMPS Marlin gcode & TTL laser
January 30, 2018 01: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 07: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 09:19AM
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 12: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.
Sorry, only registered users may post in this forum.

Click here to login