Stepper Motor Help. With Diagrams!

So i am useing a Sanguino to try and make a stepper motor work to drive a small vehicle. Unfortunetly i can not get it to work at all.
I am useing this motor:
Below is a diagram of the circuitry i am useing. I applogize for my poor diagram skills, obviously the power is not crossing the data lines.

The Power Supply is supplying the 2.8 v the motor needs

This is the code i am useing to drive the motor

#include <Stepper.h>

#define STEPS 200

Stepper stepper(STEPS, 1, 2, 3, 4);

void setup()

void loop()
  int val = 25;

I would really appreciate any help you can give me! Thanks in Advance!

Doesn't seem like you need much help? Is there anything in particular?

A few things:

Are you powering the Sanguino via a different power supply?

Was there any particular reason you have used a variable val; as in the example, it is static? Probably for expansion...

What's the project?


well particularly it doesnt work, thats the problem lol
I am makeing this for a contest, it is a small car, I am useing a custom power regulator to regulate the votage between the sanguino and the motor. I am only allowed 4 D Batteries, so this steps the 6vDC up to 12vDC and regulates it so each device gets what it needs
I am going to program more into it later so it will go a certain distance, so i have it as a variable now in anticipation for that later.

does the motor do anything at all, like “wiggle” or rock back and forth a little ?

If so, then your wiring sequence from the 2004 to the stepper might be wrong.

Also you need to connect Sanguinos ground to the 2004 ground.

You might have blown up your ULN2004: the stepper motor wants 2.4 Amps, which is wa-a-a-y over the ULN2004's limits. Try replacing it with some TIP120 Darlingtons, or some power MOSFETs (you'll need someone else's recommendation, since I'm mostly an old-fashioned, bipolar kinda guy :))


The motor doesn move a little, its a little vibration. How do i know which order i have to wire them in? Is it just a guess and check?

I didnt know that the ground on the sanguino needed to be attached the same one the 2004 is useing.

Uh oh, i thought the 2004 could handle that kind of current, say a data sheet somewhere that i must have read wrong :\ but the 2004 doesnt appear blown, current still flows through it fine.

But the ULN2004 chip will fail quite soon! You need a more powerful chip to make a motor that big work properly.

Ok thanks! Can you please recommend a good product for me to buy, I need to order them ASAP so I can get the part here in time? Thanks in advance!

The L298 is a dual H-bridge that's rated at 4 Amps:

But you'd need two of them to make a four-bit stepper motor driver. You may find other chips by searching for 'motor drive' or something similar. The main thing is to find a chip or power transistor with at least 3 Amp current rating (better to have maybe 5A, for a safety margin).

ok thanks, i got 2 TIP120 Darlingtons and 1 TIP42 transistors at radio shack this morning, unfortunetly they didnt have 4 of anything so i had to see what i could get that was similar from their selection. It is working alot better now, it seems to sputter a little bit so i think one of the wires may be a bit off, i will test that and post what i find.
Thanks for your help!

Glad to hear that it's working better with bigger driver transistors. I just popped in to the robot lab here (at the University of the West of England) and they were using stepper motor driver chips made by Allegro, part number SLA7024M. There are also two others in the range: SLA7026M and SLA7029M. They go from 1.5A to 3A rating and are all designed for driving unipolar stepper motors. Minimum motor power supply is 10V, though.