YaBrick / Marlin-for-SKR-E3-mini-V2-Laser-LT-40W-F23

Optimized Marlin for with Laser LT-40W-F23 on the motherboard SKR e3 mini V2, using the PA8 (Neopixel) pin on the board as a PWM output for the laser, without soldering anything to the board nor using already occupied pins
https://marlinfw.org
GNU General Public License v3.0
1 stars 0 forks source link

[FR] Questions about PINS #1

Closed Marc-- closed 3 weeks ago

Marc-- commented 1 month ago

Is your feature request related to a problem? Please describe.

No response

Are you looking for hardware support?

No response

Describe the feature you want

*

Additional context

Hi YaBrick, and thanks for opening the issues section. English isn't my native langage so expect some strange sentences !

I bought a new 3D Printer, and decided to "recycle" my Ender 3 in a laser cutter/ engraver. So i bought a LT-40W-AA. My board is a SKR E3 V2 like you.

While searching a solution to drive the PWM signal, i found your post and it realy helped me. But i still have some strange behavior.

I have not connected the laser yet, because my goggles didn't arrive.

2 Issues:

1. I can change the voltage of PA8 with M42. But if y set "M3 S255" the voltage goes up to 5V for a short time (i think 1s) then goes 0V. Is it same for you ?

2. I was hopping to use "#define SPINDLE_LASER_ENA_PIN PC8", so use Extruder pins to enable laser power (with a 24-12V adapter). But on this board, PC8 is shut down by cutting GND, not +24V ! It means when PC8 is down, i measure -22.4V on PWM (GND is shared).

Here is a quick resume:

PSU @ 24.1V

E0 +: LM2596 + E0 GND: LM2596 GND PWM: Neopixel PA8

define SPINDLE_LASER_PWM_PIN PA8 //PWM Laser on Neopixel

define SPINDLE_LASER_ENA_PIN PC8 //ENABLE PIN on E0

LM2596 connected to E0 output for 24V --> 12V

Results: M3 S255 --> +5V PWM (for a very short time) then 0V / E0 +24V M3 S128 --> +2.5V PWM (for a very short time) then 0V / E0 +24V M5 --> -22.4V PWM / E0 0V M3 S0 --> 0V PWM / E0 +24V

M42 P8 S255 --> +5V PWM M42 P8 S128 --> +2.5V PWM

If connected direct to PSU, no problem with negative voltage.

Next idea is to use another "free pin" to activate a relay.

Marc-- commented 1 month ago

Ok, so i made some test in tyhe night. I now understand why it only "pulses"... it's written in your description:

M3 S[0-255] - sets the laser on and strikes the laser for LASER_SAFETY_TIMEOUT_MS miliseconds

I compare my configuration and configuration_adv with yours, and they are very similar. Only difference for me is that i disable all 3d printing stuff.

Now i need to understant how to produce a simple gcode to test engraving.

YaBrick commented 1 month ago

Issue 1: Yes, and that's correct behaviour. Because by default M3 will work only for 1000ms and then turn off (I guess it's a safety measure to not accidentally left the last powered on). You should generally use G1 command with S variable (with 0-255 value) to make a cut with laser, M3 in generally only for testing purposes.

YaBrick commented 1 month ago

LM2596 connected to E0 output for 24V --> 12V

I've plugged the step down converter directly to 24v output on power supply of the Ender 3. But doing it your way allows to control the power going to laser, that's convenient in terms of security.

Results: M3 S255 --> +5V PWM (for a very short time) then 0V / E0 +24V M3 S128 --> +2.5V PWM (for a very short time) then 0V / E0 +24V

that's correct

M42 P8 S255 --> +5V PWM M42 P8 S128 --> +2.5V PWM

It's the direct control of the pins, in such way you can bypass that "safety 1000ms"

If connected direct to PSU, no problem with negative voltage.

Well, for the first week I've been using it with external power supply, without problems.

There shouldn't be problems in terms of PWM - the controller cuts PWM by the 5v, not by GND. I'm not sure what can happen if you turn off E0 with connected laser to it, but I guess it will not be a problem even with that problem of cutting by GND.

YaBrick commented 1 month ago

M3 S[0-255] - sets the laser on and strikes the laser for LASER_SAFETY_TIMEOUT_MS miliseconds

And that's only for M3 command, G1 with S variable will keep the laser turned on until the end of the movement, no matter if it will will require more time than LASER_SAFETY_TIMEOUT_MS

Now i need to understand how to produce a simple gcode to test engraving.

Ok! I can give you the test gcode to see if you have everything set up correctly. Please, leave the room while laser is working, even indirect eye contact with laser can be painful

But, the question of producing the gcode is its own pain in the ass. You can do it with ArtCAM (I'm not sure if it's allowed to share the torrent files on GitHub, but I can send you the one to download the ArtCAM), there is a video tutorial about generating gcode for laser engraver which I will add to wiki of this repository.

And, at last, you will need the correct gcode postprocessor to translate the laser path to the gcode. I will add it to the wiki too, you need to add it to the postp/ folder of the installed ArtCAM. Mine is in C:\Program Files\Autodesk\ArtCAM 2018\postp

I'd be happy to give you an easier way to do it, but I've tried different - and all they are expensive/proprietary/useless in terms of diversity.

YaBrick commented 1 month ago

Added the info to the wiki and the files needed just for testing and making the setup with ArtCAM

Marc-- commented 1 month ago

Thanks !! Finding your issue on BTT's github was the thing that unlock me. And now i can progress.

I found one issue ! I changed "SPINDLE_LASER_FREQUENCY" frequency to 5000, because the laser's manufacturer say it's the good one for this model. But apparently it's not ok. So I turn it back to 2500, and I can see some improvement.

Now I need to understand the "power / speed" settings, because I'm sure it can go fast. The start of the image engraved here on cardboard took several minutes.

I'll read your addition about ArtCAM.

PXL_20240727_160727376~2

Marc-- commented 1 month ago

New test session tonight. Way better, but still need to improve !

The SPINDLE_LASER_FREQUENCY is back to 5000 without problem. I'm waiting for an oscilloscope to check PA8 signal.

I've generated gcode from an image with Lightburn.

I manage to engrave some oak. I tried 100 mm/sec, 20% power and 100 mm/sec, 50% power.

"M3 I" is OK. "M4 I" isn't.

Result is quite good but i can see little lines on the Y axis (visible on the photo). I'll investigate tomorrow.

PXL_20240728_001145574

YaBrick commented 1 month ago

I suggest to use the default 2500 frequency. It worked with my setup, and I couldn't find any certain frequnecy from the LaserTree unfortunately. M4... I remember doing some tests with it, but in the end I've used the M3 only

So, in terms of generating gcode - I don't know how LightBurn generates gcode (It would be nice of you leaving an example of the gcode from this program, at least the first ~20 lines), but here's the example how it works with gcode from ArtCAM (I've left a full test example - "vitruvian-7.g" on the wiki page):

G92 X0 Y0 Z0 ; sets the current position as 0 for all axes. Do not mistake with Auto Home (G26) command! G17; Select the working plane G0 Z0.050; Move up a little bit to prevent scratching G0 X0.000 Y0.000; Go to X0 Y0 M3 I S0; Turn on the laser for later use with G1 command in gcode (but because of S0 value does not keeps it turned on for ;1000ms G0 X45.656 Y84.658 Z0.050 S0 ;It's safer to specify G0 with S0 value, sometimes it was making a cut on G0 command when ;there was no S0 specifying G1 Z0.000 F24000.0 S80; the first time you use G1 (or want to change the laser power later in the process) you need to specify the S value, and then for all G1 commands it will be the same! Until you change it with another value G1 X46.175 Y88.119 F6000.0 S80; here it specifies it one more time, it is a bug of my postprocessor for ArtCAM. I'm not sure ;how to solve it yet, but specifying the S value one more time does not break anything G1 X46.678 Y91.583 G1 X45.384 Y92.140 G1 X45.533 Y88.400 ;And then it just keeps cutting without need in specifying S value

YaBrick commented 1 month ago

Man, didn't even knew that LightBurn can do such magic as you have shown! I'll also try it in use when... When I'll receive the second laser, I've broken the first one by the accident (that's why I'm showing it all on this one damn example, because it was one of the few engravings that I've done before losing the laser)

But what can I say about power/speed values - from my tests I've got that S180 (remember that S0 is 0% and S255 is 100% of power) is good for engraving contours of the image, and S80 for engraving the areas, all with 6000mm/min. IMG_20240624_180145 The internal, thinner parts of the engraving are done with S80. External - S180

YaBrick commented 1 month ago

Also I have values for cutting mdf with this laser Bonne nuit!

Marc-- commented 1 month ago

LightBurn seam very convenient for laser engravers, But only free for 30 days. Attached the "cat" image.

Thanks for your explanations about the start gcode. It's quite different from the printing gcode ! Here, we work mode "freely" with X/Y origins.

While searching for "M4 issue" (i can be stubborn), i found a repo where they manage to flash grbl on our SKR mini v2... i'm tempted, need to check benefits / risks : https://github.com/grblHAL

chatv2.zip

I'll keep you informed !

YaBrick commented 1 month ago

That's an interesting way to solve the problem! Didn't knew the was a port of grbl firmware, will save for later use, it's a useful project.

I think M4 (until you make a milling machine) won't be a big problem for the laser, but still it's good to know a reason why it doesn't work..

Good then, I will keep the issue opened for a while for you to add what you have found about grblHal

P.S. also I should note - there was a really strange behaviour of the Marlin with the G2 and G3 commands I've found. They weren't making arcs movement, instead they were making a straight cut from point of start, to the point of the end of the arc, like a G1. And that's not the problem of the gcode, the firmware itself behaved incorrectly.

I've even tried to reverse engineer the gcode example with working G2/G3 commands, by the gcode of Cura, but even there pretty much all the movements are based on G1 commands, any arcs movements were replaced by approximations with G1 commands

YaBrick commented 6 days ago

I've dived deeper in this problem, and found that there's a problem with inline mode working correctly on this board (it just keeps the laser off). But it seems that you've made yours working in this mode, could you please explain if you've stumbled upon this stuff. I suppose that "M3 I" in the start of the gcode helps putting the inline mode back to work, isn't it?

Marc-- commented 4 days ago

Hey ! I made a lot of trial and error since the last message (and i still have problems ! )

I manage to flash GRBL hal, but the screen/encoder was unusable. So i didn't go farther.

Now, i have an old laptop next to the printer. I use Lightburn on it, so i can send immediatly my cuts without the SD card transfert.

I'm not using "M3 I", only M3.

I can cut cardboard @100mm/mn, and it triggers me, I found it's too slow for 2mm cardboard. So i try a speed/power test, and... PXL_20240903_185812150

Looks like the power isn't changing at all !

Here is the start of the gcode.

; LightBurn 1.6.03
; GRBL-M3 (1.1e or earlier) device profile, absolute coords
; Bounds: X29.46 Y13.53 to X110.54 Y106.47

;USER START SCRIPT
G0 X0 Y0
;USER START SCRIPT

G00 G17 G40 G21 G54
G90
; Cut @ 6000 mm/min, 20% power
M8
M5
G0 X63.408Y100.775
; Layer 
M3
G1 Y103.459S51F6000
G1 X63.692
G1 Y100.775
G1 X63.408
M5
G0 X64.166Y100.775
M3
G1 Y102.72
G1 X64.403
G1 Y102.443

And later, the "little squares" : ; Cut @ 755.556 mm/min, 100% power M9 M5 G0 X107.538Y37.213 ; Layer M3 G1 X102.538S255 G1 Y42.213 G1 X107.538 G1 Y37.213 ; Cut @ 1411.111 mm/min, 10% power M9 M5 G0 X49.038Y43.713 ; Layer M3 G1 X44.038S25.5F1411.11 G1 Y48.713 G1 X49.038 G1 Y43.713

I can see the "S255" and "S25.5" for 100% and 10%... so why is it not visible on the cardboard ?

I'll continue to try. Next things to check:

EDIT: Some hours later, great news. I got it working ! PXL_20240903_230731173

In Lightburn, i wasn't choosing the right device. You need to select "Marlin". Lightburn device

Then in the settings, select "In line". Lightburn device settings

Now you can send Inline gcode, i've uploaded the file you see here. cut_test_cardboard_2mm_inline.zip