Stepper motor vibrating but not turning

Hi!

Well the title speaks for itself. Does this indicate a normal mistake?

Im using a Nema 17 stepper motor (1.7A) with a EasyDriver and 9V battery supply

I use this layout:

And this code:

#include <Stepper.h>
int oneway;                             // counter for steps
int onerev = 6400;                  // number of steps each direction (edit this 
                                             //  for your particular motor)
int microSecDelay = 30;          // delay between steps and speed of the motor 
                                             //   (about as fast as the system can react,
                                             //   higher number = slower)
int dirPin = 8;                        // output pin for stepper motor direction
int stepPin = 9;                      // output pin for the pin used to step the motor
void setup() {                
  pinMode(dirPin, OUTPUT);       // Assign output mode to pin for direction
  pinMode(stepPin, OUTPUT);     // Assign output mode to pin for setp
  digitalWrite(dirPin, LOW);       // Initialize dir pin 
  digitalWrite(stepPin, LOW);     // Initialize step pin
  oneway = 1;
}
void loop() {
  if (oneway < onerev + 1)                  // Still in first revolution?
    {
      digitalWrite(dirPin, LOW);             // Keep direction pin low
    }  
  else
    {
      digitalWrite(dirPin, HIGH);            // If not in first revolution change 
                                                         // direction pin to High
    }
  digitalWrite(stepPin, HIGH);               // Step motor
  delayMicroseconds(microSecDelay);   // Wait microseconds
  digitalWrite(stepPin, LOW);                // Step motor
  delayMicroseconds(microSecDelay);   // Wait microseconds
  oneway += 1;                                  // Increment direction counter
  if (oneway > onerev * 2)                  // If we have exceeded two revolutions
    { oneway = 1; }                            // Reset counter to start over again
   
}                                                       // EOF

Ive used a multimeter and found that the first cable(from left) and third gets 7V, and the other two a few mV. Should it be like that?

I know I should use a Big easy driver or something similar, I've already ordered one, but shouldn't it still be able to turn?

Ive followed this tutorial: http://www.instructables.com/id/Stepper-Motor-Easy-Driver/?ALLSTEPS

-Thanks for any replies!

Your code seems to run your stepper in 1/32 microsteps, as most of today's stepper motors want to have 200 full steps for one revolution.

So the 6400 steps / revolution (onerev = 6400) result in 200x32 steps = one revolution.

For your driver the max. microsteps = 1/8 !! - that is, when MS1 AND MS2 are left open (internal pullups result in two HIGH's and that is 1/8 microsteps for this driver).

So:

  1. make sure you have nothing connected to MS1 and MS2
  2. change your code line

int onerev = 6400;

into
"int onerev = 1600;"

9V batteries cannot be used to power motors.
Use a proper 9-24 volt power brick capable of 2 or more amperes current and be certain to set the current limit correctly.

An Easydriver can only supply a max of 750mA. You need a more powerful driver such as a Pololu DRV8825 for a motor that requires 1700 mA.

And a suitable power supply.

The Stepper library is not designed for stepper drivers like th Easydriver or DRV8825 that take step and direction signals. You should be able to get the motor working without any library using this Simple Stepper Code

If you wish to use a library try AccelStepper.

...R
Stepper Motor Basics