28BYJ-48 stepper motor works

Status
Not open for further replies.

linuxgeek

Well-known member
In case anyone is interested, this inexpensive stepper motor ($2-$8/each) works with the t3. No reason it shouldn't, but just thought I'd mention it.

Here's my video of it working:
http://www.youtube.com/watch?feature=player_detailpage&v=mUiNXJ3U0so

I don't really know much about how to operate it yet. It's not clear to me how many steps there are, and how the gearing alters the equation.
I don't know how many steps I should pass the Stepper class, and I'm not sure if the speed is working correctly for me, and what the meaning of full-step and half-step is and how that affects things.

Working mostly from here
http://arduino-info.wikispaces.com/SmallSteppers
And here's a datasheet
https://bitbucket.org/fdion/pi-a-sketch/downloads/Stepper-Motor-28BJY-48-Datasheet.pdf

I altered the arduino stepper motor a bit. Code below:

Code:
/* 
 Stepper Motor Control - one revolution
 
 This program drives a unipolar or bipolar stepper motor. 
 The motor is attached to digital pins 8 - 11 of the Arduino.
 
 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.  
 
  
 Created 11 Mar. 2007
 Modified 30 Nov. 2009
 by Tom Igoe
 
 */

#include <Stepper.h>

const int stepsPerRevolution = 64;  // change this to fit the number of steps per revolution
//const int stepsPerRevolution = 500;  // change this to fit the number of steps per revolution
                                     // for your motor
//const int stepsPerRevolution = 4096;

// initialize the stepper library on pins 8 through 11:
//Stepper myStepper(stepsPerRevolution, 8,9,10,11);            
Stepper myStepper(stepsPerRevolution, 8,10,9,11);            

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(400);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
   Serial.println("clockwise");
  myStepper.step(stepsPerRevolution*32);
  delay(2000);
  
   // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution*32);
  delay(2000); 
}
 
Status
Not open for further replies.
Back
Top