# Z Axis max rpm not working?

**URL:** <https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391>\
**Category:** Troubleshooting\
**Created:** [April 3, 2021, 12:23pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391 "2021-04-03T12:23:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 3, 2021, 12:23pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/1 "2021-04-03T12:23:40Z")

</div>

Hello. I have custom made z Axis with CHP-36GP-555-ABHLL motor which is 220rpm, 34 pole encoder that equals 1836 transitions per 1 rotation. And I have problem with setting pid for that motor. In code I found Zmaxrpm 12,6 and if I increase that value my motor is not spining faster. While in motor and encoder test motor is spining full throttle and is spining nice but while doing gcode motor is choppy. How to set faster feed rate for z-axis?

[![](https://img.youtube.com/vi/PFlIflFFEC4/maxresdefault.jpg "Maslow z Axis chp 36gp 555(2)") ](https://www.youtube.com/watch?v=PFlIflFFEC4)

[![](https://img.youtube.com/vi/PORBNQBaQlQ/maxresdefault.jpg "Maslow z Axis chp 36gp 555(1)") ](https://www.youtube.com/watch?v=PORBNQBaQlQ)

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 3, 2021, 5:00pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/2 "2021-04-03T17:00:27Z")

</div>

Thanks for the videos! Those are super helpful to communicate what is going on.

> [@powieff](#):
>
> How to set faster feed rate for z-axis?

My first instinct is that that what we’re seeing is the feedrate being set in the gcode. If the gcode like is something like `G01 Z100 F200` then the motor will spin at the speed required to move the z-axis 200mm/minute regardless of how fast the motor can spin at max speed.

The jerky movement you are seeing is absolutely a PID control thing. Because this motor is so different from the stock motor you will need to tune the PID values. I would start by reducing the P and I terms.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 3, 2021, 6:01pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/3 "2021-04-03T18:01:38Z")

</div>

Thanks for reply. I know that I can set in gcode but I believe z Axis is hard coded for Zmaxrpm 12,6 in source code, but when I enter value of 100, 200, 2000 it seems to have no effect. Also I tried tuning PID but also without succes values can be big as 200 for KP or small as 0,000000002 movement is choppy all the time. I tried to connect this motor as Left and used pid tuning tool but those values where also choppy. My last hope is to increase speed of that motor…

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 4, 2021, 4:10pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/4 "2021-04-04T16:10:20Z")

</div>

Hmmm let me take a look. Where is it hard coded?

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 4, 2021, 5:34pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/5 "2021-04-04T17:34:48Z")

</div>

Settings.cpp line #83

sysSettings.maxZRPM = 12.60; // float maxZRPM;

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 5, 2021, 3:26pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/6 "2021-04-05T15:26:07Z")

</div>

Hmm that does seem to be the right place. I’m seeing `sys.feedrate = constrain(sys.feedrate, 1, sysSettings.maxZRPM * abs(zAxis.getPitch()));` in GCode.cpp.

The other side of that constraint is the sys.feedrate which comes the gcode you send to the machine. Are you using the jog up and down buttons in Web Control or some other program? Those will specify a move speed also which could be the constraint.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 5, 2021, 4:08pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/7 "2021-04-05T16:08:58Z")

</div>

Yes mostly while testing I was using up and down buttons in webcontrol but also used bcdragon gcode in which there is no feedrate on z Axis movements. So in my case there should be 8mm pitch \* 220 rpm for full speed? Is this value based on encoder steps for getting rotation speed? In original Maslow settings there is 12,6 \* 3,17 if I remember correctly.

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 5, 2021, 5:11pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/8 "2021-04-05T17:11:59Z")

</div>

> [@powieff](#):
>
> in my case there should be 8mm pitch \* 220 rpm for full speed?

That seems correct to me 😀

> [@powieff](#):
>
> Is this value based on encoder steps for getting rotation speed?

Yes, it will be. Great point! That could also be the limiting factor. When you see slow motion do you see the correct distance of motion? ie if we tell it to move up 20mm does it actually move 20mm albeit more slowly than we want?

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 5, 2021, 5:14pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/9 "2021-04-05T17:14:44Z")

</div>

+/- correct distance is travelled cause of that jerky moves. It’s really close.

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 5, 2021, 5:21pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/10 "2021-04-05T17:21:21Z")

</div>

Got it, so if it’s close then I don’t think the encoder steps is the right issue. How many steps per mm of encoder resolution do you have? It could be that the jerky motion is being caused by not enough encoder resolution.

What do you see if you run the gcode file:

```
G21
G90
G01 Z30 F5000

```

Is the motion still slow?

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 5, 2021, 5:25pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/11 "2021-04-05T17:25:29Z")

</div>

Right now I am away from machine, will check that gcode tomorrow morning. For 1mm it’s 230 encoder steps, so should be enough for pretty decent resolution, I think 🙂

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 5, 2021, 5:27pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/12 "2021-04-05T17:27:50Z")

</div>

Sounds like a plan!

I agree, that should be plenty of resolution.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 6, 2021, 10:13am UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/13 "2021-04-06T10:13:44Z")

</div>

I tried gcode with f5000 but there is no change. Spinning slow like before.

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 6, 2021, 2:46pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/14 "2021-04-06T14:46:04Z")

</div>

Darn.

Do you feel comfortable adding some Serial.println() lines to the firmware? That way we could look for where the constraint is being applied.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 6, 2021, 8:07pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/15 "2021-04-06T20:07:25Z")

</div>

If you can guide me a little bit where should I put them, sure. But as soon as I can visit my workshop, on Friday. Thanks for response and have a great week!

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 7, 2021, 9:23pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/16 "2021-04-07T21:23:22Z")

</div>

I’m not sure which firmware version you are using so I’m going to use mine as the example. They should all be pretty much the same.

What we’re trying to do is figure out how the speed is being limited.

Let’s print out what the feedrate read from the gcode is. To do that let’s add a print statement after line 778 in the file [GCode.cpp](https://github.com/MaslowCNC/Firmware/blob/master/cnc_ctrl_v1/GCode.cpp) so that it looks like

```
sys.feedrate = sys.inchesToMMConversion*extractGcodeValue(readString, 'F', sys.feedrate/sys.inchesToMMConversion);
Serial.println("Feedrate read from gcode: ");
Serial.println(sys.feedrate);

```

Then let’s print it out again after the feedrate is limited on line 793 in the same file. Something like:

```
sys.feedrate = constrain(sys.feedrate, 1, sysSettings.maxFeed); //constrain the maximum feedrate, 35ipm = 900 mmpm
Serial.println("Feedrate after global limiting:");
Serial.println(sys.feedrate);

```

That will let us see if the feedrate is being limited globally.

Then finally let’s check to see if just the z-axis is being limited by adding a print statement after line 955 in the same file to see if it is being limited for just the z-axis. Something like:

```
sys.feedrate = constrain(sys.feedrate, 1, sysSettings.maxZRPM * abs(zAxis.getPitch()));
Serial.println("Feedrate for just z:");
Serial.println(sys.feedrate);

```

That should give us some insight into where things are slowing down.

One more thought I had is that are you sure the pitch of your z-axis is right? If it thinks there is a super coarse threaded rod in there it will move more slowly because the number of rotations to move one mm is less. Probably a long shot, but I thought I would put that out there.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 9, 2021, 5:54pm UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/17 "2021-04-09T17:54:59Z")

</div>

So I am sure that pitch is 8mm, and I entered those print lines but, last println just for z is in other line not 955 cause my whole gcode.cpp is 893 lines long. I am using 1.26 firmware . When I upload that new compiled firmware to Arduino should I make any steps in webcontrol?  
After running that gcode from above  
G21  
G90  
G01 z30 f5000 I get this:

Feedrate after global limiting:  
800.00

And that’s it.  
My global feedrate is set to 800.  
But nothing about z Axis, even when I control that axis with up and down buttons I get only print line with global feedrate.

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [April 11, 2021, 2:03am UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/18 "2021-04-11T02:03:41Z")

</div>

Where are you getting the firmware from? I think that I need to look at the same file you are using to be helpful 😔

---

<div class="post-metadata">

**Author:** ![Orob](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/orob/32/16344_2.png) [@Orob](https://forums.maslowcnc.com/u/Orob)\
**Post date:** [April 11, 2021, 3:02am UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/19 "2021-04-11T03:02:43Z")

</div>

I was just cruising the firmware and found this interesting in the cnc\_ctrl\_v1.ino file at line 76

> sys.feedrate = sysSettings.maxFeed / 2.0

if it is useful to your discussion, there it is. If not… good luck.

---

<div class="post-metadata">

**Author:** ![powieff](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@powieff](https://forums.maslowcnc.com/u/powieff)\
**Post date:** [April 11, 2021, 7:56am UTC](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391/20 "2021-04-11T07:56:48Z")

</div>

I believe that I downloaded it from GitHub, but I am not 100% sure. Where would you like me to upload it?  
Thanks Orob I will look at it.

[Next page](https://forums.maslowcnc.com/t/z-axis-max-rpm-not-working/16391.md?page=2)
