Arduino control of 2 stepper motors using ULN 2004 ICs ?

Hello all.

My first time here : ) I've been fiddling with Arduino for a few weeks now, as a non-electronics expert and non-programmer I'd first like to say how amazed and grateful I am at all the online resources (this forum included) that are freely available for helping and supporting Arduino users with their projects. I've already managed to get much further with the electronics and coding stages of my project than I really thought was possible and that's thanks to this supportive community.

Now on to my first question here...

I have successfully got the Arduino to control one of my 6 wire 12 volt Unipolar stepper motors. I'm not using any purchased motor shields, just the simplest breadboard circuit I could find using an ULN 2004 IC (no other components) . The IC is controlled from 4 Arduino digital outputs.
I'm currently using the standard Stepper library that ships with Arduino.

I've got the circuit from Tom Igoe's page, and am running the basic Stepper examples (from Arduino's menus) to test everything...
http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors/
This all works fine : )

I would now like to control two identical stepper motors, having independent control over each.
So I added another ULN2004 IC to my breadboard, connected up another 4 Arduino outputs and modified the basic code to set up a second Stepper object with another name.
I had imagined I could just add a second motor this way, but somehow the code for the second motor breaks the system so that neither motor works.
If I comment out the new bits of code, I get control of the first motor again, but never two at once.

I'll post my code example later here to follow this up (when I'm home again), but just wondering first if this is the correct approach or is there a better way to implement control over 2 steppers than this...

Many thanks
Chris

The stepper library that comes with the IDE only supports one motor. Look for the AccelStepper library. It supports multiple steppers.

Hi Groundfungus.

Thanks for your speedy reply.
I didn't realise that the standard stepper library would only work for a single motor, so I know now not to pursue that, thanks.

I had found the notes for the AccelStepper library here,
http://www.airspayce.com/mikem/arduino/AccelStepper/

This seems to offer support for multiple stepper motors, but then, in the first sentence it says...
"This is the Arduino AccelStepper library. It provides an object-oriented interface for 2, 3 or 4 pin stepper motors."

So I don't think it will work for my 6 wire Unipolar motors...
: (

I have used AccelStepper for both uni and bi polar motors. The reference to 2,3 or 4 pins is about the number of pins from the controller chip. What driver are you using now? A Schematic would help. I use the ULN2003 driver chip with AccelStepper.

edit: here are some circuits for unipolar uln 2003-4 driver circuits.

I have used the 2 wire driver with good results.

Ah,

My mistake about the 'pin numbers', so there's nothing to stop me try the AccelStepper library after all.
There's plenty more for me to try there.

BTW
Here's the schematic I'm following for the single motor set up... (It's the second diagram down this page.)

To place 2 motors, I'm just repeating this with a second ULN 2004 IC.
(I've since found out about ULN 8004 ICs which would apparently give all 8 channels in one IC package...)

Many thanks again

Your link was the same as mine so we are really on the same page. :slight_smile:

Just spotted that too : )
Chris