the arduino 0018 example at files/examples/stepper/MotorKnob does strange things with the same configuration (i changed the pins according to my wiring). the motor turns in one direction without me touching the pot at all -- than it changes direction after a while but never on the same position.
If the stepper works with Tom's example, but not with the MotorKnob example, then the problem would seem to be with the one piece of hardware that is different between the two setups.
I don't think it has anything to do with a naughty stepper motor or stepper motor driver.
PaulS has summed it up. Can you change the software so that the same wiring is used for both programs?
I drive a stepper with an L293D.
I don't bother with the complication of the "Biolar stepper two-wire circuit:" schematic.
I don't use transistors to invert the signals, I just use two extra control pins from the Arduino. I drive all the signals 'by hand'. That way I know precisely what is happening.
I have had a stepper jump around when the battery was getting low.
ted stockwell, unless it is a very low power stepper, it is best to avoid driving a motor directly from Arduino pins.
There are several issues:
all the steppers I have used take much more current than an Arduino can safely supply, so the Arduino could be damaged
When the voltage is changed (i.e. on to off), the motor acts as a generator and inductor, and so delivers an opposing voltage 'spike' to the pin, which pull the Arduino pin beyond ground or 5V, which could damage the Arduino
Also roderic schuchart says that an L293D is being used, and gives links to the circuits.
An L293D is a reasonable cost, relatively robust way to drive motors. So roderic schuchart isn't driving the motor directly from the Arduino.
Sorry, I wasn't clear... I used a L293D and connected the 5V from the Arduino to the Vcc2 pin on the L293D.
The motor would change direction at random times and would not make complete revolutions.
I was using a small motor that I bought cheap at AllElectronics but had no datasheet. After googling I discovered that the motor was only rated for 3V. When I switched to the Arduino 3V feed the motor worked fine.
Wow, I did not notice that.
I have no idea why it works.
OTOH, I have no idea why it didn't work in the first place since I thought it was OK to use a slightly higher voltage when driving a stepper motor.