Z-axis lowering over time

Hey folks.

I am new to MPCNC but not new to CNC. I am having trouble with the Z-axis seeming to get lower and lower as the job progresses.

About my build: I am using an MKS Gen L controller running µCNC (custom build from master but @Paciente8159 has eyeballed my config for issues) with RB 42SHDC4043Z-22B stepper motors. The board and steppers are ex an old Tevo Tarantula 3D printer that I stripped for parts. It is using TMC2208 stepper drivers and I have configured the VRef to 1.35V by way of this calculation:

stepper_max_current = 1.5A
        rms_current = stepper_max_current / 1.41 = 1.0638A
               vref = rms_current * 2.5 / 1.77   = 1.5V
          safe_vref = vref * 0.9                 = 1.35V

I took apart the Z-axis yesterday and found the top outer bearing bolts were too loose, so I adjusted them also. I discovered that they were rubbing on the router, so I twisted the router slightly to avoid this and replaced the hex-head bolts with button-head screws. See photo below:

Additionally I removed, reapplied locktite to and tightened the coupler grub screws.

So this AM I ran the machine for 6 hours straight on a loop of G1 Z20 G1 Z0 (at F360) which it performed flawlessly. I used compression of the sponge in the photo to eyeball it, but also measured with callipers before and after and measured no discernible change in z-height.

So, I thought I would run the file that previously failed on the already ruined piece of stock to see if the situation has improved - and you can probably guess that the machining did not go well.

Here’s a link to a Dropbox folder containing video and the nc file as generated by Fusion 360.

There’s a nearly 30 minute long video of it running before I gave up and hit the e-stop at around minute 16 you can see that what originally was a safe travel level now drags the tool across the surface of the stock. There’s also a timelapse for the impatient.

I’m kinda struggling with what to try next as I’ve tried everything I can think of. Keen for any feedback.


The only two things occurring to me are:

  • The stepper motor is losing steps trying to lift the tool. You can try and lower the accel on Z axis to see if it helps.
  • either the motor shaft or the t-screw is slipping inside the flexible coupler.

I was worried that the torque of my motors is less than that in the kit but when I checked again my steppers are rated at 400mN.m(57oz-in) whereas the docs say “The standard would be NEMA 17 in any torque preferably 42 OZ/in and above (the kit comes with 76 OZ/in).”

As @Paciente8159 suggests probably the first order of business is to reduce the Z axis acceleration. It’s currently at 80mm/s^2.

IMO the Z stepper needs to be the stepper ryan sells or the stepperonline .65Nm unit when using the TR8 lead screw and “up cut” end mills.

25mm/s is about all the speed you can get out of the Z before you hit the point in the stepper torque curve where it falls on its face, try 50mm/s^s accel with that speed limit in mind. Can always start even lower then work your way back up. Worth a shot before ordering anything.

The MPCNC firmware has the Z speeds default to 15mm/s max and 80mm/s/s acceleration.

Also check that your router and bit aren’t dropping over time. At least touch it with a marker so you can see if it has dropped. Those band clamps are just holding on with friction, so microscopic movements while the router is vibrating may be accumulating.


Thanks for the replies folks. I’ll definitely give a lower Z speed and acceleration a go today. Looks like the stronger steppers are pretty cheap in the shop, so I’ll contemplate ordering them but when I ordered the hardware for the machine it took several weeks for it to arrive so I’d rather leave that as a last resort.

15mm/s is 900mm/min and I’ve been running much more conservatively than that. But as suggested I’ve lowered the acceleration to 50mm/s/s and will give that a test run this afternoon.


You can hear a stepper skip. It sounds like crunching gears. At least, you can when the router isn’t running (but it is such an abrasive sound, I think it is noticeable over a steady router noise). No gears are actually grinding, but it sounds like that.

It would really help to know if you were skipping steps (which would lead down the trail of motors, electronics, wiring, cam) or not (which would lead towards a loose screw, something slipping in a mount, etc).

Definitely wont hurt to give the coupler set screws a check while you are at it. Maybe give the set screws some thread lock if it isnt there already.

I can’t say I heard the Z lose steps at all on me when I was doing the earlier CNC race runs, but it happened. It is definitely noticeable on the X/Y though.

1 Like

My bro has an mpcnc and it also had some issues with the Z losing position. Grub screws on the stepper was pretty tight and no skipped steps but it still slipped. Seemed like the grub screw holding the rod in place was moving along the screw lands. Same issue on my lowrider to a lesser degree. (Could be that I’m the issue lol) Ultimately fixed it by filling a small flat spot on z rod where the grub screw touched the rod and cranked it down. No issues on either machine since then. Might not be the issue but another thing to try.

1 Like

Thanks. I was starting to think that might be a good idea. Time to get the grinder out.


Okay, so I was up early this morning and I removed the stepper, coupler and lead screw. I ground a nice flat on the top of the lead screw and reassembled nice and snug with fresh threadlock on the grub screws.

I also reduced Z accel to 50mm/s/s. Current config:

$0=33.333 (Step pulse time, microseconds)
$1=0 (Step idle delay, milliseconds)
$2=0 (Step pulse invert, mask)
$3=14 (Step direction invert, mask)
$4=0 (Invert step enable pin, boolean)
$5=0 (Invert limit pins, boolean)
$6=1 (Invert probe pin, boolean)
$10=1 (Status report options, mask)
$11=0.200 (Junction deviation, millimeters)
$12=0.002 (Arc tolerance, millimeters)
$13=0 (Report in inches, boolean)
$20=0 (Soft limits enable, boolean)
$21=1 (Hard limits enable, boolean)
$22=1 (Homing cycle enable, boolean)
$23=0 (Homing direction invert, mask)
$24=180.000 (Homing locate feed rate, mm/min)
$25=1000.000 (Homing search seek rate, mm/min)
$26=250 (Homing switch debounce delay, milliseconds)
$27=2.000 (Homing switch pull-off distance, millimeters)
$30=1000.000 (Maximum spindle speed, RPM)
$31=0.000 (Minimum spindle speed, RPM)
$32=0 (Laser-mode enable, boolean)
$100=100.000 (X-axis travel resolution, step/mm)
$101=100.000 (Y-axis travel resolution, step/mm)
$102=401.000 (Z-axis travel resolution, step/mm)
$110=1500.000 (X-axis maximum rate, mm/min)
$111=1500.000 (Y-axis maximum rate, mm/min)
$112=360.000 (Z-axis maximum rate, mm/min)
$120=180.000 (X-axis acceleration, mm/sec^2)
$121=180.000 (Y-axis acceleration, mm/sec^2)
$122=50.000 (Z-axis acceleration, mm/sec^2)
$130=590.000 (X-axis maximum travel, millimeters)
$131=390.000 (Y-axis maximum travel, millimeters)
$132=100.000 (Z-axis maximum travel, millimeters)

I fired up fusion and generated a new toolpath that mills just a single slot. As you can see from this video some super strange stuff happened at the end. Here’s the gcode file.

So yeah, it looks like it’s generating a bunch of G28 commands, which appear to be causing spurious moves. For example at the end of the file:

G28 G91 Z0
G28 G91 X0 Y0

At the end of the video it moves back and forwards a couple of times before returning to the zero position (skip to 5m10s to see it). Additionally when typed G0 X20 Y20 (at 5m50s) to starting checking the Z0 point the Z axis also moved. But when moved to Z0 it was back exactly where it started. Oh and the 6mm slot is actually 8mm deep.

At this point I’m pretty suspicious of G28.

Here’s my post-processor settings in Fusion:

There appears to be an option called “Safe retracts” which is currently set to G28 but also has options for G53 and Clearance height. I’m going to try running it with this set to Clearance height.

1 Like

In Grbl or µCNC G28 work like defined by the NIST

3.5.8 Return to Home — G28 and G30
Two home positions are defined (by parameters 5161-5166 for G28 and parameters 5181-5186 for
G30). The parameter values are in terms of the absolute coordinate system, but are in unspecified
length units.
To return to home position by way of the programmed position, program G28 X… Y… Z… A…
B… C… (or use G30). All axis words are optional. The path is made by a traverse move from the
current position to the programmed position, followed by a traverse move to the home position. If
no axis words are programmed, the intermediate point is the current point, so only one move is

In Gbrl Position G28 and G30 can be set via G28.1 and G30.1 I think
In µCNC G10 L2 P28 and G10 L2 P30 can be used.

EDIT after looking at the G code the funny looking motion in the end has an explanation.

G28 G91 Z0

This will make your machine go to whatever you have programmed in G28 parameter. I assume it’s the original 0,0,0 (in absolute/machine coordinates). The G91 Z0 has absolutely no effect.

G90 Sets coordinate to absolute mode

G28 G91 X0 Y0 Again this will make your machine go to whatever you have programmed in G28 parameter. I assume it’s the original 0,0,0 (in absolute/machine coordinates). The G91 X0 Y0 should (in this case) again have absolutely no effect. The problem is that the parser is sending the machine home via the previous position because it did not updated the one from the non-modal command on G28.

I’m uploading the PR with the fix in a few minutes.

EDIT2 That is also the reason I thing that in that last motion the Z also moved. Because the parser last Z coordinate was not the one where it was.

Aww dude. Turns out making a CNC controller is really hard :frowning: