Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: axia on May 11, 2019, 04:41:12 PM

Title: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 11, 2019, 04:41:12 PM
Hi can i get some hint on the problem below:
I have a hobby cnc running on mach3, with USB controller NVUM.

When load a g-code it works fine, as I have a standalone manual controlled spindle. Unless when i want to use the cnc for laser, then it could be realized the command lines flow faster than the coordinates or the motion. The motion is actually synchronized with coordinates so I guess my motors are correctly tuned. The issue could be seen e.g. when I try to draw a square with laser, the command is already shifted to the 2nd line when the 1st line is not yet finished, at its 90% maybe. Then the g-code command will come to the end about 2 seconds before the machine moves to the end point, together with its coordinates.

The machine will move as per the g-code, only thing is the laser control commands come together with the command line shifted to it. If I replace the laser commands with Z-axis movement then the machine will do them in the correct sequence, although the command line still flows ahead. I.e. the problem is always there, one only feels it when using output. My laser is controlled by M3/M5, also tried user command M113/M115 to control the output #1 directly.

Not sure if I have made myself understood. If yes is this a real problem?

Computer is Win7, also tried to install WinXP on the same machine but with exactly the same effect.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 11, 2019, 05:14:04 PM
For Laser,
maybe try toggling the CV Mode button OFF
(see attached)
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 01:19:00 AM
Hi Axia,

For laser use the M3 / M5 commands are not really suitable because of their inherent delay. To resolve this issue the commands M11Px / M10Px (for Mach3) and M62Px / M63Px (for Mach4) were created to synchronize the Output# switching ON / OFF in time with the commencement of axis movement.

There is a little more explanation here; http://hobbycncart.com/publ/cikkek/mach3_temaju_cikkek/switching_a_laser_under_mach_control/8-1-0-29

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 02:30:24 AM
For Laser,
maybe try toggling the CV Mode button OFF
(see attached)
Hi Reuelt,

Thanks! I did try this CV mode and exact stop mode, from general configuration, it does help to reduce the corner rounding, but does not show visible difference in the delay between the coordinates/motor to the command lines.

But appreciate the help, I will try to capture some screen or video to explain this issue better.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 02:39:39 AM
Hi Axia,

For laser use the M3 / M5 commands are not really suitable because of their inherent delay. To resolve this issue the commands M11Px / M10Px (for Mach3) and M62Px / M63Px (for Mach4) were created to synchronize the Output# switching ON / OFF in time with the commencement of axis movement.

There is a little more explanation here; http://hobbycncart.com/publ/cikkek/mach3_temaju_cikkek/switching_a_laser_under_mach_control/8-1-0-29

Tweakie.

Hi Tweakie,

Thanks will try it today. I'm using Mach3 so will be M11P1/M10P1.

Not sure what will happen if I attach to my machine a controlled spindle. As the spindles are also controlled by M3/M5 commands. I can imagine if the M5 command was issued after lifting Z-axis it could avoid this problem. But if the M5 command was issued to spindle without lifting Z-axis, e.g. at the end of a toolpath, then the spindle would be stopped before the toolpath reaches its end. At least this is what happens to me when trying to make a full square with laser and only got an open-square with the last part missing.

Will try the M11P1/M10P1 and let you know.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 02:49:08 AM
Hi Axia,

I have just noticed that your NVUM controller does not support the M11 / M10 command set so please disregard my earlier post.

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 04:21:43 AM
Here is the screen shot I hope to help explain the issue better.

The g-code was generated in Artcam for spindle. I manually changed the Z-axis movement to laser on/off. The machine makes the move completely following the square, however each next step is loaded a little bit before end of  the last movement. As a result, the lagging accumulates to some 8/9 mm in the end, and laser/spindle would be turned off inside the toolpath. I don't think this is correct.

Tried to set the motor acceleration to lower value, it helps to reduce the lagging. But at the lowest acceleration possible there is still a little lagging.

Tried to add a g1 Z0 before the M115 command, while my Z is already at 0. It does not help. The command line flows still quicker to its end, then M115 turns of output#1, then when Y reaches 0, Z axis "moves" to 0. It actually means the axis movement commands are excuted in sequence, but output command was excuted when the command line is "pre-loaded".
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 05:09:23 AM
Could you perhaps .zip and attach your Gcode file ?

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 05:23:12 AM
This g-code in the screen shot is a test, it is almost the full list. ;D ;D

Anyway the tap file is attached, appreciate Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 06:11:45 AM
Absolutely nothing wrong with your Gcode.
Here, the m113 executes before the X axis starts to move and the m115 executes after the Y axis has returned to zero.

Could be that the problem lies within your NVUM controller software plugin but I have no way of testing or confirming this.

Tweakie.

Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 06:33:03 AM
Absolutely nothing wrong with your Gcode.
Here, the m113 executes before the X axis starts to move and the m115 executes after the Y axis has returned to zero.

Could be that the problem lies within your NVUM controller software plugin but I have no way of testing or confirming this.

Tweakie.

Ah yes I forgot to dig into the NVUM controllers. Many thanks for checking on your end, I know now the issue does not come from my g-code or Mach3 setting. Just for my curiosity, does the command lines go faster than the coordinates move, or they are synchronized on you side?

For now I carry on work with the manual controlled spindle, it is still fine. Will post any further news if I have.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 06:51:32 AM
Here the next command line is not executed until the axis movement from the previous command line is complete.

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 12, 2019, 07:37:59 AM
Could it be the Lookahead 20 or more lines in config | general Config?
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 12, 2019, 07:52:00 AM
Could be, but the Gcode itself is only 10 lines long.

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 12, 2019, 03:04:49 PM
Could be, but the Gcode itself is only 10 lines long.

Tweakie.
What I meant was the default lookahead in Mach3 is 20 lines.
What if we change that setting to just 1 (0 is not allowed).
Will Mach3 then execute command line one line at a time SLOWLY?
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 12, 2019, 04:41:54 PM
Could be, but the Gcode itself is only 10 lines long.

Tweakie.
What I meant was the default lookahead in Mach3 is 20 lines.
What if we change that setting to just 1 (0 is not allowed).
Will Mach3 then execute command line one line at a time SLOWLY?

Should have mentioned this earlier, I have also tried this before, setting the look ahead lines to 1. Unfortunately there is no visible difference in the way it goes.

Today tried to change the NVUM driver but there isn't too much alternative available. I've got 2 DLL's and both of them give the same result. Novusun.dll and Nvum_release.dll.

Also tried to run the g-code with parallel driver loaded. Of course it's not possible to drive the machine, but when g-code running it can be seen the driven coordinate is "vibrating" and sequence seem to be normal. I.e. when the driven coordinate stops "vibrating" then the next command line starts to be loaded and ran.

So far I'd agree with Tweakie, the trouble comes from the NVUM driver. But seems there isn't better way to prove or solve it...
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 12, 2019, 05:46:26 PM
Hi
I notice that you are using custom M codes M113 and M115

In macros written in Visual Basic you can use

while ismoving()
wend

So if your m115
has
Code "G1 Z0"
while ismoving()
wend
...
(your codes)

You perhaps may delay the turning off of laser output.

Another possible Workaround is to use a long bent micro-switch to turn on the laser when z axis is lowered towards the material surface. Microswitch would turn off the laser when z axis is raised.
(some have done it that way and made videos on YOUTUBE)
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 13, 2019, 03:23:54 PM
Hi
I notice that you are using custom M codes M113 and M115

In macros written in Visual Basic you can use

while ismoving()
wend

So if your m115
has
Code "G1 Z0"
while ismoving()
wend
...
(your codes)

You perhaps may delay the turning off of laser output.

Another possible Workaround is to use a long bent micro-switch to turn on the laser when z axis is lowered towards the material surface. Microswitch would turn off the laser when z axis is raised.
(some have done it that way and made videos on YOUTUBE)

Hi Reuelt,

Both are very practical workarounds. I just got the chanve to try the code one, and was sure it will work although some delay. But to my surprise it did not change the outcome, apparently for Mach3 the move is already at it's end, while it's loading the command line. I guess in my Mach3 the command lines and the coordinates are separated from each other for some reason.

Don't have chance to test the limit switch option yet, but I am sure it will work.  :P

Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 13, 2019, 03:31:40 PM
The attached image shows what I keep getting.

Only for this one I reduced the size from 100mm to 20mm.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 13, 2019, 04:48:14 PM
Kebelcar in Feb2019
posted using a microswitch for his laser
https://www.youtube.com/watch?v=3wBpa7--aBM&feature=youtu.be

AFTER he could not get a solution at this forum
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 14, 2019, 02:01:16 AM
Hi Axia,

As I mentioned earlier the M11/M10 command set stops issues, such as the Dot Burn at the start of your laser line (as shown in your pic.) and without using a motion controller that supports those commands you are severely limited in what you can achieve with your laser.
As Reuelt suggests a micro switch may be a work-around but if you want to produce quality work then junk the cheap Chinese controller and invest in a controller that properly supports all the Mach3 commands.

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 14, 2019, 04:19:39 AM
Thank for the advices guys! I think I have to live with the situation, keeping the limit switch option as my ultimate solution if no soft solution available.

For the controller, I will try to dig further into the drivers or maybe try to find a NVUM forum. At the same time I am also looking into a serious (offline) controller, for the next machine maybe. If I could be advised of any good model, will be glad to hear.

Also will try Arduino as controller for laser, when have time.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: Tweakie.CNC on May 14, 2019, 04:38:22 AM
If it’ any help…

This video https://youtu.be/8fUg6ebWut0 (https://youtu.be/8fUg6ebWut0)  is Mach4 but it demonstrates just how an unused Axis Direction Pin can be used to switch the laser ON/OFF and a PWM signal to control laser power for a combined engraving and cutting toolpath.

The attached pic was laser produced on some scrap plywood using the Pokeys 57CNC controller.

The Mach3 motion controller I use on a daily basis is the Warp9 ESS.

Tweakie.
Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: reuelt on May 14, 2019, 05:06:40 AM
With the Pokeys 57CNC you can also make use of Freeware "Auggie CNC Addon" written by retired MACH3 creator (everyone knows who) for higher Quality Laser engraving/Photo etching.

If you are into laser, perhaps Pokeys 57CNC motion Controller is preferable to Warp9 ESS Motion Controller even though ESS has already proven to support laser.

The only motion Controller that can support Auggie is Pokeys 57CNC.

Title: Re: HELP g-code command lines and coordinates not synchronized
Post by: axia on May 15, 2019, 04:11:59 PM
Thank you guys, I have downloaded the ESS and 57CNC manual and reading them for my preparation to the next machine. Good documentation and datasheet make the product better.

For the async issue I seem to found a workaround.
In the m113 and m115 code I added the below code before turning on/off the output#1:
sleep 1000

This will delay the output and is actually working!!! I have done several tests, only thing is the overburning. As I am not using M3/M5 I don't expect built-in delay. Still need to tune the delay try to minimize the overburn. At least this can be a workaround for controlled spindle.