Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: dVE on September 30, 2015, 09:00:32 AM

Title: Missing steps on direction change
Post by: dVE on September 30, 2015, 09:00:32 AM
Hi everyone,

first post here, but been a Mach3 user for some time now. Great software, by the way!

I had noticed that my parts tended to lose precision the more complex they were, but I couldn't tell exactly where the problem was until a few days ago. It seems that I am missing steps somewhere, but it's a very particular way of missing them.

Let me explain the test I have been running for a few days.

My setup is using a CNC kit like this: http://www.wantmotor.com/ProductsView.asp?id=272&pid=88 (http://www.wantmotor.com/ProductsView.asp?id=272&pid=88). It uses a breakout board connected to the PC parallel port and to the drivers.
I have setup Mach3 and the drivers to use 1600 steps per mm (for this test, more on this later), and the kernel pulse speed is set at 75KHz.

I setup a micrometer on the tool measuring displacement on the X axis and set it to 0. In Mach3, I also zero all axes. Then I run this program, that moves X to 10mm and back to 0 a hundred times:

F2000
G90

M98 P0002 L100 (CALL SUB PROGRAM O0002 100 TIMES)
M30

O0002 (SUB PROGRAM)
G01 X10
G01 X0
M99
%


I have run the tests with motion mode set to CV and exact stop. Both have the same results so this is apparently not related.

If everything is fine (let's not count backlash yet, more on this later), at the end of the program the tool should be again at 0 in the micrometer.

My result is that the micrometer shows a displacement of 0.63mm.

I hear you saying backlash!! But wait! looks like too much for backlash. So... if I run the loop 50 times instead of 100, I get pretty much half the error: 0.31mm. Looks like the error is proportional to the number of times the operation is repeated which would rule out backlash. Let's dig a bit more.

Now I change the microstepping, from 1600 to 400 steps/mm in the drivers and Mach3 motor config. (4x less steps, so every step produces 4x more mm). Measured error is now 2.52mm: exactly 4 times larger.
Change the microstepping again, this time 6400 steps/mm (4x more steps, now every step produces 4x less mm). Error now is 0.16mm, approximately 4 times less than before.

I'm starting to suspect here that whatever is happening, I am missing steps at some point. And it seems that the number of steps is proportional to the number of G01 operations, but not to the number of pulses needed to move the motors those 10mm.

So, how many steps are being lost, actually? Let's see:

1600 steps/mm * 0,63 mm = 1008 steps  
6400 steps/mm * 0,16 mm = 1024 steps
400 steps/mm * 2,52mm = 1008 steps

The test is running 100 times, back and forth, so it's changing direction 200 times, this is about 5 steps missed every time direction changes, but independent of the total steps involved in the overall motor movement.

Acceleration could be an issue, so when changing direction, the motors could miss steps... so I tried feedrate 200 instead of 2000: no change (except it takes 10 times longer...)

I wanted to rule out mechanical components affecting here, so I made a quick test wiring an arduino with GRBL 0.9i to my drivers and run the same program (actually I rolled out the loop, since GRBL doesn't support G98): the result is exactly as expected: the micrometer reads 0 at the end of the test. Basically it rules out electronic/mechanical problems and leaves the ball on the PC side running Mach3.

I'm out of ideas now, I have tried every setting I could think of in the Mach3 configuration, but I'm stuck.

Do you have any advice, guys?

Thanks!

David
Title: Re: Missing steps on direction change
Post by: RICH on September 30, 2015, 12:40:09 PM
David,
You are comparing pulses to mechanical movement, which is ok for a comparison, but apples are not oranges.
 
The only way is to isolate each against an electrical or mechanical  standard and that is not easy.
Here is what we did a long time ago as a test:
A custom built analyzer was used to count pulses, which uses 6 cpu's to count and compare 6 different inputs at once. The analyzer pulse readout is  accurate to something  like 20 parts per million. So we had the following electronically, pc output, break out board input and  output, drive output. Then we isolated each mechanical / electromechanical point and got an accuracy graph of each based on the same calibrated indication (optically done with repeatable accuracy to 0.0001").

Backlash can be due to a number of things....did you know
-  belt tension can affect a physical  linear move
- a ball screw can have different profile depending on direction it's going
- bearing preload does affect / is  backlash also and it can't be "Zero" else the axis may not move
- not all drives and motors are equal when it comes to rotating the motor shaft
Just some things that comes to mind...........

Apples and oranges, good fruit , but not the same!

RICH

Title: Re: Missing steps on direction change
Post by: dVE on September 30, 2015, 12:49:10 PM
Hi Rich, thanks for your input.

I understand your points, but the thing is... the same hardware (ballscrews, drivers, etc) behaves correctly if I replace the PC + Mach3 with an arduino and GRBL. Seems like for some reason Mach3 or the PC are missing steps while GRBL is not.

Cheers!

David
Title: Re: Missing steps on direction change
Post by: rdean on September 30, 2015, 05:16:32 PM
You may want to change the Active State of the motor pulse output to see if that helps.

Ray
Title: Re: Missing steps on direction change
Post by: dVE on October 01, 2015, 10:10:56 AM
Hi Ray,

Quote
You may want to change the Active State of the motor pulse output to see if that helps.

Tried your suggestion and the result is that the motor didn't move. They were already set to active low, which got me thinking. Maybe there is some incompatibility between the breakout board and the way mach3 sends the pulses, perhaps related to the pull-ups. I'll try with a different breakout board I have from and old project to check if that makes any difference.

Thanks!

David
Title: Re: Missing steps on direction change
Post by: fixittt on October 12, 2015, 07:39:16 PM
David,  just for grins and giggles, enable sherline mode. 
When the first G540`s came out, I had one that did something close to what you are describing.  But it was very predominate when cutting a 3d model toolpath in wax.  by enabling sherline mode, It increased the pulse width.  ther breakout board in the website picture looks like a standard breakout board I used to mess with alot a few years ago. 
Title: Re: Missing steps on direction change
Post by: ger21 on October 12, 2015, 09:36:30 PM
Quote
Acceleration could be an issue, so when changing direction, the motors could miss steps... so I tried feedrate 200 instead of 2000

Changing the feedrate does not change the acceleration rate.
Go to motor tuning and reduce the acceleration by 50% and run your test again.

Quote
I hear you saying backlash!! But wait! looks like too much for backlash.

Backlash is not cumulative. If it was backlash, you'd get the exact same result every time.
Title: Re: Missing steps on direction change
Post by: robertspark on October 13, 2015, 02:41:27 AM
That kernal pulse speed is very fast at 75 khz.....  way too fast if you ask me, why do you need it that fast?

>>>> in simple terms, can you post / email me your XML file?

If not, I'd suggest you go back to basics....

Look at your motor settings page for each Axis and consider what you are intending the machine to run at 1600 steps / mm ... is just that "steps per mm".... what velocity are you targeting?   What acceleration are you targeting?   [for each axis]

What is your pulse width for steps and DIR (on the motor tuning page).

say your machine is running at 1200 mm / minute [not sure what type of machine you have!], that is 20mm/sec..... and you have asked it to run at 1600 steps / mm

so 20 x 1600 = 32,000 steps / second [32 kHz....]

1600 steps / mm is also 0.000 625 mm / step  .... very high resolution.... do you need it that high? 

You can bring your mm / step resolution down and improve your machine speed as at high khz rates stepper motors may not like the acceleration or how fast they are being pulsed  (especially if they are big stepper motors).

[if you send your XML I'll have a look tonight .... + 12 hrs from now.... can you also post some information on your machine (what is it?), plus what leadscrews do you have, what pitch etc...]

Rob
Title: Re: Missing steps on direction change
Post by: robertspark on October 13, 2015, 04:13:16 AM
Note, l did not believe the step frequency via arduino was very high

Have you measured your backlash, have you considered your backlash?

Acceptable limits of backlash are subjective, but really task specific..... Say you have 1 thousand of an inch backlash... (0.0254mm).... But your machine is running at 1 step per 0.000 625mm (1600 steps per mm)... That means your stepper drives need to turn 40.65 steps just to deal with the backlash before the machine moves....

Again I don't know your application, but if you are talking arduino and grbl... It's probably not that high precision

Rob
Title: Re: Missing steps on direction change
Post by: RICH on October 13, 2015, 08:05:16 AM
David,

Here is what I would do:

1. Find what your Pulse frequency is different kernel speeds:
   - Say, select 25K, save settings, go out and come back into Mach3. Now go to Diagnostics and note the pulse frequency.
     If steady record or if fluctuating note the range  ( +- record the lowest and highest value).  
     Use Kernel speed which provides the most stable pulse frequency and nearest the kernel speed.
     25K should be fine to start.

2. Set your drive for 10 micro stepping ( 1000)

3.  Now go to Settings (alt6) tab and calibrate the  axes. Use the longest possible movement.
     Move the axis in one direction so you remove any backlash, then calibrate.
     First time around use something like 50mm / a shorter distance.
     Frankly you should calculate the steps per first !
    
Steps per should be correct, see how "smooth the motors start, jog , stop, adjust accel value based on testing similar to velocity, but done after velocity
is satisfactory.

The name of the game is to get the axes to move smoothly, accurately with repeatability.

If you want to play around finding lost steps later then have fun,

RICH

Title: Re: Missing steps on direction change
Post by: kcress on October 16, 2015, 05:35:14 AM
Quote
Basically it rules out electronic/mechanical problems

While I agree with "mechanical" I believe "electronic" is in no way "ruled out".  By changing to different electronics you've altered the the line impedance so the pulse shapes will be different.  You've likely changed the noise situation by having the wires not running in the same exact positions and near their same neighbors.  And likely, though I'm not sure, the actual pulses may well be different in length - which can change everything.  The driver can be flat-out missing pulses.

All this stuff has to be fairly deterministic so what is asked for you get every day.  What that means is problems can also end up being very deterministic - given all the same preambles(moves) the same errors will likely occur in the same places.

I suspect your MACH3 pulse periods are ragged-edge too short so certain pulse-trains set the drive up to reliably (deterministically) miss pulses - repeatedly.  Try increasing your pulse periods and see what happens.

By the way I loved your test setup.  I'm going to try that.
Title: Re: Missing steps on direction change
Post by: garyhlucas on October 16, 2015, 09:17:10 PM
I had a very similar problem. It took me quite a while to figure out that a motor coupling was loose and would slip in one direction only!  Might want to check that.
Title: Re: A posible Solution to Missing steps under Mach3
Post by: wl888 on November 07, 2015, 10:59:12 PM
Solution-one option
Have been having lost step problem for ages also, tried everything i could find on the forums, nothing made a difference. >:(
I have a reasonably modern computer running Windows7 (was XP), Mach3 066.
The steps i followed to test this solution were as follows:
Ran a stepper under Mach3 with my std configuration, could actually feel the steps missing every now and then, this was under full step down to 1/32.
Made the system changes (see below)
Without changing Mach3 at all, re-ran the test, this time there was NO indication of missing steps
What I did : Under Windows Control Panel...System and Security...Power Options..Balanced goto Change plan settings...change BOTH boxes to NEVER.
I later fine tuned the Motor Setting in Mach3 on Step to 10us and Direction pulse to 5 us, lower settings also worked but these were optimum for me.
NB: this was a bench test not on a working machine, as mine is down at the minute, but indications are good that this is a solution for me.
Why does this work...not a clue..but it seams to. ???
I have not seen this on any of the other forums.
Hope this helps and if anyone tries this and it proves workable please let me know.
Doug  :)
Title: Re: Missing steps on direction change
Post by: Sadam on February 19, 2020, 02:56:49 PM
Mach 3 both x and y axis shift zero during job . I did a test back and forth 1 inches hundred time and at the end goto zero command is send and it moves 2 mm away from zero