Stepper Motor - too ambitious?

This is my first time using an Arduino Uno. I have an Arduino Motor Shield R3 connected to a 12vdc 5a/h battery. I've been trying to run a basic stepper test but have had no luck. The shield A and B blinks and the stepper makes noise but it doesn't do any steps. The L298P also gets hot pretty fast.

Here is the stepper I'm using: 27:1 Planetary High Torque Nema 17 Stepper

Is this stepper too much for this configuration?

Electrical Specification:

  • Manufacturer Part Number: 17HS19-1684S-PG27
  • Motor Type: Bipolar Stepper
  • Step Angle: 0.067 deg.
  • Holding Torque: 3Nm
  • Rated Current/phase: 1.68A
  • Phase Resistance: 1.65ohms
  • Inductance: 2.8mH+/-20%(1KHz)

I have the Black(A+), Green(A-) connected to A on the power block and Red(B+), Blue(B-) connected to B. I did not cut the Vin Connect.

I tried the code from this link but nothing happens:

http://forum.arduino.cc/index.php?topic=194077.0

Does anyone know what I'm doing wrong? I really want to learn this but I'm stuck.

I set my steps to 5373, RPM to 20, and test rotation to 1/8.


// Include the Stepper Library
#include <Stepper.h>

// Map our pins to constants to make things easier to keep track of
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;

// The amount of steps for a full revolution of your motor.
// 360 / stepAngle
const int STEPS = 5373; // 360 divided by 0.067

// Initialize the Stepper class
Stepper myStepper(STEPS, dirA, dirB);

void setup() {
// Set the RPM of the motor
myStepper.setSpeed(20);

// Turn on pulse width modulation
pinMode(pwmA, OUTPUT);
digitalWrite(pwmA, HIGH);
pinMode(pwmB, OUTPUT);
digitalWrite(pwmB, HIGH);

// Turn off the brakes
pinMode(brakeA, OUTPUT);
digitalWrite(brakeA, LOW);
pinMode(brakeB, OUTPUT);
digitalWrite(brakeB, LOW);

// Log some shit
Serial.begin(9600);
}

void loop() {
// Move the motor X amount of steps
myStepper.step(STEPS/8);
Serial.println(STEPS);
// Pause
delay(2000);

// Move the motor X amount of steps the other way
myStepper.step(-STEPS/8);
Serial.println(-STEPS);
// Pause
delay(2000);
}

Always use code tags.

The motor driver cannot provide the current required by that low resistance, high current stepper.

For that motor, you need a modern switching driver like this one. Be sure to carefully follow the instructions to set the current limit to less than 1.5 amperes.

You may find some useful info in Stepper Motor Basics
and, if you use a stepper driver like the DRV8825, this Simple Stepper Code should get you started.

Your motor has a coil resistance of 1.65 ohms. If you feed that with 12v you will get over 7 amps which will destroy the motor. As things are the L298 seems to be shutting down.

The DRV8825 (and similar stepper drivers) can limit the current in the motor coils which allows them to use high voltages for good motor performance.

...R

Can't drive a low impedance stepper from a pair of H-bridges, you need chopper-driver
like DRV8825. Well, it is possible to use MOSFET H-bridges and a 2.5V supply but its
really clumsy and expensive and you'll not get more than about 150rpm or so and its
torque will droop dramatically with speed. DRV8825 driver breakouts are extremely
cheap these days - at 1.5A they need heatsink and perhaps a bit of forced cooling, but
run from 24V and you'll get the stepper zipping around nicely.

The whole point of a low-impedance stepper is to go fast, and to do this you must use
current-drive, not voltage-drive. The supply voltage needs to be large to overcome EMF
when the motor spins fast - 3000rpm is achievable with low-impedance steppers this way.

If you only want slow movement the simple cheap option is get a high-impedance unipolar
stepper (5,6 or 8 wire) and drive it with a ULN2803. But again the speed is very limited.

Thanks to all of you for the quick response and sorry about not using the code tags!!

Maybe I could get a little advice on selecting the right hardware for my simple project. If this isn't the right topic section let me know and I can move my post.

Here is my simple project using an Arduino Uno:

  • Open a small lightweight door slowly (<5rpm) to 120 degrees (I don't know how much torque it requires but you can open by gently pulling with your pinkie finger).
  • Close the door 12 hours later and prevent it from being opened by external force.
  • Loop this every 12 hours...

The only reason I bought the stepper I listed is because it has plenty of holding power to keep the door shut. I want the door to resist 3-5 ft/lbs of torque.

After reading your helpful comments I don't think I want to build up the driver to handle this stepper motor unless it would be physically connected to the Arduino like the shield is. I also don't want to risk having anything meltdown and cause a fire. As you can tell, I'm new to all of this electrical business and I don't want to make a costly mistake.

What do you think of this option?

I have an Adafruit Motor Shield v2 with one blown TB6612 MOSFET driver from an earlier attempt (learning lessons the hard way).

Using the Adafruit Motor Shield v2 would it make more sense to:

  • Use a lightweight stepper (please suggest one if you have a favorite) to open and close the door.

  • Use one of the servo connections to run a servo that "bars" the door so it doesn't open.

  • How hard would this be to code? I have to piece things together from what I find on postings.

  • Can I rely on the stepper to maintain its position reference for open/close or should I use hardware to detect?

  • How would you do it if you wanted to keep it simple?

Thanks again to you guys, I've read your other posts and it's clear you guys are pros!

For a lightweight door like that, consider the extremely cheap, geared down 28BYJ stepper, available for less than $5 (with driver!) on eBay. The gears would provide significant holding power.

Tutorial at 28BYJ-48 Stepper Motor with ULN2003 driver and Arduino Uno – 42 Bots

Thanks for the suggestion!

Here's another newbie question:

Which components (Arduino and stepper) are drawing power when the door is not being moved, i.e. the door is already open or closed and now we would be waiting 12 hours for the next action?

I would like the steppers to be powered off to conserve battery life. If the steppers aren't being powered, won't they lose their holding power?

That's why I'm thinking have a servo run to "bar" the door closed so I don't have to rely the stepper's holding power...

All motors lose "holding power" when off. You need to depend on gears for that. Worm gears are best.

LionKing:
Here is my simple project using an Arduino Uno:

  • Open a small lightweight door slowly (<5rpm) to 120 degrees (I don't know how much torque it requires but you can open by gently pulling with your pinkie finger).
  • Close the door 12 hours later and prevent it from being opened by external force.
  • Loop this every 12 hours...

The only reason I bought the stepper I listed is because it has plenty of holding power to keep the door shut. I want the door to resist 3-5 ft/lbs of torque.

That sounds like a job for a servo. It will be very much simpler to implement than a stepper motor and cheaper.

If necessary you could use a second small servo to operate a bolt to keep the door locked when the power is turned off.

A stepper motor will need at least one limit switch to identify the zero position every time the Arduino restarts. And a stepper needs full power even when stationary if it is to hold position.

...R

Thanks for the input. After looking around the servos do seem to make a lot more sense.

Do you have a preferred servo you like to use for an application like this?

Also, what is a good resource to learn how to set up the linkage of servos so you can accomplish various tasks?

I don't have any preferred brand of servo. I would choose the cheapest that has sufficient torque. Your motor does not have to move very often.

As far as linkages are concerned I suggest buying a cheap servo and experimenting. You could look at how the model aircraft folk use them - there are lots of magazines on sale.

...R

Thanks for all the help!

To answer my original question, yes, this stepper is way too ambitious for my setup.