Laser PWM control for Neje 40w laser.
Posted: Tue Oct 05, 2021 3:40 pm
I am posting this because I had some trouble figuring out exactly how to wire up this thing, and now that I have it working, I wanted to pass along what I did for critique and improvement.
The Neje 40 watt (input power, I know its not 40w output) laser comes with 2 boards to control it, and I was able to short between the 12v and TTL terminals on one board to turn the board on. this would have been fine for simple on and off but I wanted PWM since its capable of variable output.
they have a second board that has LED's for power output so that the one I hooked up.
I connected the 12v 4amp power supply to the board and the 2 wire TTL/Grnd were connected to port 1 output 17 on my AXBBE and to 5v ground on respectively.
to be clear the TTL goes to output 17 and gnd goes to the 0v terminal of 5v power supply.
then In spindle setup I turned on the PWM and assigned Port 1 pin 17 to that, initially I left the max at 255hz will get back to that below, but was only getting 5% output from laser at 255hz
for G code I was experiencing a little trouble going from fusion360 (I am sure there are better options for this, but I am getting familiar with it since it can output g code for extremely varied machines)
to the UCCNC for laser. I used one I found online at optlasers that was designed for Mach3.
Unfortunately this post processor left a few details out for my configuration.
It put out M11 P1 S255 to start the laser and M10 to turn it off, if your familiar with the M10 and M11 codes, you will immediately see the problem. Unfortunately for me, it took a little while.
the M11 should be the stop and M10 is start, so it should be M10 P1 S255 to turn on the laser and M11 for off.
when I switched these commands out, I still wasn't getting anything, just on a whim, I put and M3 at start of program and M5 at end (something I had seen online and filed away for experimentation)
Once I put the M3 in, the M10 command worked, but it only powered the laser at 5%.
I went back into the configuration for the spindle and upped the frequency limit to 5000hz and then changed out the M10 P1 S255 for M10 P1 S5000 and was able to get 100% power on the laser.
I also went back and experimented with the S portion of that command, and as expected the frequency was proportional to output.
so:
S255 output 5%
S2500 output 50%
S4000 output 80%
I am not sure how the Neje laser board is tuned for PWM but it appears that this works, we will see how it runs for a little while.
I am going to continue to use Fusion360 as I mentioned above since I have a 4x4 router table with the AXBBE running it, and now its laser
I also have an AXBBE running a plasma table
I also have an older benchtop mill running Mach3 still.
Just outfitted a vertical machining center with Centroid Acorn and DMM servos.
I bought a copy of sheetcam for use on the plasma table, since it seems quite a bit more intuitive for plasma.
but I am open to suggestions if there are better programs for generating G-code for the laser for UCCNC.
I am also interested if there are any good tutorials for dummies on how to edit post processors for fusion360
Hope this helps someone
Thanks
Duke
The Neje 40 watt (input power, I know its not 40w output) laser comes with 2 boards to control it, and I was able to short between the 12v and TTL terminals on one board to turn the board on. this would have been fine for simple on and off but I wanted PWM since its capable of variable output.
they have a second board that has LED's for power output so that the one I hooked up.
I connected the 12v 4amp power supply to the board and the 2 wire TTL/Grnd were connected to port 1 output 17 on my AXBBE and to 5v ground on respectively.
to be clear the TTL goes to output 17 and gnd goes to the 0v terminal of 5v power supply.
then In spindle setup I turned on the PWM and assigned Port 1 pin 17 to that, initially I left the max at 255hz will get back to that below, but was only getting 5% output from laser at 255hz
for G code I was experiencing a little trouble going from fusion360 (I am sure there are better options for this, but I am getting familiar with it since it can output g code for extremely varied machines)
to the UCCNC for laser. I used one I found online at optlasers that was designed for Mach3.
Unfortunately this post processor left a few details out for my configuration.
It put out M11 P1 S255 to start the laser and M10 to turn it off, if your familiar with the M10 and M11 codes, you will immediately see the problem. Unfortunately for me, it took a little while.
the M11 should be the stop and M10 is start, so it should be M10 P1 S255 to turn on the laser and M11 for off.
when I switched these commands out, I still wasn't getting anything, just on a whim, I put and M3 at start of program and M5 at end (something I had seen online and filed away for experimentation)
Once I put the M3 in, the M10 command worked, but it only powered the laser at 5%.
I went back into the configuration for the spindle and upped the frequency limit to 5000hz and then changed out the M10 P1 S255 for M10 P1 S5000 and was able to get 100% power on the laser.
I also went back and experimented with the S portion of that command, and as expected the frequency was proportional to output.
so:
S255 output 5%
S2500 output 50%
S4000 output 80%
I am not sure how the Neje laser board is tuned for PWM but it appears that this works, we will see how it runs for a little while.
I am going to continue to use Fusion360 as I mentioned above since I have a 4x4 router table with the AXBBE running it, and now its laser
I also have an AXBBE running a plasma table
I also have an older benchtop mill running Mach3 still.
Just outfitted a vertical machining center with Centroid Acorn and DMM servos.
I bought a copy of sheetcam for use on the plasma table, since it seems quite a bit more intuitive for plasma.
but I am open to suggestions if there are better programs for generating G-code for the laser for UCCNC.
I am also interested if there are any good tutorials for dummies on how to edit post processors for fusion360
Hope this helps someone
Thanks
Duke