1

I am new to arduino, I started learning about it today and i'm stuck. I ripped out a small stepper motor from an old DVD drive. I got a polulu a4988 driver and I have wired it up as follows:

enter image description here

/*     Simple Stepper Motor Control Exaple Code
 *      
 *  by Dejan Nedelkovski, www.HowToMechatronics.com
 *  
 */
// defines pins numbers
const int stepPin = 3; 
const int dirPin = 4; 

void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(500); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(500); 
  }
  delay(1000); // One second delay

  digitalWrite(dirPin,LOW); //Changes the rotations direction
  // Makes 400 pulses for making two full cycle rotation
  for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000);
}

But nothing happens, the motor doesn't even vibrate. Any idea what could be wrong?

1
  • Check the data sheet and see if you can truly leave all of those pins on the left side unconnected. Additionaly, you need the /sleep pin high - you seem to be hoping there is a /pullup resistor on the reset line which will accomplish that for both of them? Commented Apr 26, 2016 at 20:18

1 Answer 1

3

According to Pololu's website, the VMOT pin needs at least 8V to function. Try a 12V switching (important!) wall wart supply that can supply at least 1A instead of your USB supply. Avoid supplies that can deliver currents >3A, as they are overkill for a small stepper motor and can be dangerous if shorted. Be sure to put a large (100uF is good) capacitor across that supply to prevent voltage spikes. To prevent damaging the motor from the higher voltage, follow the information Pololu provides on setting the current limit and set it to about 350mA. If you notice the motor is too hot to touch, try 200mA.

8
  • thank you! I found a psu for an external hard drive which outputs 12v and 2A. Would this be suitable?
    – user20551
    Commented Apr 27, 2016 at 8:35
  • That is almost definitely a switching supply and it should be suitable. Make sure that you pay attention to the polarity when hooking it up.
    – 3871968
    Commented Apr 27, 2016 at 14:10
  • Great, thank you. I still haven't got it to work, my arduino switches off for some reason. Not sure why though.
    – user20551
    Commented Apr 27, 2016 at 18:42
  • I recently bought one of these and it had an internal short from the STEP pin to ground. This caused my Arduino to shut off too. Check all the pins connected to the Arduino with a multimeter to see if there are any shorts to ground, VCC, or VMOT. Post a picture of your soldering and wiring too. The Arduino should not be shutting off if this is wired correctly
    – 3871968
    Commented Apr 27, 2016 at 18:45
  • Oh I see, i'll do it as soon as i get home tomorrow! thanks for your help, I really appreciate it :)
    – user20551
    Commented Apr 27, 2016 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.