Close

Axis Resolution & Speed

A project log for Monoprice Select Mini Electro-Mechanical Upgrades

Endeavoring to build upon the existing fanbase work of this $200-ish printer.

michael-obrienMichael O'Brien 10/09/2016 at 14:240 Comments

I've mentioned before that the fastest I've measured from this board's microcontroller is ~38 kHz. With some math which I'll show later, this gives a theoretical speed of ~395 mm/s for the X, Y, and Z-axis steppers. However, stepper driver speed and torque is a much more complex issue than I even expected. Here is what I've learned so far and I want your help to point me which direction I should go.

PS: This is a *long* post

I recently edited 2 past logs because the stepper drivers *are not* HH4988's, but actually HR4988's. Their datasheet is available here, mirrored here. Unlike the A4988 that it's derived from, which microstepps at just 1/2, 1/4th, 1/8th, & 1/16th intervals, this driver uses all 3 bits and will do 1/32nd, 1/64th, & 1/128th microstepping on top of the others. Microstepping is one factor regarding speed and resolution.

According to reprap.org's wiki, Marlin's limit on an 8-bit, 16 MHz micro is 40 kHz, which makes me believe that despite having a <facetious> glorious 32-bit microcontroller </facetious>, they aren't clocking it anywhere close to it's 72 MHz limit, but instead at ~16 MHz. I've measured a peak step rate of about 38.17 kHz. I plan on sniffing the power line to see if I can figure out a clock speed. If this assumption is true though, either hacking the firmware, overclocking by using a faster crystal, or getting Malyan to let us configure how fast the STM32 runs, we're stuck at a low steps-per-second rate.

I *hope* that we're running at 16 MHz and I hope that we can be given 64 MHz speed. Coupled with a a pulse rate of 3.33 us average, 3.75 us peak, we could get a step rate of ~133 kHz, or about 3.5x faster than the current top speed. Increasing the max step rate our micro wouldn't the limitation to speed or resolution. The is the second factor regarding speed and resolution.


Back to the HR4988. I need to do some more active probing of this chip while driving a motor, particularly because my current probe has a bandwidth of 20 kHz and the PWM current control has a clock rate of ~32 kHz when RSOC is shorted to ground. When dealing with the current control, the HR4988/A4988 doesn't have the ability for a straight up fast decay mode. This is partially why in prior captures, the current fails to escape the windings and we begin missing microsteps when we try and go faster than ~50 mm/s. However, if you put a pull-down resistor between RSOC & ground, you can change the frequency of the PWM current control, but this is caused by adjusting the off time of the logic. With reduced off time, faster speeds can only be achieved through hardware means: "braking diodes". These are factors 3 & 4 that affect speed and resolution.


But what about the motors? Ah the motors. Physics. Electromagnetic spectrum. Not trying to be pedantic, but high school and college physics are a handy thing to remember here. I'm assuming most are like me that if they see 2 motors rated at similar holding torque values and one is rated for 1.7 A and the other for 2 A, that the one w/ a 1.7 A rating is more "efficient". THIS IS WRONG. Have a read here and download StepperSim here.</end forward>

The problems with brushless motors is back electromotive force, aka "back EMF". This is the magnetically-induced voltage caused by the spinning motors. It causes 2 things to happen: electromagnatic braking and the inability to "drain" current as it is sloping towards 0. Back EMF can be estimated as a relation between holding toque and max current rating with the following equation:

Take this number and multiply it by how many RPMs your motor is revving to see what your estimated RMS, B-MEF voltage is. Long story short is that you want this as low as possible. You cannot decrease this voltage unless you spin the motor slower. You can overcome the effect of this voltage by increasing the drive voltage. Why? I'm not sure. You can dissipate the voltage with braking diodes too, but you have to pick the right ones.

The short of this is that you want a high amperage motor that has just enough torque to move your printer components at a desired RPM, thus speed. This is the 5th factor in motor speed and resolution.


The last thing to consider is much simpler and about the only other thing most people consider: how big is the pulley on the end of the motor? We have a 17-tooth pulleys, ones without concentric bores, all across the machine. With a MXL belt, which dictates a 0.08" tooth pitch, this gives us a 34.544 mm travel distance in 1 revolution of the motor. With our 1.8˚ stepper motor and 1/16th microstepping, we have an idealistic 10.795 micron resolution on X & Y axes and an error of +/- 86.36 microns. If we lower the tooth count, we increase resolution proportionally but decrease speed proportionally. Increase tooth count and the opposite happens. This is the final factor in speed and resolution.

Note: Even though the MXL belt is 2.032 mm per tooth, a GT2 belt is 2 mm per tooth. This is 1.6% error, which matters over the long run. However, on a 24 tooth pulley, about the largest that can fit on the Z-carriage, this will cause about a 9.6% difference in tooth pitch (think of is in quadrants so it's 1/4 of the total error) on each end of the belt if you use a GT2 pulley with a MXL belt. That's a little high, but doable. For a 10 tooth belt, this drops to 4%. The short of it is that if you *can* get away with using a GT2 pulley of 24 teeth or fewer and an MXL belt.


Okay so how does all of this relate? From testing with the simulator, the most reliable current control occurs when there are at least 2 PWM cycles per microstep. Assuming we leave our stepper driver configuration untouched, we have a 32.154 kHz frequency we get to play with and that translates to a maximum step rate that I'll round to 16 kHz. If I go with 3 PWM cycles per microstep, I drop it to a rounded 10.5 kHz. Thusly, we have a max step rate of 10.5-16 kHz. With this said, here are the possible ranges that I see are:

With the stock 12 V supply:

  1. Using a 0.9˚ stepper, 24 tooth pulley, 1/16th microstepping, we're looking at a speed range of ~78.75-122 mm/s and a resolution of 7.5-7.62 microns with an error of +/- 42.5-43.18 microns depending on the pulley you use.
  2. Using a 1.8˚ stepper, 24 tooth pulley, 1/32 microstepping, you'd think you're looking at a similar range. However, the best motor I can find that can go this fast will limit you to ~80 mm/s with the same theoretical resolution of 7.5-7.62 microns, but the error is +/- ~120-122 microns due to the increase step size.

The lower inductance of the 0.9˚ motor allows it to be driven at the higher step rate at 12 V. I do not have all of the numbers I need to see how fast that motor can accelerate in our configuration. What happens when the pulley is reduced to 10 teeth?

With the stock 12V supply:

  1. Using a 0.9˚ stepper, 10 tooth pulley, 1/16th microstepping, the speed range is ~32.8-51.6 mm/s and the resolution increases to 3.125 microns and an error of +/- 25-25.4 microns.
  2. Using a 1.8˚ stepper, 10 tooth pulley, 1/32th microstepping, the top speed drops to ~32.8 mm/s with a resolution of 3.125 microns with an error of +/- 50-50.8 microns depending on pulley.

In either of these scenarios, upping the power supply voltage to 19 V top speeds to 165.5 mm/s & 70 mm/s for the 0.9˚ stepper and ~132 mm/s & ~55 mm/s for the 1.8˚ stepper.


In summary, why haven't I said which motors these are? These are small NEMA 17 motors with holding torque ratings about 50-75%, at best, more than the Z-Axis stepper, The Z-Axis drive acts with mechanical advantage in favor of the motor. The X & Y drives act with mechanical advantage against the motors. The motors will have to be over-driven to match stock torque ratings. In order to know if we can overdrive them, let's look at the stock setup. Our drive current is set to ~0.8 A RMS, 1.136 A peak. We know they work fine at this drive level.

  1. Stock motor: 25.5 N*cm @ 1.33 A RMS
    1. 0.8 A RMS equates to 15.3 N*cm
    2. At 2.1 Ohms, 0.8 A is 1.34 W
  2. 0.9˚ stepper: 11 N*cm @ 1.2 A RMS.
    1. 15.3 N*cm equates to 1.67 A RMS
    2. At 3.0 Ohms, 1.67 A is 8.4 W
  3. 1.8˚ stepper: 13 N*cm @ 1 A RMS.
    1. 15.3 N*cm equates to 1.18 A RMS
    2. At 3.5 Ohms, 1.18 A is 4.87 W

Yes, the 1.8˚ stepper runs cooler and have the same "resolution" by microstepping, but instead of thinking of microstepping as a means to increase resolution, it should be thought of as a means to drive the motor more smoothly and more quietly. The resolution gain isn't true due to in inaccuracies of microstepping. Thank you HAD for some actual data behind this.

Anyhow, this exploration is the majority of what is needed to be known in order to use the existing driver to quickly drive the steppers. If you wish to go faster, you need more voltage and then you have to solve the heater problems and fan problems.

Discussions