Slow stepper motor

Hello all,

This is my first Arduino project, and I need help. I'm trying to control a relatively old bipolar stepper motor that I have via a H-bridge circuit, with two pin output from the Arduino. The problem is that the maximum speed of the motor seems very low to me (2.6 rps).

The H-bridge circuit is taken from the arduino reference pages http://arduino.cc/en/Reference/StepperBipolarCircuit. I've used both the <stepper.h> library and now my own code as a test, but neither can drive the motor faster than 2.6 rps. The code can send pulses much more quickly, but with a delay of less than 2ms per pulse, the motor rattles as it can't keep up.

Strangely, I can't find any definite information about how fast a stepper should be capable of rotating, though I now have the impression that it's a lot faster than this motor is running. Before I go out and buy a new motor to try to improve things, can anyone suggest whether this limit is a function of my stepper, or is it something in the circuit?

Many thanks, Gavin


For the record, the relevant part of my own code is as below:

// select the direction
  if (dir == 1){
    P=8;
    Q=9;
  }  
  else {
    P=9;
    Q=8;
  }  
    
 // rotate the stepper four steps
 // the digitalWrite functions cycle the outputs as 0,0 -> 0,1 -> 1,1 -> 1,0 -> 0,0 -> etc.
 
  for(int x=0; x<steps; x++) {
    digitalWrite(P,LOW);
    delay(2);
    digitalWrite(Q,HIGH);
    delay(2);
    digitalWrite(P,HIGH);
    delay(2);
    digitalWrite(Q,LOW);
    delay(2);
  }

2.6 rps as in 156 rpm? Or approx 500 pulses per second? Seems fast enough to me.

Msquare:
2.6 rps as in 156 rpm? Or approx 500 pulses per second? Seems fast enough to me.

Gee... 500 pulses per second. That's about 2 milliseconds between pulses. I wonder if the 2 millisecond delays he has after each state change might be causing that. :slight_smile:

Instead of delay(2); perhaps delayMicros(n); where counts from 2000 (2 milliseconds) down to 0. That should wind that motor up!

It actually sounds like it is working fine, but you need more current. What are you using for a motor supply and what are the specifications on your motors (coil resistance?) Take a look at a standard torque-speed curve for a stepper motor:

http://www.nmbtc.com/pdf/motors/PM25S-048-HHC4.pdf

Stepper motors vary wildly in power levels so this is by no means supposed to be close to your motor, just an illustration that 500 pulses per second is achievable as long as a) you have enough current going to the motor, and b) there isn't a lot of load on the motor (so it doesn't have to provide a lot of torque). A common cause of motor "rattling" is insufficient current to overcome the torque needed to just move the motor itself (and a load if attached).

Assuming you can find a similar torque-speed curve for your motor you will see what kind of currents you need to move the motor at the speed you want for a given attached load.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Many thanks all,

In my defence, I had realised the rate was determined by the 2ms delay! :stuck_out_tongue:

Thanks for the heads-up on the delayMicrosecond() command, though, which I hadn't found. Ramping the delay down got me down to 1.8ms, but that was as far as I could go. Upping the current output from the power supply helped lower this a little more, but only as far as 1.78ms.

That was the point at which, on my steep learning curve, I found that you can also use the L293D as an indoor firework... =(

Anyway, as chance would have it, I found one of the old electronics boys at work today, and it looks like this is probably the realistic limit for this (thirty-one-year-old) stepper motor. I may treat myself to a new stepper while I'm ordering the replacement L293D...

Thanks once again, you've all been extremely useful!

Gavin

OK, do you have a diagram?

Are you connecting the motor directly to the power supply?

Fast stepper circuits typically used higher voltage and series resistors to decrease the time constant of current changes in the motor and this is necessary for step rates up to 2000 to 3000 per second.. This is referred to as LR (Inductance-Resistance) drive. Typically a lot of power is 'wasted' in those resistors. I run 24VDC on "5V" motors and big resistors.

Motor Tutorial here: http://arduino-info.wikispaces.com/TUTORIALS

You need to google "LR STEPPER MOTOR DRIVER" and see stuff like this:
http://electrofriends.com/articles/electronics/microcontroller-electronics-articles/8051-8951/stepper-motor-chopping-driver/ which implies you maybe be able to get more steps/sec with a chopper drive.

That link has two different circuits on it. I'm guessing since you've mentioned the L293D that that's the one you are using. The circuit says 5--30V for the motor supply - what are you using? What's the rating for the motor (current and resistance)?

The L293D isn't worth using for less than 12V supply BTW as it wastes over 3V internally. This may be related to your 'indoor firework' experience - Darlington output stages are not nearly as good as MOSFET ones.

To get speed performance from a stepper motor you need to overcome the back EMF which means high voltage drive. However the current must not exceed the rating to avoid overheating, magnetic saturation or even de/remagnetisation - this basically means a chopper drive IC is needed for fast stepping, with high voltage supply (20 to 50V are common).

The LR idea is a low-tech attempt to achieve the same by wasting power in the resistors (basically an approximation to a constant-current drive).

The A4983 seems to be available on a nice breakout board and handles 2A and does microstepping, I've personally used L6208 chip - there are many others.