Controlling a stepper motor with a Uno

Hi,

I am very new to the Arduino world. I just bought a 4 wire stepper motor, pushbutton, lcd, bigeasy motor driver and Arduino Uno to begin testing. I have had success with all except the stepper motor (ROB-09238). This motor has an angular resolution of 1.8 degrees (200 steps). I am trying to get it to rotate 1 revolution (200 steps). When I specify the steps (in Arduino Sketch), the stepper motor moves only a fraction of that amount (it appears to be ~steps/rpm...set steps to 200 at 60 rpm and it steps 3 at 0.5 steps per second. Set steps to 600 and it steps 10 at ~ 0.5 steps per second). Any help would be appreciated.

#include <LiquidCrystal.h>
#include <Stepper.h>
#define STEPS 200

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Stepper stepper(100, 8, 9);

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int stopRun = 0;

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

stepper.setSpeed(60);
stepper.step(600);

// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
lcd.clear(); // start with a blank screen
lcd.setCursor(4,1); // set cursor to column 0, row 0 (the first row)
lcd.print("Hello, World"); // change this text to whatever you like. keep it clean.
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Starting Diagnostic");
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Level 1 Begin");
}

void loop(){
// read the state of the pushbutton value:
if (stopRun == 0){
buttonState = digitalRead(buttonPin);
}
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Starting Stepper ");
stepper.step(200);
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Stopping Stepper ");
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Button is : ON ");
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);
buttonState = LOW;
stopRun = 1;
}
else {
// Set Stepper speed
// turn LED off:
digitalWrite(ledPin, LOW);
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Button is : OFF");
}
}

Because Microstepping?
"defaults to 16 step microstepping mode"

You need 200 * 16 (micro) steps to turn it a full revolution

As an aside, the "Big Easy" drive is the same thing as a "Pololu"-style driver (as used on repraps) and you can get them for a fraction of the price.

Ok a little correction after looking at stepper.cpp

Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2)

The stepper library (at least the one from Arduino1.0.5) does not support using a proper stepper driver, with a DIR pin and STEP pin.

I think there is a different stepper ("accelstepper") library does support use of a proper driver. So I would recommend trying that library.

Pravda,

Thank you for the reply. The microstep turned out to be the case (with an additional twist). If I set the steps to 3200 (200x16), it then rotates 45 degrees. In order to rotate 360 degrees I have to step 4 X 3200 for a full rotation. I am happy to be able to control a revolution, I would just feel better knowing where my misunderstanding is with the steps (your comment on Arduino library support perhaps). Also...thanks for the heads up with regard to the driver.

#define STEPS 3200
#define ONE_REV 12800
Stepper stepper(STEPS, 8, 9);

void rotate_degrees_forward(float degree_amount, Stepper motor)
{
float fractional_amount = degree_amount/360.0;
int rotation_step_amount = int(float(ONE_REV) * fractional_amount);
motor.step(rotation_step_amount);
}

Correction...

.."it then rotates 90 degrees" (not 45)