Laser Focus Script

I finally got my laser built and put together. I was having a hell of a time focusing it, turns out because it really isn’t super precise.±5mm seems to be okay.

I Use this script in Repetier to draw 10 lines each with 2mm added to the z height. So get the focus close, then intentionally go closer.I run the script 2 or 3 times to get the effect. You can see fatter lines and skinnier lines. Once you get to the end subtract 2mm for each line, down, you need to go. Then reset the Z0.

So for the attached picture I would step the z down 32mm and reset the Z axis to 0.

The heart of it,

G91

M106 S255 - turns the laser on, full power
G1 X50 F750 - move X +50
M107 - Turns laser off
G1 Y1 F6000 - move Y +1mm
G1 Z2 F2000 - Move 2 +2mm
G0 X-50 F6000 - Move X back to the beginning

G90

So x’s 10

G91

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

M106 S255
G1 X50 F750
M107
G1 Y1 F6000
G1 Z2 F2000
G0 X-50 F6000

G90

Looks like this, you can run it a few times to make it more clear where the sweet spot is.

1 Like

Blast from your past Ryan ; )

Would this run if I save it off and load it to the SD? Is the gcode above copy and paste able?

Yeah, but wow…we need to slow that down. 100mm/s what the heck was I thinking?!

Change the Z rapids to 480 (or a little less), and the XY rapids to ~1800.

Hmmm, I had no idea it was this bad. I need to update this and add it to the laser page.

I’ll try it today and let you know how it works out. I’m burning up a lot of wood. Not really getting a load of detail but really didn’t do very well on the focusing. I’ve got old man eyes and my reading glasses won’t fit well under the laser safety glasses so I either have to do it through the enclosure window or with a magnifying glass while wearing the safety specs.

LaserFocusing.gcode (866 Bytes)

honestly I didn’t get why you need to turn off laser when you can engraving both directions


M106 S255
G91
G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750

G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750

G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750

G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750

G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750

G90
M107

2 Likes

Ryan’s focus script is so valuable IMHO that I assign it to Button 1 in RepetierHost and then run it whenever I change material and/or thickness.

Here’s the procedure I follow to set up for cutting cardboard (actually any material). I am not using “air-assist” here (compressor or aquarium pump) but am relying on the shroud and internal fan only to clear smoke and suppress flames. They are crucial IMO. I personally don’t think the real air-assist (using the compressor) adds anything but noise to cuts in cardboard.

First, I lower Z to “far too close” to the material and then run the focus script. I then lower Z back down to best focus on the top of the material… here about 16mm… and leave it there. Then I run a series of 10 lines (similar but different script assigned to another RH button) spaced several millimeters apart… starting at 1000 mm/min down to 100 mm/min, all at full-power…

[attachment file=86398]

[attachment file=86399]

I then flip the test piece and find where the earliest, cleanest through-cut occurs… here, 200 mm/min might work but 100 mm/min will insure through-cuts…

[attachment file=86400]

Then cut the parts. These all look nice and fall out on their own. There’s a slight crown in this piece of cardboard that I usually can just ignore (focus is reasonable over range of 6mm or so) if it’s not too severe or abrupt…

[attachment file=86401]

[attachment file=86402]

I can’t declare this “foolproof” but it seems to work for me… YMMV.

– David

3 Likes

I had to read that about 4x before I realized you were doing relative movements… I need more coffee.

I vote for some binary code on the edge to write down the distance :slight_smile:

I love learning! This is so great.

I ran it and if I’m understanding my results I was only about 4-6mm off. Not bad for a blind guy. I ran it three times back to back and am glad I did or I might have missed the full ramp of widths. I just shuttled the X back 50mm before the start of each pass. I bumped the Y +2 as well but didn’t need to do that.[attachment file=86414]

how you like that? )


M106 S255
G91
M98 P999
M98 P999
M98 P999
M98 P999
M98 P999
G90
M107
M30

O999
G0 Z2 Y1 F440
G1 X50 F750
G0 Z2 Y1 F440
G1 X-50 F750
M99

this could be possible if our firmware could be able to support subprograms like Fanuc controllers

Nope. That’s cheating.

Added this to favorite to circle back and re read later to verify my Edurance 10w setup once I build my new frame/bed. Thanks guys!

KellyD,

I’ve got old, tired eyes as well but it doesn’t appear to me that you’re really finding the focal “sweet spot” using Ryan’s focus script yet. In my experience, there should be very distinct “gradients” over the 20mm range of the focus script on either side of best focus… similar to the 2nd photo in my post above.

An easy way to find the “sweet spot” is to run the lens down very close to the material (within just a few mm of the surface)… and then run Ryan’s focus script several times in succession, without readjusting Z between runs. [You might want to set up a fan to blow across the work surface… especially when the lens is very close to the surface of the material.] Somewhere in there you should find the beam gets really focused – the “sweet spot”… take note about where the Z axis is when best focus is achieved.

The lasers I’ve gotten have all come from the factory focused way too close for use with a shroud (which I highly recommend)… so I screw out the lens assembly to get best focus at 50mm - 55mm from the lens (usually only a few threads are left to hold it in place in the heatsink).

– David

 

1 Like

The literature that came from JTech suggested that they were “set from the factory at 3” so that’s sort of the neighbourhood I’ve been playing in. I’ll run it right down and do as you suggest. I’m definitely not seeing the sort of gradient you are. Thanks for digging deeper for me. I’ll post a pic of the results.

I think I had some fingerprint oil on the wood? In any case, here are the results. Z-0 was about 15mm from the material surface hence the -10 on the second run.

Nothing close to the variance your pics show…

[attachment file=86443]
[attachment file=86444]

The first photo really doesn’t look too bad. I would say that the line or two left of your “50” (mm?) mark looks like best focus. To the extremes, left and right, don’t worry about it… it’s so far out of focus, there’s not enough energy to burn the surface. 50mm is also closer to 2" than 3"…

My photos above were done on cardboard, yours on wood… maybe that’s part of it. Are you running the original script… at full power, with lines spaced 1mm apart in Y, and Z increasing by 2mm with each line? I’m also not a fan of the continuous, bi-directional scanning… it ties lines together and burns the end of the lines, where often the greatest contrast in line width can be seen IMO.

I would set the Z at about 46mm or so from the material and then run the script once. That should put best focus near the center of the pattern. Count lines back to the finest/thinnest line, multiply by 2, and then lower Z by that amount. You should be good to go.

– David

1 Like

Thanks again David. I appreciate the second set of old man eyes. That was the continuous gcode with slightly different feed rates. I’ll try the original one (with Ryan’s suggested speeds) on cardboard and see if I can set the material surface at zero (I imagine that’s the smarter way to do this).

That’s more of a gradient for sure (cardboard).

So to try to understand more of what you (DJI) said above there…you find your ideal focus and then run cut through tests using that focus but speeding or slowing the moves to find what speed cuts through for you?[attachment file=86480]

1 Like

Exactly. Ryan’s focus pattern shows variation in line width due to focus, a function of Z, at fixed speed and power. The 10 widely-spaced lines (the 2nd run in my photo) are to determine feed/power to through-cut the material, and shows a variation in line width also… however, now it is a function of the feed rate, at full power and best focus. The idea is to find the fastest feed, at a given power, that gives a clean through-cut, with minimal charring of the edges; i.e. the cut pieces in the later photos were cut in a single pass at 100 mm/min and show little/no charring of the edges.

– David

1 Like

BTW the craft stick honeycomb “trivets” the cardboard is resting on in my photos were also cut with the laser in the same fashion… a single pass and 100 mm/min IIRC. Each 1.5mm thick craft stick (I think they are bamboo…) took less than 2 minutes to slot… allowing time for assembly while the next stick was cutting :wink:

[attachment file=86490]

[attachment file=86491]

[attachment file=86492]

[attachment file=86493]

1 Like

Thanks for the tip! I’d been thinking about that as I was “playing”. I modified Ryan’s crown to play with papers and cardstocks. I had to go down to 25% feedrate (on the LCD) to get it to cut through the 100lb cover weight stock. I wondered if it might have cut through better/faster if it wasn’t sitting on a solid surface (cardboard). 50% federates almost went through but not quite.

The laser turned back on (and turned off) partway through the z clearance moves - which I know I didn’t need…so I removed them from the attached. In case others want to play with the file. Note I haven’t test cut this but at these rates I was able to go through standard copier paper at 100% speeds.

LaserCrown.gcode (80.9 KB)