Go Down

Topic: Bipolar stepper motor vibrating, not turning (Read 4054 times) previous topic - next topic

Capri2794

Hello,

I have a bipolar stepper motor with following specs:

Voltage: 12V
Current: 1.5A
Wires:   4

I am providing it 12V directly from a PC power supply. But the motor is not running.

Then I have tried running it from easydriver, but it is only vibrating according to the code and not moving. Here is the code:
//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License - Please reuse change and share
//Using the easy stepper with your arduino
//use rotate and/or rotateDeg to controll stepper motor
//speed is any number from .01 -> 1 with 1 being fastest -
//Slower Speed == Stronger movement
/////////////////////////////////////////////////////////////////


#define DIR_PIN 2
#define STEP_PIN 3

void setup() {
 pinMode(DIR_PIN, OUTPUT);
 pinMode(STEP_PIN, OUTPUT);
}

void loop(){

 //rotate a specific number of degrees
 rotateDeg(360, 1);
 delay(1000);

 rotateDeg(-360, .1); //reverse
 delay(1000);


 //rotate a specific number of microsteps (8 microsteps per step)
 //a 200 step stepper would take 1600 micro steps for one full revolution
 rotate(1600, .5);
 delay(1000);

 rotate(-1600, .25); //reverse
 delay(1000);
}



void rotate(int steps, float speed){
 //rotate a specific number of microsteps (8 microsteps per step) - (negitive for reverse movement)
 //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
 int dir = (steps > 0)? HIGH:LOW;
 steps = abs(steps);

 digitalWrite(DIR_PIN,dir);

 float usDelay = (1/speed) * 70;

 for(int i=0; i < steps; i++){
 digitalWrite(STEP_PIN, HIGH);
 delayMicroseconds(usDelay);

 digitalWrite(STEP_PIN, LOW);
 delayMicroseconds(usDelay);
 }
}

void rotateDeg(float deg, float speed){
 //rotate a specific number of degrees (negitive for reverse movement)
 //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
 int dir = (deg > 0)? HIGH:LOW;
 digitalWrite(DIR_PIN,dir);

 int steps = abs(deg)*(1/0.225);
 float usDelay = (1/speed) * 70;

 for(int i=0; i < steps; i++){
 digitalWrite(STEP_PIN, HIGH);
 delayMicroseconds(usDelay);

 digitalWrite(STEP_PIN, LOW);
 delayMicroseconds(usDelay);
 }
}
[/pre]

Regards


ChrisTenone

That usually means that the wires are not connected from the driver to the motor in the right order.
What, I need to say something else too?

Capri2794

I have detected the coils by lighting an LED, so am connecting them in order.

I have used this tutorial to drive the motor directly from the supply, but in vain.



Robin2

These links may be useful
Stepper Motor Basics
Simple Stepper Code

And please post code properly - use the code button </>
Code: [Select]
so your code looks like this
 and is easy to copy to a text editor. See How to use the Forum

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

Robin2

I have detected the coils by lighting an LED, so am connecting them in order.

I have used this tutorial to drive the motor directly from the supply, but in vain.

youtube

Just corrected your link

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

Robin2

I don't have the patience to watch 4 minutes of video. I can't imagine what value there is in trying to run a stepper motor without a driver.

An Easydriver can only provide 750mA. You need a BigEasydriver or a Pololu A4988 or (slightly better than them) the POlolu DRV8825 for your 1.5amp motor.

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

Capri2794


ChrisTenone

Are you sure your motor does 200 steps per rev? You might be pulsing too fast. It's not clear from the code that you are actually 8x micro-stepping. Show a schematic and reference the motor, and driver please.

The LED test tells you which wires are on which coils. At the end of the video the dude says there are 4 ways to hook up the wires. Did you try them all?

I have detected the coils by lighting an LED, so am connecting them in order.

I have used this tutorial to drive the motor directly from the supply, but in vain.



What, I need to say something else too?

ChrisTenone

ps, the 'direct-to-transformer' method only works with AC, or at best half-wave rectified current(with an appropriate voltage divider.) Is your 12V power supply DC?





Well, that, and it turns an expensive stepper motor into an expensive AC motor. Probably ideal for a geared clock, but wastes the control that a normal stepper affords. If that's what you are after, why not use a synchronous motor.
What, I need to say something else too?

Go Up