Go Down

Topic: My stepper motor won't run... (Read 96 times) previous topic - next topic

Rien2002

I am making a little slider, but I can't get my stepper motor to work. In the pictures you can see how i connected everything. Pull to pin 5, Dir to pin 2 and ENBL to pin 8. I am using an arduino uno. As the stepper motor driver I used an makeblock 2h microstep driver. User guide: http://blog.makeblock.com/wp-content/uploads/2012/11/Makeblock-2H-Microstep-Driver-User-Guide.pdf. I used an 12 volt 2 amp power supply that I had. Its from an RGB strip. The code I am using is the following.

// defines pins numbers
const int stepPin = 5;
const int dirPin = 2;
const int enPin = 8;
void setup() {
 
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);

  pinMode(enPin,OUTPUT);
  digitalWrite(enPin,LOW);
 
}
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 < 800; 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 < 800; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000);
 
}

I hope someone can find a solution so my slider works. I am making this project for my grandfather and I am only 16 years old so I don't know much about the stepper motors.

https://ibb.co/QHKhjBg
https://ibb.co/sp7mk5g
https://ibb.co/7y6BLdh
https://ibb.co/rdVHWZg
https://ibb.co/1LjzK33
https://ibb.co/ZHQcwDS

Those are the pictures

Robin2

Try making the motor go much slower to start with. Change the second delayMicroseconds(500) to delay(500) in each pair.

These links may help
Stepper Motor Basics
Simple Stepper Code


Also please display your image(s) in your post so we can see it(them) without downloading it(them). See this  Simple Image Guide

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Rien2002

I don't think i can do it in the topic itself but here i can








Go Up