I got the stepper motor working on the Arduino with the A4988 Pololu Motor Driver Controller with Voltage Regulator. The stepper motor that I bought is using from Jameco. The code is the example code provided with the Arduino complier except there are some modifications. I want to increase the speed, but I am having doing that. Can some help me to increase the speed?
Code:
/*
Stepper Motor Controller
language: Wiring/Arduino
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 and 9 of the Arduino.
The motor moves 100 steps in one direction, then 100 in the other.
Created 11 Mar. 2007
Modified 7 Apr. 2007
by Tom Igoe
*/
// define the pins that the motor is attached to. You can use
// any digital I/O pins.
#include <Stepper.h>
#define motorSteps 400 // change this depending on the number of steps
// per revolution of your motor
#define motorPin1 22
#define motorPin2 23
#define ledPin 13
// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2);
void setup() {
// set the motor speed at 60 RPMS:
myStepper.setSpeed(120);
// Initialize the Serial port:
Serial.begin(9600);
// set up the LED pin:
pinMode(ledPin, OUTPUT);
// blink the LED:
blink(3);
}
void loop() {
// Step forward 100 steps:
for (int i=0; i<4; i++) {
Serial.println("Forward");
myStepper.step(1600);
delay(250);
}
// Step backward 100 steps:
for (int i=0; i<2; i++){
Serial.println("Backward");
myStepper.step(-1600);
delay(250);
}
}
// Blink the reset LED:
void blink(int howManyTimes) {
int i;
for (i=0; i< howManyTimes; i++) {
digitalWrite(ledPin, HIGH);
delay(400);
digitalWrite(ledPin, LOW);
delay(400);
}
}
The link for the Stepper motor from Jameco: http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_1581231_-1