Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: LGentry on April 10, 2013, 02:13:51 AM

Title: Gaining .0001 steps
Post by: LGentry on April 10, 2013, 02:13:51 AM
I am gaining .0001 every time I move +X and -Z. If I move +X ten times my zero is off .001. Over the scope of my program X and Z get to far out.
I verified this by setting jog to .001 and slowly alternating X. After ten moves my zero is out .001.
-X and +Z do not gain the .0001 and work fine.

I am running Mach3, XP, Sherline lathe, Sherline stepper motors.
I have Sherline 1/2 pulse mode checked.
X axis step pin# is 3, Dir pin#2
Z axis step pin# is 7, Dir pin#6
Dir Low active and Step Low active are both checked
Step port and Dir Port are both at 1
Steps per is 16000, motor velocity is 37, acceleration is 3, step pulse is 2

Any help would be greatly appreciated.

Title: Re: Gaining .0001 steps
Post by: RICH on April 10, 2013, 08:10:55 AM
What Sherline model lathe do you have?
How much backlash do you have?

Title: Re: Gaining .0001 steps
Post by: LGentry on April 10, 2013, 09:58:07 AM
The lathe is a 4400. The backlash in mach is not checked. There is not much backlash in the lathe I would guess around .001 and it doesn't bind at all.
Title: Re: Gaining .0001 steps
Post by: Hood on April 10, 2013, 01:22:11 PM
Have you tried setting the Step Pulse active High?
Title: Re: Gaining .0001 steps
Post by: RICH on April 10, 2013, 07:09:05 PM
I know my Sherline had more than .001"  Z backlash and that was using the backlash locks with new screw and nut etc.
I also did a number of tests of the screws and they were quite accurate in both directions.

Something you can do is run the axis calibration feature but do it for the longest distance possible distance and adjust
the steps per slightly. Make sure you take out the non-movment of the axis "before" you use the calibration festure. That would take care of a gaining or loosing screw pitch, but, like I said, actualy three Sherlines were checked and the screws were very linear and consistent. If you can I would check the screw just to rule it out.

Title: Re: Gaining .0001 steps
Post by: LGentry on April 10, 2013, 08:39:36 PM
Setting the step pulse active high fixed the problem.
Thank you Hood and Rich for your help :D
Title: Re: Gaining .0001 steps
Post by: LGentry on May 01, 2013, 01:08:11 AM
This only helped until I rebooted Mach3 then it went back to missing steps when direction is changed. I tried lowering acceleration and speed in motor tuning, but it just ran slower and still missed steps. I searched google for similar problems and read for hours. I tried different settings at random but nothing seemed to help.

I removed the Z axis motor from the lathe and reinstalled the wheel to see if the motor is still missing steps. I did this to eliminate the backlash nut, gibs, and any other form of binding. It was still missing steps.

Next I suspected XP and all of the programs and data I had on there. I had already disabled everything, but since I had a hard drive laying around why not start fresh.

I installed a 19GB hard drive into my tower, so I could format and reinstall XP and not loose my data.
I formatted the disk in ntfs, installed XP SP1 in standard PC mode. Before it was running SP2 so I thought SP1 might be better.
I followed the instructions on except for #9 because I installed in standard mode.
I ran driver test. Preparation was successful, PPS ran between 25038 and 25039, pulse rating is system excellent. 
I downloaded and used the Sherline lathe (inch)xml found at

In bios
Peripheral config mode is set to ECP, ACPI Suspend State is S3(STR). I also set Peripheral config mod to EPP1.9, but it did not help.

I start Mach, selected Sherline lathe and select manual. It reads that the driver successfully initialized.
With the motor on the desk it still looses steps jog inc .01 feed 6 or feed 1 alternating direction.
It will not loose steps if I keep going in the same direction. It only happens with a direction change. After 10-12 direction changes it looses .001 on the dial of the wheel. My Z would get .012 out after peck drilling 1.5" when it was hooked up to the lathe

I moved the wire from the PC to the driver box and the driver box to the motor away from any other wires, which also did not help.

I can install the Linux software that came with my lathe and see if it is still losing steps. It is the only way I know to eliminate the software. I don't want to use Linux because I can write my own macros in mach using VB.

Any help would be greatly appreciated.


Title: Re: Gaining .0001 steps
Post by: RICH on May 01, 2013, 08:38:13 AM
I would not trust the dial reading. Use an indicator to check for backlash and you will have backlash in that Sherline. Also make note that
The best resolution that you can achieve would be 1/16000=.0000625" which you will probably never achieve, so doubt .0001" movements are actualy happening when changing direction.

Move in one direction to remove the backlash, then change the jog increment to 0.0001", now see how many jogs at that setting it takes to
move the indicator reading .001". Chances are it is not 10. You will see the DRO change by .0001" but there will be no actual axis movement.

Title: Re: Gaining .0001 steps
Post by: LGentry on May 01, 2013, 07:55:58 PM
My X backlash is ~.003 and my Z is ~.005. I adjust for this in my macro and is not a issue.
The dial only tells me that every time I change direction the motor is advanced slightly clockwise.

This code will advance my X axis ~.001, but Mach will still read X0. The code is not debugged but hopefully you will get the idea.
Code "G1 X0 F6"
dim i
for i = 1 to 10
 Code "G1 X.01 F6"
 Code "G1 X0 F6"
F1 will produce the same results

If I make the loop for i = 1 to 100 then I will be ~.01 advanced clockwise, but mach will still read X0.
In my macro I have to program a stop five times to adjust my zero so it will home correctly and cut to my +/- .001 tolerance.

Tonight in my macro I am going to start writing a sub that will keep track of X/Z movements and adjust the axis value to compensate for my problem. I am not to fond of making a band aid, but I can't afford servos and don't know what else to do.

Title: Re: Gaining .0001 steps
Post by: stirling on May 02, 2013, 03:55:07 AM
I don't remember all the details but wasn't there something about slow optos in some drivers that caused missing steps immediately after a direction change. I seem to remember that happened one way only.

Title: Re: Gaining .0001 steps
Post by: RICH on May 02, 2013, 07:58:15 AM
Ian, don't recall and would need to do a search, but, Lewis can do that.

So you want to hold a 0.001" on the Sherline.
I replaced the screws, the nuts, added the anti backlash device, fooled with adjustment of the axes on my Sherline. Frankly it would not hold
0.001". The antibacklash adjustments could only maintain around .002" as the setting would wear in after a lot of X movements.
Only talking about movement as one can always adjust how they are working to get close tolerances.

The point being made is that one needs to know what is causing the backlash / non-movement and minimise it the best they can.
The backlash  can be due to a number of things and when you start getting around that 0.001" and below it is  hard to define the
what part each component contributes to the backlash.
- the mechanical tolerance of each component
- adjustment of each component
- the components themselves software, electrical and mechanical
To do the above one needs to isolate each part of the picture since the question becomes ....What did one measure?

Don't much care how you compensate for that backlash as that is a totality patch for the sum of the backlash, and when you do that
it will always be hit or miss. 

That said, I can't say what the fix is as we don't have the whole picture.

Title: Re: Gaining .0001 steps
Post by: stirling on May 02, 2013, 12:50:54 PM
Intrigued as to whether my memory really is going awol I did a (google) search and found quite a few similar stories.

This one ( shows the detail well. Interestingly quite a few of the hits I found mention Sherline Mode at some point or other. Anyway - it occurred to me that Sherline Mode is obviously a kludge to cope with slow step/dir transitions and therefore it becomes very important that you get the active state of the step pulse "correct". By using Sherline mode you're actually getting a much longer pulse than Mach would normally output - but this is ONLY effective if you trigger on the TRAILING edge of the step pulse.

So for example if you select active HIGH, the trailing edge is a falling edge. If a falling edge is what triggers your drivers your cool. If however your drivers are triggered by a rising edge then you'd need to select active LOW. Otherwise Sherline Mode will do nothing for you.

This may be nothing to do with your particular problem but it does sound similar and worth a try at least.

Title: Re: Gaining .0001 steps
Post by: Hood on May 02, 2013, 03:39:12 PM
This only helped until I rebooted Mach3 then it went back to missing steps when direction is changed.

Did you check to see if the active state had reverted to previous settings for some reason?
Title: Re: Gaining .0001 steps
Post by: RICH on May 03, 2013, 07:35:53 AM
Good link Ian.

Here is info on the controller from Sherline's site and assume it is being used.
Technical Specifications, P/N 8760 Stepper Motor Driver

Power Supply:
Input: 100-240 VAC, 47-63 Hz, 3A (automatically adapts to incoming voltage)
Output: 24 VDC, 4A


∙ Logic high levels should be greater than 2 volts.
∙ Logic low should be less than 1/2 volt.
∙ Step pulses are active low.
∙ Step pulses should be at least 22 microseconds long.
∙ The lines labeled as EMC inputs or outputs can be disregarded in other systems.
∙ For use with software other than EMC, make sure your software addresses the correct I/O lines for step and direction as shown below. 
  Sherline is not able to provide assistance for other programs. For help with the EMC software, see
∙ We recommend at least an 800 MHz Pentium class computer or faster for use with the frequency mode.

In operation, the power to the motors will be reduced to half current after 3 seconds of inactivity.
This can be changed to 1/4 power with a jumper on H1.

Title: Re: Gaining .0001 steps
Post by: rcaffin on May 03, 2013, 08:57:16 PM
This only helped until I rebooted Mach3 then it went back to missing steps when direction is changed.
Not a new problem.
It sticks in my memory that the problem was happening when the DIR line changed state. If the STEP line had the wrong Active state then there appeared tto be one extra pulse happening in ONE direction. So setting the lines to Active High did solve the problem for a while - until the reboot.

Question: did you save the config before rebooting? If not, you may have wiped out the change in the config (the XML file) to Active-High.

Title: Re: Gaining .0001 steps
Post by: LGentry on May 04, 2013, 01:53:36 AM
Wednesday I wrote a sub that adjusted the zero as it changed which kept my zero accurate to .005 on the dial. Before turning it loose in my other subs I decided to keep trying to get my setting right even though over the past few weeks I had all but given up.

I figured out that my stepper motors act differently when cold and warm. So I did all of my testing with them warm.
I also discovered that jog inc .01 alternating directions at F6 will not keep zero enough to be used for motor tuning. Job inc .1 alternating directions at F6 works fine.
Next I made a chart of settings including bios(epp1.9, ECP), Ports and pins(step active low, dir active low, Motor tuning( step pulse, dir pulse) and using the below code for testing
  Dim a
  For a = 1 To 30
    Code "G1 Z" & 0.1 + ZOffSet & " F6"
    Code "G1 X" & 0.1 + XOffSet & " F6"
    Code "G1 Z" & 0 + ZOffSet & " F6"
    Code "G1 X" & 0 + XOffSet & " F6"

I finally got it to keep its home zero's within .0000 - .0005 on the dial. A huge difference from the .002 - .003 on the dial that I was getting before.
I ended up with Bios(EPP1.9), Ports and pins(dir active low checked, step active low unchecked), Motor tuning(steps 1600, velocity 35, acc 1, step pulse 1, dir pulse 2)
Restarted mach and it is still good. restarted computer and it is still good.
Backed up my xml.

I can finally start making chips without resetting my zero's constantly.

Thank you everyone for your help
Title: Re: Gaining .0001 steps
Post by: macchi on May 23, 2013, 12:48:18 PM
Hi guys,

Just joined the forums after finding this thread, after several years of good operation the exact same problem as described by Lewis has popped up with my Sherline mill and lathe, both setup using the Sherline box.  All attempts at changing Mach software settings were fruitless, so I got out the oscilloscope and starting probing around.  The Mach output signals from the parallel port seems good, with ~40usec separation between the direction and step pulses and nice sharp transitions, but the direction signal at the microcontroller pin inside the Sherline box gets smoothed out on the downward edge only, making it likely that the step pulse immediately after this change in direction is counted for the opposing direction.  The net result is that one direction change is OK but the reverse direction change misses a step.  Accounting for this step error in how the Gcode is written does fix the problem, but of course the coordinates shown in Mach3 no longer represent reality.
I have two of the Sherline boxes and will probe all x-y-z-a channels to see if this problem occurs on all of them.  In the meantime, is it possible in Mach3 to adjust the separation time between a change in direction pulse and the next step pulse?  Otherwise I need to try to sharpen up the direction pulse in hardware somehow.

Really appreciate this thread and everyone's contribution to it!

Title: Re: Gaining .0001 steps
Post by: Chaoticone on May 23, 2013, 01:41:20 PM
Thank you Freddy.........  while you have the scope out could you test something for me?  I would like to know the difference in the signals if you go to Config, ports and pins, port setup and enable sherline 1/2 pulse mode.  You will need to shut down Mach and restart each time you change this option.  I would love to see what it actually does to the step and direction signals and if it affects both the same.

Title: Re: Gaining .0001 steps
Post by: LGentry on May 23, 2013, 06:07:53 PM
Macchi did you run a older version of mach when your mill and lathe worked correctly? If a older version works better I would be happy to use it. My current settings in mach allow me to make what I want, but I still have to program in pauses to reset my x,z zero. Sometimes the zero is dead on and sometimes it is out .001". It is like it catches the step most of the time now but not always. I was starting to think this is just how steppers are. Hopefully you will find a solution to the problem.
Title: Re: Gaining .0001 steps
Post by: macchi on May 24, 2013, 12:02:16 PM
Hi guys!

First off, Brett I have attached scope screenshots turning the 1/2 Sherline mode on and off.  Direction signal is green and pulse signal is yellow.  It appears to me that there is no difference in the direction signal and that the pulse signal is widened to ~40usec in Sherline mode whereas it is however wide you set it in the motor tuning window in the non Sherline mode (in this case 10usec set by me).  Note also that my scope doesn't pick up the narrow non-Sherline pulses at the 5ms timebase resolution, but they are obviously there.

Title: Re: Gaining .0001 steps
Post by: macchi on May 24, 2013, 12:41:51 PM
Now, regarding the missed steps, Lewis to be honest I don't know if my system started to lose them right after a Mach software update.  I did go from  "Mach3_Sherline_V2.04" to R3.043.066 long before I noticed the problem, but I've used my mill rarely these past few months and I don't recall any recent intense direction reversal operations like peck drilling that would have made the problem evident.  In my troubleshooting I did try to revert to the older software and this did not resolve the issue.

I've attached some more scope screenshots that show what may be causing the problem in my system.  "DirectionalSignal" shows the direction signal coming from the parallel port in green and the direction signal at the input to the microcontroller in the Sherline control box in yellow.  The scope is capturing the change in the direction signal from high to low as Mach is trying to reverse the motor direction.  You can see how the input signal to the Sherline microcontroller rolls off by about 40 usec compared to the raw output from the computer.  Since the next motor pulse occurs about 40usec after the direction change (not shown) I'm guessing that the rolloff in the direction signal confuses the Sherline microcontroller into pulsing the motor in the pre-change direction.

I reduced the rolloff by decreasing the resistor value in the RC filter that separates the Sherline microcontroller input from the raw signal from the parallel port (from 1000 Ohm to 100 Ohm) and the improved signal can be seen in the "DirectionalSignalSharp" image.  Again the raw parallel port signal is green and the one at the Sherline microcontroller pin is in yellow.  A picture of my lousy resistor soldering job is also attached. The rolloff at the input to the Sherline microcontroller is gone and the system now seems to be working without losing steps.  The milling machine is up to ~2000 and counting rapid direction reversals without any step loss.

One last consideration if you are using the Sherline controller box, the power coming out of the box does seem to decrease with time.  For instance the hold torque on my Z channel has dropped off quite a bit so I am now using the A channel to run my Z on the mill.  From past experience replacing the SLA7044M chip solves this problem.  These chips get pretty hot and I'm wondering if there isn't enough cooling going on in the box....

Hope this helps!!

Title: Re: Gaining .0001 steps
Post by: macchi on May 24, 2013, 12:48:25 PM
Woops, here is the image with the new resistors.

Title: Re: Gaining .0001 steps
Post by: Chaoticone on May 24, 2013, 01:45:21 PM
Thanks Freddy!  Just what I expected.  You sure did sharpen up your signals by changing the resistors.  I wonder if anyone has ever done similar test with the Gecko 201s.  I'd be interested in the results if they have.

Title: Re: Gaining .0001 steps
Post by: LGentry on May 24, 2013, 08:29:21 PM
That is great that you solved the problem with your mill. Do you think changing the resistor will have any negative long term affects on the electronics? Sorry if it is a dumb question, I don't know much about electronics but do know how to solder.
Title: Re: Gaining .0001 steps
Post by: macchi on May 24, 2013, 08:48:03 PM
Not a dumb question and to be honest I'm not 100% sure either.  I *think* all I've done is change the cutoff of the low pass filter; so some extra noise might make it to the microcontroller, but that should only result in skipped steps, nothing more.  Not an expert by any means though!