SKR Pro + Marlin 2.0.7.2 + NEJE/3 Wire Laser (Summary)

OK, This is meant as a summary of all the helpful stuff that I got from several posts. So I’ll post a link in a few of them pointing here, rather than dupe clutter each of them.

I got 2 different lasers working on SKR Pro with Marlin 2.0.7.2 (specifically SkrPRO_DualLR_2209-2.0.7.2.src ) from the link: SKR Pro - V1 Engineering Documentation

Unzip the file, and unzip Marlin.

I edited Configuration_adv.h to:
//#define SPINDLE_FEATURE
#define LASER_FEATURE
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE)

#define SPINDLE_LASER_ENA_PIN PF9 // Turn Laser OFF/ON using PIN PF9 on Ext1
#define SPINDLE_LASER_PWM_PIN PC9 // PWM Controll Power Level of Laser on PC9 of Ext1
#define SPINDLE_LASER_ACTIVE_STATE HIGH // Set to “true” if the on/off function is active HIGH
#define SPINDLE_LASER_PWM true // Set to “true” if your controller supports setting the speed/power
#define SPINDLE_LASER_PWM_INVERT false // Set to “true” if the speed/power goes up when you want it to go slower

The physical Components I needed other than the Laser:
1x 200K-220K OHM Resistor
1x DC SSR (any one that will trigger on 3.3vdc in the Input and handle 12V DC on the Output)
1x Push Button Micro Limit Switch (12.6× 6.5× 5.7mm)

Here’s the connection diagram:

Close up of EXT1, Black(GND) Yellow(PC9 aka PWM) , Red (PF9 aka ENA aaka POWER OFF/ON)
image

Double and Triple check that you are not putting the +12 to your Laser’s PWM PIN!

So what this does is output on a 3 pin connector (many lasers), +12v for the Laser, +3.3v PWM for the control, and pulls down PWM to give a clean circuit.

What this does is output +12v, GND, and +3.3v PWM on a 3 pin JST connector. It is Common GND, with a Pull Down resistor to damp any spikes from the board.
There is also a Saftey Interlock (kill switch/reminder to put on goggles). I’ll upload .stl’s/.3mf’s for the case mods (once Im fully happy with them).

Here’s it with the Interlock Key inserted:

Interlock Key:

Side View (gonna clean up placement of the SSR, and move it inside the box:

9 Likes

Thanks for this! I just posted a question about this exact topic, you mentioned you got two lasers to work , would you mind posting links or make/model of those lasers?

The easier to use Laser first was an:
“NEJE Engraving Module 30W, Upgrade Engraver Module Output Power 7.5W”
I borrowed that one from a friend and it worked out of the box on both the SKR PRO, and I got it to work with my Archim (which died right afterwards).

I also got this generic 3 pin Laser:

to work. Same Diagram. I would not recommend this generic laser as much as the NEJE, even though in the end i’ve got the generic producing cleaner corners. I have not found it to meet it’s claims of output power (no where close), and I suspect that most people would be happier with the NEJE 40w version (or the lasers that are recommended from other suppliers). The above laser had a bunch of problems not honoring or obeying PWM, and I spend weeks with oscilloscopes trying to figure out if it was the board (Archim), or the Laser. The NEJE worked even without a pull down resistor, the generic one only worked with a pull down resistor. Also the generic one claimed to require +5v PWM, but never ever worked with that. It only worked with 3.3v PWM. The seller kept claiming that it would work fine with a cheapo CNC board, but never understood that the generic laser was rejecting clean PWM… YMMV, buyer beware…

I suspect the reason for the cleaner corners is that fixed focus lasers (most of the 40W ones), have a round spot beam, and the adjustable focus lasers seem to have a slightly square beam.

3 Likes

Here’s the Laser Interlock Key for any that want it:
https://www.prusaprinters.org/prints/76084-laser-interlock-key

If I get some spare time I’ll clean it up and add it to the case, along with the mount that I use for my Lowrider (top mount for SKR Case).

3 Likes

This may be a noob question, but I am pretty much a noob when it comes to laser setups :slight_smile: . Using the information you have provided, I started looking for a NEJE laser on amazon and I found this one:

Is it necessary to buy the one with the PWM kit? I don’t think it is based off of the pinout diagram you provided but I don’t want to regret not buying it if it turns out that the PWM kit is needed. Thank you for all your hard work and time I really appreciate it!

First I think you are getting overcharged here. I believe this is the N40630, which is only $80+shipping delivered from NEJE’s US warehouse. I see that NEJE has a new 30W model (which isn’t the one pictured on Amazon), but it is still only $140. As for the PWM kit, you don’t need that board. It allows you to control your laser manually and gives you some data. But that PWM kit does come with a power supply, which I don’t think is included in the basic package. You are going to need to figure out how you are going to power your laser.

1 Like

Thanks for the heads up, I will definitely shop around for a better price then. As for the power supply, I am going to pickup a Meanwell more than likely. I had thought about converting an ATX power supply since I have a few laying around but why spend more time on it when there are affordable options out there. Thanks again for the help!

Hi,
Thanks to your thread I now have a similar setup with a NEJE 40640.
M3 / M3 S… / M5 can light on and light off the laser but it does not work as expected.

My issue is after an M3 command any movement(G1 X… Y…) is lighting off the laser.
So on whatever gcode file i run the laser only spot one ridiculous hit on each continuous path.

I’m using LightBurn and my test is a simple square in line mode, I can share gcode if needed but nothing special here.

My differences with your setup are:

  • I use their board with a dedicated PSU and the 2 pin JST connector, without pulldown resistor
  • I’m not using your OFF/ON laser control at the moment.
  • I’m using V1CNC_SkrPro_Dual_2209-2.0.7.2-src and not the DualLR

I’ve edited Marlin Configuration_adv.h like yours but with a comment on
// #define SPINDLE_LASER_ENA_PIN PF9 // Turn Laser OFF/ON using PIN PF9 on Ext1

To me it seems to be Marlin related more than the non use of a pull down resitor.

Could it be possible you missed other changes you’d made in your Configuration_adv.h ?

OK by reading other threads and digging into LightBurn Device option I changed Laser Control Commands setting for “Inline”.
It now use G1 moves instead of M3/5 and it works like a charm !!

By the way thanks a lot for your summary post.

3 Likes

Yes you should be using inline.
The non-defaults that I use on Lightburn are:
Enable Z axis, fast whitespace @100mm/s, and Inline.
It is highly recommended even with the NEJE board to allow the SKR (or other board) to turn power off/on using SPINDLE_LASER_ENA_PIN.

The pull down resistor made the PWM cleaner especially on the non-NEJE laser. Without the pull down resistor the oscilloscope showed a much noisier PWM pattern. The non-NEJE laser couldn’t accurately discern the proper levels sometimes. But even the NEJE laser benefited from the cleaner PWM. Especcialy on engraving.

2 Likes

Thanks.

I was in technical testing mode, firstly to see if everthing was good with Marlin, PWM and laser.
I will now complete your setup.

Do you think 2 pin JST , 3 pins JST and the 3 entries contact bornier are somehow connected ?
I mean, for simple and proper mount i would prefer to put the pulldown resistor on PWM and GND of the green contact bornier and keep untouch the 2 pin JST i use.

I added SSR in my shopping list, I will install it soon.

Have you already looked for air assist on M8 command ?
My air compressor have a very small air tank(6 liters) so when not needed(speed moves or other cases) i would like to save air as much as possible with an 12V air solenoid valve coupled with an other SSR.

@mperino

Thanks for the detailed write-up, i’ll be following along from your summary to install a NEJE 30W (this weekend, time permitting).

I also plan on upgrading to the latest firmware, not sure if you have looked into it at all (/513/V1CNC_SkrTurbo_DualLR_8825-2.0.9.2.zip), but it looks to me like there would be just one change from what you wrote up for version 2.0.7.2?

#define SPINDLE_LASER_USE_PWM // Enable if your controller supports setting the speed/power

*Note that there is no “true” that has to be set, as it looks like this line gets enabled by default when you uncomment the line to define the LASER_FEATURE.

2 Likes

Yes, they are all interconnected, here is my setup and a photo of a backside of the PCB:


1 Like

Also, might be useful for those who start building a laser machine using SKR boards’ Fan or Heat Bed pins. These do have PWM (0-12V or 0-24V, depending on the power source) but it’s not actually 0 on the ground pin!!!

The ground pins in this whole row of connectors which outputs 12V PWM including the Fan are hardware-modulated through a transistor and both +/- pins are actually uder voltage! True 0–5V PWM is only before the transistor!

For this setup with NEJE, where you have common ground between TTL and the 12V Input - you will have short circuit (or however it’s called correctly) and can burn either the SKR or the NEJE module. I burned my table with 100% 40W laser blast in a second, but luckily, the PCBs all survived.

After research I found out that one option is to use any other PWM pin (not the Fan or any Heat Bed pins) on your SKR as a SPINDLE_LASER_PWM_PIN and avoid using M106/107 commands with the NEJE module. Another - is to use a separate power source, not havin common ground with the TTL, which allows to use M106/107 and the Fan Pin. This is what I have done for now, but I noticed that with the laser power set to 0, the laser blinks, as the TTL signal in this case is still not clean, the voltmeter shows -0.4V or something at 0 power and the pulldown won’t help. I will certainly jump to the first option as soon as I get the12V relay…

Another (brutal) option is to solder the TTL wires to the Fan or Heater pins directly before the transistors. These do source true 0V and 5V PWM and you don’t need to change the firmware. I’ve seen some guy do that, yet I would’t tamper that much with the beloved PCB…

1 Like

By the way, can someone help to troubleshoot this test burn on a piece of paper:


Two things are bothering me,

  1. The curves are all split into segments (though they are drawn to be curves and Lightburn recognises them as curves). I hope, Lightburn should be able to post it as a curve, or shouldn’t it? Presumably, it’s the Marlin settings that’s interfering…
  2. All the corners at all angle changes are perforated through, which is clearly visible in the photo. This is cut mode, without perforation, at a constant feed and laser power. Since I’m using a Fan pin with M106/107, it cannot be programmed for SPINDLE_LASER_USE_PWM, so the trapezoidal setting in Marlin is not available. However, I clearly see that the laser intensifies at fast straight moves and dims at the ends of lines (not by the gcode). I see people successfully use M106/107 for cutting and engraving without these artefacts, I must be doing something wrong…

I can’t tell the scale of this. I would open the gcode in ncviewer and look at the curves to see if they are still smooth in ncviewer. If they are, then it is Marlin. If not, then it is lightburn.

I had a similar issue with a laser pulsing like that and the problem seemed to be that the pwm frequency was too low. In trying to change the frequency, I updated the firmware and the problem went away.

Hi, Jeff!

  1. Yes, the curves are smooth (they look smooth), I tried a code with a circle too and it’s just a lot of segments, but it’s ok. Not sure, if Marlin would interpret this otherwise (so that SKR calculates a spline and draws a spline). Correct me if I’m wrong, but would it still be a lot of segments?

  2. In fact, the image above is also rather smooth if the dots would not be visible (see above). But the scale of this is about 10cm, so it’s not pulsing (in the microlevel). It’s just the beginning and the end of each segment. The frequency is 1KHz, as recommended by the NEJE.

I suppose there is some kind of delay inbetween the segments, but don’t understand where it comes from. I will try the inline mode as soon as possible.

Do you think this setting could cause such behaviour in M106/107 mode? Can it be commented out?
#define SPINDLE_LASER_POWERUP_DELAY 50 // (ms) Delay to allow the spindle/laser to come up to speed/power
#define SPINDLE_LASER_POWERDOWN_DELAY 50 // (ms) Delay to allow the spindle to stop

Yeah. That delay definitely could cause it.

It won’t allow to comment the delay out. But will compile with 1ms delay. Let’s see. But you’re right, in case this is intended to add a delay not after laser commands, but after each move - looks like this is the source of the issue.

1 Like

UPD: no, with 1ms delay it is all the same. But what I also noticed, it may be not directly the laser power issue. The gantry itself is too slow at each dot. It won’t move smoothly, but pauses noticeably at each dot, even if the angle is close to 180*, while the laser stays on (and if not adjusted by Marlin, as I thought it could emulate LASER_POWER_INLINE_TRAPEZOID for M106/107 too, at the same power level)… And it burns the dots!