FIRST PROJECT: Duino +dual stepper shield+optical encoder+xbee bluetooth later?

Hello, Im new the world of arduinos- I have a few parts in my possession that id like to assemble into a working unit. For the end product I'm looking to use an optical encoder with a resolution of 500 degrees per rotation to accurately control a NEMA 11 bipolar stepper motor in both directions in a "one to one" fashion.

For example: Here is an example of a arduino uno pot controlled stepper that operated exactly the way id like mine to work: http://www.youtube.com/watch?v=-VWhPt-ws9g

My parts: 1. arduino uno(s) 2. Nema 11 motor (as pictured below) 3. dual stepper motor shield (as pictured below) 4. optical encoder with 4 pins (as pictured below)

diagram for shield:

I have a few questions that I hope someone can graciously bestow knowledge on to this NOOB. ...

A. I do not understand the motor wiring and how it connects to the drive socket (XO1A- YO2b) portion of the shield. Can Somebody please explain this.

B. Can someone explain to me the pins in which digitally control the X and Y drive sockets natively on this board, how do I know which pins to insert my encoder into and how it will translate into controlling a functional stepper motor.

C. is the Arduino alone powerful enough to run the Stepper, or will I need an external power supply?

A+B+C= code, code, code

If I understand the principles of this setup, I think I could gain a better understanding of how to manipulate the code...

future thoughts: i hope to be able to use XBEE's with my arduinos to control this device wirelessly... but first things first.

I hope to become a resource to this forum in the near future...

-Joel

I just received my xbee bluetooth modules today:

For the end product I’m looking to use an optical encoder with a resolution of 500 degrees per rotation

Strange world you live in. 500 steps I could understand. 500 degrees is either very, very hot or almost one and a half revolutions in my world.

So, what is the problem?

Well, I'm about to cook this arduino rig at 350 degrees for 0.000744048 fortnights if I don't find the proper code to operate this beast, and find the proper way to connect the wires on this motor to the motor shield. ;)

LOL!!! Correction on my original post. ... . *steps not degrees..

MOOAhahhahhahha!

thanks for the creative prodding anyway Pauls.

So, can you make the stepper move? Can you read the encoder?

Generally, links are better than pictures. The picture of the motor says nothing about how it is wired. The link might.

Being a 4 wire motor, though, two wires drive each coil. The resistance between two wires should be relative small. Between those two wires and the other two, the resistance should be infinite. Once you know which two wires are connected to each coil, the only issue is which direction to connect them, and there is no risk of damage to the motor if you get it wrong. The motor simply will not step correctly.

I just stuck my multimeter on the leads and found that the black + green wires are giving me a reading and the blue + red wires are giving me a reading... so... now to get this thing to run a bit, i'm not sure where the X or Y drive sockets will show up in my code in relationship to the pins and / or jumpers on the drive shield. .... help.

Im going to try this instruction set: http://robotics.org.za/index.php?route=product/product&product_id=170

ill let you know pauls, thanks for your interest again!!! (Im feeling quite alone and underprepared in this project...blarggggh)

HOLY SHNIKES! it works! now to the “500 degree” optical encoder: I’m using this code for the y channel:

// ******************************************************
// Micro Robotics
// Test Procedure to test Y channel
// www.robotics.org.za
// written by : Frikkie du Toit
// For Stepper Shield ver 1.0
//
// To test Y Channel To test X Channel
// STEP_PIN 6 STEP_PIN 2
// DIR_PIN 7 DIR_PIN 3
// YMS1 8 YMS1 4
// YMS2 9 YMS2 5
// ******************************************************

#define STEP_PIN 6
#define DIR_PIN 7
#define YMS1 8
#define YMS2 9

void step_mode(byte yms1, byte yms2)
{
// Set the pins to select the step mode

digitalWrite(YMS1, yms1); // Set pin YMS1 to the parameter given
digitalWrite(YMS2, yms2); // Set pin YMS2 to the parameter given
}

void step(int steps, float speed)
{
// Take the amount of steps specified
// Negative value for opposite direction

byte dir;
float micro_sec_delay;

if (steps > 0) // If steps are positive
{
dir = HIGH; // Set direction
}
else // If steps are negative
{
dir = LOW; // Set direction
}

steps = abs(steps); // Set steps to absolute value
digitalWrite(DIR_PIN, dir); // Set the direction pin to dir

micro_sec_delay = 1 / (speed / 100) * 70; // Calculate delay between step pin toggles

for (int i = 0; i < steps; i++)
{
// Takes all the steps in the specified direction

digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(micro_sec_delay);

digitalWrite(STEP_PIN, LOW);
delayMicroseconds(micro_sec_delay);
}
}

void setup()
{
// Set all the pin modes

pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(YMS1, OUTPUT);
pinMode(YMS2, OUTPUT);
}

void loop()
{
step_mode(HIGH, HIGH); // Set step mode to Eighth Step mode

step(1600, 25); // Take 1600 steps (1 revolution) with speed set to 25
delay(1000); // Delay one second

step_mode(LOW, HIGH); // Set step mode to Quarter Step mode

step(800, 25); // Take 800 steps (1 revolution) with speed set to 25
delay(1000); // Delay one second

step_mode(HIGH, LOW); // Set step mode to Half Step mode

step(400, 25); // Take 400 steps (1 revolution) with speed set to 25
delay(1000); // Delay one second
}

NOW i just need to know she input pins to use to add the optical controller and what code to modify… i believe it would be somewhere in the yellow… dunno…

currently reading this: http://forum.bildr.org/viewtopic.php?t=737

I H]hope to get these two pieces (rotary encoder and stepper) working together soon....

Hey evilbiochemist...

I'm new at this too and seem to be having challenges that you have overcome. Could you post a picture of your motor shield with the stepper motor connected to it? When I bought the shield I was expecting it to come assembled so when it wasn't it really tested my ability to figure it out with very poor schematics. Frankly, I'm not sure I got it right.

Thanks.