3-Axis Arduino

17 Jan, 2009 by adam in Blog

obsession

A special thanks to all those who supported my new obsession materially and/or emotionally over the last few weeks. I’ve now officially gotten three stepper motors to run independently from a single Arduino board, using Brian Schmalz’s fantastic “Easy Driver” stepper motor controller (Brian was even kind enough to help me out via email), built on the basis of this handy tutorial from Daniel Thompson.

“But wait,” you say, “there are only TWO motors connected to that rig, bro.” How astute! You are correct: in the process of learning to use the Easy Driver, I managed to blow one up. Yes, in a moment of simultaneous glee and heartbreak, my first Easy Driver literally went up in smoke. I can’t say if it was something I did, or if it was a manufacturing defect, but the potentiometer on my first Easy Driver was inoperative. I attempted to “fix” it by prying the pot off the board and soldering my own pot in its place. This worked briefly, but went “pop” after running for about 30 seconds, no doubt due to a shoddy soldering job on my part.

Ah, but I’m learning! My next task is to get my Arduino board to decypher G-Code, probably by using the RepRap package. Once I get that working, it’ll be a relatively simple task to get some kind of 3-axis router assembled. Or do I want to rig it up to my lathe? The possibilities make my nerdy knees weak!

For those interested, here are the technical details:

Power Supply: 24V 5A

Here’s the Arduino code I’m using for the test application. The three motors turn in unison, except for the “Z” motor, which turns at 1/3 speed, just for kicks.

////////////////////////////////////////////////////////
// Stepper Motor skecth for use with the EasyDriver 3.1
////////////////////////////////////////////////////////

// Dan Thompson 2008, modified by Adam O’Hern in 2009
//
// Inpired by the code and chat on this thread.
// http://forum.sparkfun.com/viewtopic.php?t=10378&highlight=easydriver
//
// 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 dirpinX = 3;
int steppinX = 12;

int dirpinY = 5;
int steppinY = 11;

int dirpinZ = 6;
int steppinZ = 10;

void setup() {
Serial.begin(9600);

pinMode(dirpinX, OUTPUT);
pinMode(steppinX, OUTPUT);

pinMode(dirpinY, OUTPUT);
pinMode(steppinY, OUTPUT);

pinMode(dirpinZ, OUTPUT);
pinMode(steppinZ, OUTPUT);

}
void loop()
{

int i;

digitalWrite(dirpinX, LOW);
digitalWrite(dirpinY, LOW);
digitalWrite(dirpinZ, LOW);
delay(50);
Serial.println(“>>”);

for (i = 0; i<4000; i++)
{
digitalWrite(steppinX, HIGH);
digitalWrite(steppinY, HIGH);
if ( (i % 3) == 0) { digitalWrite(steppinZ, HIGH); }

delayMicroseconds(100);
digitalWrite(steppinX, LOW);
digitalWrite(steppinY, LOW);
if ( (i % 3) == 0) { digitalWrite(steppinZ, LOW); }

delayMicroseconds(100);
}

// change direction
digitalWrite(dirpinX, HIGH);
digitalWrite(dirpinY, HIGH);
digitalWrite(dirpinZ, HIGH);
delay(100);

Serial.println(“<<”);
for (i = 0; i<4000; i++)
{
digitalWrite(steppinX, HIGH);
digitalWrite(steppinY, HIGH);
if ( (i % 3) == 0) { digitalWrite(steppinZ, HIGH); }

delayMicroseconds(100);
digitalWrite(steppinX, LOW);
digitalWrite(steppinY, LOW);
if ( (i % 3) == 0) { digitalWrite(steppinZ, LOW); }
delayMicroseconds(100);
}

delay(100);
}

about adam:
Adam O'Hern is an industrial design consultant specializing in visual brand languages, and has designed products ranging from laptops to power tools, classroom toys to bathroom fixtures, and robots to lint rollers. He has published with 3DWorld Magazine, CGTuts+, and Luxology, and works with Josh Mings of SolidSmack.com on EngineerVsDesigner.com.

3 Responses

  1. adam says:

    Hi Dan:

    I need help! Do you have any idea about this?

    Adam

  2. Dan Thompson says:

    Hey Adam,

    Great stuff! I look forward to seeing how you go with the repRap G-Code thing!

    Dan.

  3. MunionMan says:

    Beautiful. Nerddom has never had a cooler member. I only wish I were there to put my nubs on this thing!

Leave a Reply

You must be logged in to post a comment.