Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: nico.13 on March 26, 2023, 04:21:37 AM

Title: No PWM using spindle output for Laser
Post by: nico.13 on March 26, 2023, 04:21:37 AM
Hi All,
I have a four axis desktop router I've been running for a number of years Using Windows 7, Mach3, ESS, Generic BOB and H bridge stepper drivers. All been working fine and now I'm adding a Sculpfun S9 Laser module.
Attempting to setup variable laser control using the spindle PWM output from pin 17 port 2 of the ESS.
I'm getting no PWM just full power on or off using M3 Sxx to set power and M5 to turn off.
The output from port 2 pin 17 of the ESS goes to OV or 5V and no PWM measured from pin 17.
Watched a lot of YouTube for help and a number of forums which all basically say it should work.
One difference I have set 35000Hz in the base kernal and not 25000Hz, not sure if this will cause any issues with PWM.
Any ideas welcomed.
Cheers
Nico.
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on March 26, 2023, 07:20:37 AM
Have you followed the ESS setup procedure for PWM output ?

https://www.warp9td.com/index.php/gettingstarted/setting-up-the-smoothstepper-and-mach#Spindle

Tweakie.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 26, 2023, 07:25:21 PM
Thanks Tweakie,
Yes I came across the link to that information not long after I put the post up.
I'll be going through the setup info there in a few hours time and yes I can see a number of things need changing from my initial setup attempts and some other stuff to check I didn't know about as well.
Thanks again.
PS
I'll let you know how it goes.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 28, 2023, 08:42:40 AM
Tweakie thanks for the link and the heads up about my setup.
The laser is now fully operational and being controlled well from Mach3.
I used the Post processor from your link for Vectric as I’m using Aspire.
All good except for the laser not shutting off quickly enough at the end of the job and burning a short line when returning to Home Zero.
I’ll have to look at putting a short delay to homing to allow the laser shutdown time.
I’m also running an older plugin so I’ll update that first.
There was a couple issues getting the laser to reset if I stopped the test run I was doing, returned to home, rewound the Gcode reset everything and started the cycle again from line one, the laser would not come on until after the first laser off and laser on commands in the code, not sure why.
Things to sort out.
Just happy to have it going.😄
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on March 29, 2023, 04:31:29 AM
Not sure if this answers your question...

The M11/M10 commands (for laser ON/OFF) need to be followed by an axis movement to be activated.
Make sure you have a G0 or G1 command following the M10 and before M5 at the end of your laser job.

The laser staying on or failing to turn on/off after a Pause or Estop is again related to the lack of a Gcode commanded axis movement following the M11/M10 commands. This explains why it returns to normal operation after encountering these commands when running further in the Gcode file.

Tweakie.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 29, 2023, 08:42:31 AM
Thanks Tweakie,
The code produced by the Post processor in Vectric put a M10P1 at the end of the last line and then again on the next line followed by the go to home zero command line.
So should’ve turned the laser off as I understand it but didn’t as it ran on for about a half second on the way to zero.
I inserted a spindle stop M3 S0 before the homing command line and ran the last section of code again to test it, (just a letter “S” at the end of a name) and that seemed to have solved it.
I’m not sure if I can edit the Post Processor to do this for my machine if it’s going to be a problem with every job in the future as M10 P1 isn’t doing it.
Thanks
Nico

Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on March 29, 2023, 12:11:06 PM
If its any help - If you detail exactly what you want included I can modify the post processor for you.

Tweakie
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 29, 2023, 07:01:52 PM
Ok thanks,
As this is a new setup and the only example of the problem so far what I’ll do first is generate some more short test code of drawings and text to run and see if the problem shows up every time.
This will give me a better understanding of the problem before changing anything.
I’ll have to leave it for a couple of days, some other jobs on my list from the other half 🥰
Thanks again, I’ll get back to you soon.
Nico.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 30, 2023, 07:26:58 AM
Hi Tweakie,
I ran a couple of simple drawings one with text and all worked fine.
Not sure why they worked and the other didn't.
The one that didn't work correctly was originally drawn up for traditional engraving and then reprocessed for the laser.
I know this shouldn't make any difference but it has the same error with two different lines of text both post processed separately.
Attached are samples of the error and also a simple line drawing with outline text that worked ok.
I'll post the samples separately as the forum isn't letting me add to this post.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 30, 2023, 09:32:14 PM
Here is some Gcode Sample.
Unfortunately the forum wont let me post images as there is a hidden file in the upload keeps telling me a file of the same name already exists and stops me posting.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 30, 2023, 09:34:52 PM
Pictures, hopefully will upload in a separate post this time
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on March 31, 2023, 03:49:18 AM
The forum is a little bit cranky and every image / attachment posted needs to have a unique name (which has not been used by anyone before).

I have checked your Gcode file and it all looks OK. I ran it with my laser and no problems. Exactly why your laser is refusing to turn off quick enough on the final home move is, at the moment, a total mystery to me. Perhaps you could attach another problem Gcode file for me to try.

Tweakie.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 31, 2023, 07:16:53 AM
Thanks, the one you ran was one that worked for me ok.
It was a new one made up to see what happened.
Attached is one of the problem GCode samples
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 31, 2023, 07:29:14 AM
Here is a short video showing laser restart at a higher power setting after finishing the job and then running a short distance before shutting down again.

https://youtu.be/pKWcWo7y99I (https://youtu.be/pKWcWo7y99I)
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on March 31, 2023, 09:55:25 AM
Thats a very inefficient piece of Gcode with multiple passes which cut through in places but other than that it worked just fine. The laser turned off when it should.

Question: Do you have a genuine Mach3 license and is it registered in your name ?

Tweakie.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on March 31, 2023, 06:34:51 PM
Yes a genuine copy registered in my name, have been running it for years.
My laser has a very fine focus of 0.1mm so to do the infill in the letters required a lot of passes and it’s set to full power as it’s to be run on a black anodised piece of aluminium for a face plate.
I’d run it with power turned down to less than 10% as a test run on the wood.

I did regenerate that code as the ones that caused problems I had been altering the finishing code to see if I could fix it.
I’ll run that exact code I sent you and see what happens. I couldn’t see any difference from the original but I’ll give it a go.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on April 02, 2023, 06:48:17 AM
Hi Tweakie,
Well I ran the code that you ran and had no issues with it so I guess this is going down as one of the unsolved mysteries as nothing had been changed. I checked the two lots of code and the matched so I don't know.
I have had a couple of other issues show up since getting the laser operating.
The first is after running some Gcode for the laser Mach3 fails to shut down fully giving an error message after it appears to have shut down, "Mach3 has stopped working" with the usual list of faults that only a software engineer would understand and as the computer isn't network connected I cant let it look for a fix.
Today while running the full length Gcode for the job I was having issues with and fortunately just a test run on wood I had an ESS buffer under run in the middle of a move tripping the watchdog.
The font had been changed and also the infill had been set to hatch to see how that went. Lots of very small moves so it would have been running the buffer pretty hard.
Anyway thanks for your help Tweakie
I will ask one other question, is there a more efficient way of doing the infill with the laser?
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on April 02, 2023, 09:59:10 AM
After your comments I think all the problems you have been having relate to the ESS rather than Mach3.
It’s some 3 or 4 years ago now but I had issues using the ESS with my lasers and after much trial and assistance from Greg & Andy at Warp9 my final solution was to switch to using the AXBB-E and UC400ETH motion controllers for all my machines (rotary spindle & laser). Sad outcome really but all of Warp9’s efforts are now being put into Mach4 and Mach3 is just history.

In industry where speed is of the essence filled laser text lettering is usually done by raster engraving and only where the highest of quality is required is the outline vector engraved as a finishing touch.
So learning from the professionals…
For my laser work I now raster engrave almost everything and find it much faster and easier to just go from a high resolution or large size .jpg (or other bitmap) image of the text I require then scale it to suit the workpiece at the time of rastering. I appreciate that this method would not suit everyone but it works so well for me I have never looked back.

Tweakie.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on April 03, 2023, 08:00:30 AM
Interesting Tweakie,
I have never used rastered images for the cnc or anything else that I can recall so I'm not familiar with how the machines handle it so I'll have to read about that.
I would have thought that for infilled text that the laser or tool still has to cover the same amount ground to get the to the finished infill for flat text.
Unfortunately being retired now and doing some expensive house renovations I cant justify the cost of a new controller at the moment.

I've had absolutely no issues with the ESS and its been running my machine for more than seven or eight years. I can still try the latest recommended ESS plugin for my setup and see how it goes.
Other than that not much else I can do other than running smaller sections of code to do the job in steps rather than a single file, not sure that would help but I'll have a play with it and do some test runs to see what it does.

Thanks again for your help.

Nico.
Title: Re: No PWM using spindle output for Laser
Post by: nico.13 on April 09, 2023, 07:42:09 AM
For those who had been following this thread I've had success for the most part, I guess 99%.
One remaining issue since activating the spindle function to control the laser is Mach3 still won't shut down properly after running some laser code.
As for the laser function itself it's working extremely well.
A couple of other little problems with the laser not restarting when stopping and goto zero followed by a regen tool path and cycle start.
Re-loading the gcode with the machine at zero and all works fine.

You will see in the test pictures I was trying different step over settings to get a clean burn image on the Anodized panel.
I had to slow the feed rate to 500mm a min to avoid buffer under run issues with the ESS and it helped with a better burn finish as well.
Very happy with the final burn job as is my mate who I've done it for.
The laser over run I was having issues with at the start has mysteriously gone away, will probably never know why.
Title: Re: No PWM using spindle output for Laser
Post by: Tweakie.CNC on April 09, 2023, 12:13:08 PM
Excellent results.

Tweakie.