How-To: Modify Marlin to control a laser with an SKR Pro

The touchscreen is in serial mode, I have all three cables hooked up. I will try disconnecting one set tomorrow and see if that helps, thanks for the suggestion.

Saving the g code to an SD card and inserting it into the TFT burned correctly. I swapped cables in and out trying both modes separately but I could never get the job to burn correctly straight from light burn. It would be really nice to be able to do this though because it opens up a lot more functionality between the program.

1 Like

What about with no screen plugged in at all.

Pure guess on my part, just not sure why it doesn’t work. Maybe a driver is needed? Setting in the program, different baud rate needed? Different USB cable or port?

It turned out to be a setting in Lightburn. I needed to change my device settings from buffered to synchronous.

My first real burn!

8 Likes

Nice detail on those snowflakes!

1 Like

I got a NEJE 20W laser module for Christmas and have been trying to get it up and running. So far I have updated the firmware with the latest bugfix. I can get it to work fine with the M3 command but can’t get any of the files using the G1 and S power commands only.

The laser has its own 12V power supply and uses a TTL/PWM and GND wire for control. I have the TTL/PWM plugged in to the PC9 and the ground wire to one of the fan (-) screws although I am not sure if this is correct. Any ideas why it is not firing on the G1 commands?

The fan ground is on the 12V side, there is a ground right next to pc9. Lets see a couple dozen lines of your gcode to see if there are any errors…but you might need to start a new thread.

Thanks for the quick reply. I now have the GND on the pin to the left of PC9 and the TTL on PC9 It all still works the same way. Works fine with M3/M5 commands but does not turn on the laser when the S command is in the G1 line. The codes I have been trying are all the ones in this thread. If the gcode uses M3/M5 it works but any other code the laser does not turn on. For instance LB1 from the Laser.zip file in this thread. Not a big deal for anything I create myself but was not sure why it is not working for me when S is in the movement commands.

Using the newest nightly firmware?

What does your gcode look like?

I have test gcode on the Lasers revisited link a few posts above.

This works,
image

This Doesn’t

Can you please try my gcode in the thread I mentioned. That code is wonky and not what I would consider proper. G0 turns the laser off so that invalidates your second shot, and M5 doesn’t do anything so the first shot is not right either. I have proper code in the other thread. That I test many times on several boards and lasers.

Can you also confirm what firmware you are using. You do not seem to be answering anything I ask.

Ryan,

Sorry I will try to answer your questions.

Using the newest nightly firmware?
Yes, the one i am running I downloaded on 12/26 -
Marlin_V1CNC_SkrPro_Dual_2209_bugfix-2.0.x_bc3dc75-src

What does your gcode look like?
Provided a sample above but here is the latest I tried and still does not fire the laser. It does move just fine though. This is the E2 Engraving Test from the Lasers revisited page.

[quote=“vicious1, post:50, topic:21712, full:true”]
I have test gcode on the Lasers revisited link a few posts above.
[/quote] - Yes that is where I got the test file referenced here. - I did not see any other files in that thread.

I did have a look at the advanced configuration.h file and all seems to be in order to enable the laser with the G1 command. - Maybe I didn’t actually get the firmware uploaded correctly? It did change the BIN extension to .CUR though. Also, I got the SKR Board and TFT from you in October. I love the MPCNC and have been routing with no issue.

Thank you that clears it up.

What happens when you run my file? You say it doesn’t work, what happens? How exactly have you plugged in your laser?

37mm smooth.gcode (288.3 KB) This is the same file, just slowed down to a speed that the SKR can handle. This should be your verified test file that works.

Thanks for your patience with this.

When I run your file the machine makes all the x/y moves but does not fire the laser. I just ran the provided 37mm smooth code and it is the same. It makes all the motion but does not fire the laser. So the motion commands work but the S power commands don’t seem to do anything for me. The exception are the files you provided in the original thread that use the M3/M5 commands. Those work.

The laser is plugged in to its own 12 volt power supply for its power. It is on and I can put it in a test mode and verify. It then has a 2 pin 3.3 - 12V TTL/PWM plug. I have that plug wired to the skr board expansion1 with the first GND pin and the TTL/PWM on the PC9 pin right next to it.

Seems to work perfect with an M3 command, but doesn’t work without it.

Ryan - I ran the 37mm smooth gcode and I got the same results as above from Jeff. M3 will turn the laser on and M5 will turn it off. When first booted the laser is on until the machine is detected.

My laser is wired as follows.

TTL signal - PC9
TTL ground - extension 1 grnd
Laser power + / Heater 2 +
Laser power - / Heater 2 -

This is the firmware I downloaded on 12/27. V1CNC_SkrPro_Dual_2209-bugfix-2.0.x
I dropped the bin on the card, booted, and verified a new CUR with current date.

Aaron

That does not sound right. You can use the TFT to test the laser.

Turn the laser to level 2 and then enable it, does the red mosfet light come on? And off when off?
If it does then you have a different type of laser, that has an enable wire? or doesn’t use that at all and just uses the ttl pins, in that case you need to add a resistor to make sure the power is not floating.

We are in dicey territory here. I want to help but and will keep trying but I have to say there are countless types of lasers and power supplies. The two lasers I have work in this config…not all of them will. Jtech lasers need a totally different set of pins (as an example).

Should #define LASER_POWER_INLINE be uncommented?

I just opened the firmware I downloaded and this was not enabled.

Yes, it is not? lemme download and check, I have not changed anything.

grrr, I have no idea what happened. I will look into it more.

I have a test building right now, when it is done please give this version a a shot. https://github.com/V1EngineeringInc/MarlinBuilder/pull/57