Motor Not Working on Digital Outputs?

Hi All,

I'm using an unidentified, 4-wire stepper motor from an old DVD drive for a new project. I have soldered four wires to the terminals so it can be used with my Arduino.

When I plug one wire into 3.3V on the Arduino and the rest to ground, the motor visibly steps forwards/backwards, indicating it is working correctly.

I wrote the following code to create a pulse train along output pins 8,9,10,11 to test the motor's calibration.

void setup() {
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  digitalWrite(8, HIGH);
  delay(50);
  digitalWrite(8, LOW);
  delay(50);

  digitalWrite(9, HIGH);
  delay(50);
  digitalWrite(9, LOW);
  delay(50);

  digitalWrite(10, HIGH);
  delay(50);
  digitalWrite(10, LOW);
  delay(50);

  digitalWrite(11, HIGH);
  delay(50);
  digitalWrite(11, LOW);
  delay(50);
}

When running it, I can hear the motor clicking but not moving, like it's not getting enough power.

I checked the voltage and the current from pins 8-11 using a multi-meter and they produce more power than the 3.3V/GND combination.

I've tried running pins 8-11 constantly high and manually connecting the wires like before. No movement from the motor.

I've tried every pin combination and pulse pattern I can think of.

In short, the stepper motor will work fine from the 3.3V supply, but not the digital pins, even though they produce sufficient power.

Is there something wrong with my Arduino?

This is driving me insane and any advice would be greatly appreciated.

Digital IO pins are only good for 20-25mA, more than that and their output voltage drops, or you end up killing the pin.

Also keep in mind the motor has 2 coils, probably wired as 1-in, 2-in, 1-out, 2-out.
So you need to drive 1-in High and 1-out Low to get a current burst thru the coil, and the same for 2-in/2-out.

Get hold of a part like ULN2003 or ULN2803 to buffer the pin and provide some decent drive current. Might even need more.
Altho with 2-coils, then more likely an H-bridge chip is needed to be able to drive current in both directions.

If you measure the coils with a meter, you should be able to determine which pair of pins makes up each coil.
If you measure the resistance of a coil, then you can use Ohms Law to get an idea of how much current is needed:
V/R = I. So 5V/resistance reading = current needed.

CrossRoads:
Digital IO pins are only good for 20-25mA, more than that and their output voltage drops, or you end up killing the pin.

Thank you for the reply! So, if the resistance is low enough and the current exceeds this, the Arduino will just kill the supply to that pin?

CrossRoads:
If you measure the coils with a meter, you should be able to determine which pair of pins makes up each coil.

Good point, I hadn't considered testing for resistance on the coils.

I do have a ULN2003 module that I can try, I just figured if the current was good from one it was good from all.

If it is 4 wires it is more likely to be a STEPPER motor and not a regular DC motor.
They require a different approach to be able to use them.

We would need any details that may be printed on the motor to be sure or a good picture of it.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

CrossRoads:
Digital IO pins are only good for 20-25mA, more than that and their output voltage drops, or you end up killing the pin.

Hi CrossRoads,

On testing the wires, it would appear to be a bipolar stepper motor (probably variable reluctance due to the cheap, spot welded tooth-can body design), with a coil resistance of about 11 ohms, which meant I was putting around 450mA through the pins :o

Thank you again for reading my post thoroughly and your helpful, polite response :slight_smile:

"So, if the resistance is low enough and the current exceeds this, the Arduino will just kill the supply to that pin?"

No, the IO pin dies, and the whole chip probably soon after. There's no internal control to limit current flow. The output transistors turn on, and if there's no external current limiting then the transistors fail (to VCC, or to Gnd.)
I think what usually happens is the IO protection diodes go, shorting VCC to Gnd, the chip then feels warm, or hot, and is usually dead soon there after.

CrossRoads:
No, the IO pin dies, and the whole chip probably soon after. There's no internal control to limit current flow. The output transistors turn on, and if there's no external current limiting then the transistors fail (to VCC, or to Gnd.)
I think what usually happens is the IO protection diodes go, shorting VCC to Gnd, the chip then feels warm, or hot, and is usually dead soon there after.

Oh damn. I've just tested the pins with some LEDs and resistors and they seem okay. Hopefully I got away with this faux pas, but will monitor it.

They don't always die immediately. Just don't be too surprised if one day those pins no longer work.

You might try a purpose built stepper driver like Pololu's DRV8825, easy 2 pin control (step, direction) and adjustable current limiter to protect your motor, needs at least 8.2 volts.

And member Robin2's simple stepper program:
http://forum.arduino.cc/index.php?topic=277692.0

JCA34F:
You might try a purpose built stepper driver like Pololu's DRV8825, easy 2 pin control (step, direction) and adjustable current limiter to protect your motor, needs at least 8.2 volts.
Pololu - DRV8825 Stepper Motor Driver Carrier, High Current
And member Robin2's simple stepper program:
Simple Stepper Program - Motors, Mechanics, Power and CNC - Arduino Forum

Thanks! I went ahead and ordered an A4988 from Amazon yesterday, but will absolutely use this code.

smithro:
Oh damn. I've just tested the pins with some LEDs and resistors and they seem okay. Hopefully I got away with this faux pas, but will monitor it.

Mark the chip with a spot of paint or something to indicate its potentially damaged, so you don't end
up using it for something important.

Overstressing an input can have many outcomes short-term and long-term, particularly if inductive
load is involved as those voltage spikes cause avalanche breakdown. Even if it appears to work it
could be leaky, or drawing a lot of supply current, or with changed characteristics like switching
speed.