Running NEMA 17 stepper at high speed

Hello!
I have an application where I need to have a stepper motor spin 1 single revolution in under 200ms with very small load.
For this, I am using a DRV8825 and a NEMA17 motor by Two Trees, model 17hs4401. I have changed the Vref of the driver to about 0.65V, so that the max amps should be 1.3. The motor is rated for 1.5A, so I am keeping some leeway to avoid killing the motor. I am also using full steps (no microstepping). The problem is, when I try to go above about 300RPM (which would be 200ms full rotation) it starts skipping steps and being inconsistent. I am powering the motor with an 18V power supply.
I know here there are several ways to improve the situation (increasing the voltage, maybe buying another motor with higher torque, etc…) but what do you think is more critical? Other ideas?
Thank you!

Powering the motor with a higher voltage is more important that anything to get your motor to perform at maximum speed it is capable of.

Also try removing the "small load" and see if you can go a touch faster before things stop working again.

Do you also give it time to stop before reversing it?
What code are you using? The motor can also be made to work faster if you accelerate up to a speed, and then decelerate just before your stop point.

To get the highest possible speed requires starting from a low step rate and accelerating the maximum desired, and high motor power supply voltage. The DRV8825 can accommodate a motor power supply of 36-40V (avoid using the absolute maximum of 45V).

Thanks for the reply! I cannot remove the small load because it is part of my application (a shutter curtain that moves out and in, in under 200ms), but I can buy a more powerful power supply. I checked the power supply current and it always read 18V and 0.3A on the current. Does this mean a 36V/1A power supply is good enough? I am wondering this because 18/3.6 (the motor rated voltage) is actually 5, and 0.3A*5 is 1.5A, which means the 0.3A at 18V I get correspond to 1.5A inside the motor coils. So, if I were to buy a 36V power supply for sure I would be fine with 1A rating no? (In principle I would just need 0.15)

What code would you use to achieve this? As of now I just used a simple code like this:


#include <Stepper.h>

const int stepsPerRevolution = 800;

// Initialize the Stepper library with steps per revolution and pins connected to the DRV8825
// (step, direction)
Stepper myStepper(stepsPerRevolution, 3, 4); // Pin 3 for Step, Pin 4 for Direction

void setup() {
  // Set the motor speed to 350 RPM
  myStepper.setSpeed(350); 
}

void loop() {
  // Step one full revolution (360 degrees)
  myStepper.step(stepsPerRevolution);

  // Optional delay between revolutions
  delay(1000);
}

First of all, I am very confused to why I need 800 steps since I am not micro stepping (I have left the Enable, MS1, MS2 and MS3 pins disconnected, which should mean full step mode in the DRV8255), but when I tried 200 steps I could see the motor only did 1/4 of a turn…
I need to just make 1 full rotation at a time, as fast as possible (below 200ms). How would you implement this in a code that takes acceleration into account? Will this make it less likely to lose steps at 350 RPM?

Please post a complete circuit diagram. Hand drawn is fine, as long as all pins and connections are clearly identified.

The AccelStepper library has examples and documentation on how to use the various library functions and features.

200 steps in 200ms with acceleration would be accellerating 100 steps in 100ms and decelerating for 100 steps in 100ms.

With x=1/2at^2 rearranged to a = 2*x/t^2 = 2*100/0.1^2 = 20000steps/sec^2 and a top speed of v=at=20000*0.1=2000steps/sec. That seems within AccelStepper's 400Hz limit on a Uno.

Look into the Accelstepper bounce example:

Or the more adaptable MobaTools example:

A problem you might be having with stepper.h is that it doesn't accelerate, so you might be stepping or slowing faster than the hardware can keep up with as it instantly goes to 1000steps/sec. You could tune an acceleration-aware library to match your hardware, and it shouldn't lose steps.

1 Like

I just followed this online tutorial by “How to Mechatronics” and connected the step pin to pin 0 on the arduino and dir pin to pin 3.

The wiring diagram is wrong in two places.

/FAULT should NOT be connected to 5V, but /RST and /SLP should be.

Follow Pololu's wiring instructions.

1 Like

Apparently this is an alternative wiring diagram according to the link you provided

1 Like

Thanks, I wasn't aware of that alternative. Not the problem, then.

1 Like

No. You can't check the current or voltage that the motor is taking by using a meter, because this will return only an avrage value and not a peak value. It is the peak current that you need to know. Remember there are two coils in the motor, so what ever current is taken by one coil is needed to be doubled.

The data sheet gives the following information

  • Rated current/phase: 1.5A
  • Phase resistance: 1.5 ohms
  • Phase inductance: 2.8mH
  • Rotor inertia: 54g cm3

I don't understand this why is it actually 5?

You also go in to say:-

Which seems to me not to make any sense.

Post #7 from Dave has an other solution, that I suggested on the last line of my first post. That would also allow any motor to work a lot faster.

I apologize for not being clear with my previous message. What I am wondering is if the current I read on the power supply is the same one that goes through the motor coils, or if instead the power is conserved (like in a 100% efficient transformer), and so if I have a higher voltage I will see less current on and viceversa. In my case, the motor has a rated voltage of 3.6V and a current per coil of 1.5A, which means it is 10.8W for two coils. My power supply is outputting 18V, and if I assume 100% efficiency then I should be reading 0.6A only (as 0.6*18=10.8) on the power supply.
In other words, even if my two coils take 3A combined, should I purchase a more high voltage power supply (i.e. 36V) with a current rating of 3A (very expensive) or is the power what matters (so as long as I have anything above 10.8W is fine), so for example a 36V/1A power supply would be 36W, which is significantly more than 10.8W. Am I thinking about this correctly? Is it the power that matters and not the current?

Yes it is the power that matters.

The conservation of energy law applies. The drivers control the average current/power delivered to the coils, but with higher input voltages it can deliver quicker doses of the same power.

Yes, although the process is not 100% efficient and components like power supplies should not be operated at their rated maximum.

The motor power supply must be rated for a significantly higher power than your calculation suggests. 2X is a general rule of thumb, so maybe 20W for a motor consuming 11W.

1 Like

No.
The current you read from a meter on the power supply meter is the long term avrage, not the peak current.

Any power supply needs to be able to supply the peak current without dropping the voltage it supplies.

With a stepping motor the maximum power is consumed when the motor is not moving. But this still tells you nothing about the peak power that the motor is demanding.

Your stepping motor is acting as a switched mode power supply. This means that the current is being monitored and when it reaches the set value it turns off the voltage. The efficiency of this process is about 80 to 90%, so you will loose some of the power from your power supply.

In industry you normally de-rate components to use a maximum of 80% the rated value. This has sufficient safety margin so as to not effect the life time calculations of a part. In fact life time of components assume you have 80% de-rating. The other thing that affects component life time is temperature. For every 10ËšC you can drop the temperature the life time doubles. Assuming you have an ambient temperature of 25ËšC.

I think de-rating to 50% is a bit much.

Thank you for the informations!
I have a bonus question for you. I have read that when operating in full-step mode, the driver energises the coils only to 71% of the set current. Does that mean that I can raise the Vref with the potentiometer on the DRV8825 such that I go past 1.5A (the current rating of my motor)? In this example, can I go almost to 2.11A (or actually, 1.05 volts as Vref, since the formula is just current=Vref*2) without risking to destroy my motor?

The bonus reply is:-
Where have you read this?

I have read it almost everywhere, but most importantly I have read it on Pololu’s website

Page14 of the DRV8825 datasheet?
Current through the coils varies between 100% through one to 2 * 71% if both are driven.
So no, you shouldn't increase the current setting.
Leo..

1 Like