I have three small (tiny really) stepper motors in my “junk box”. I eventually want to build some cool CNC machines. RepRap, CNC router, CNC mill, CNC lathe. Okay, but to get there i need to learn more about this technology. Best way for me to learn is by doing through experimentation. I have to start small, so i will be attempting to build a repstrap “starter” machine. Today i used a sparkfun easy driver to drive a stepper. It was awesome. It was similar to the first tutorial, and the 2nd video mixed together.
—
http://vimeo.com/3978871
here is the arduino sketch so far. (version 1)
////////////////////////////////////////////////////////
// Stepper Motor skecth for use with the EasyDriver 4.2
////////////////////////////////////////////////////////
// Original by Dan Thompson 2008
//
// Musical test version 1 by Andrew Barney
//
// Use this code at your own risk.
// For all the product details visit http://greta.dhs.org/EasyDriver/
// For the full tutorial visit http://danthompsonsblog.blogspot.com/
//
int dirpin = 3;
int steppin = 12;
void setup() {
Serial.begin(9600);
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
}
void loop()
{
int i;
Serial.println(“>>”);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps.
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(200); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(300); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(400); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(500); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(600); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(700); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
Serial.println(“<<“);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
digitalWrite(steppin, HIGH); // “Rising Edge” so the easydriver knows to when to step.
delayMicroseconds(800); // This delay time is close to top speed for this
} // particular motor. Any faster the motor stalls.
delay(1000);
}