Stepper motor problem

Thread Starter

deepak_c

Joined Jun 19, 2006
6
hello friends..
i am trying to control a unipolar stepper motor using ucn5804B driver chip and giving input for driver from an atmega32 microcontroller chip...
but it' s giving a problem....rather than normal rotation of motor i am getting a vibration in motor shaft ...it seems it is changing it's direction of motion very fast ..so not able to move in any direction.....
i have checked all connections and remade whole circuit many times ..
i tried with another piece of motor and driver chip too..but it is giving same response.....i am not able to understand anything ...:(
please help me if somebody knows what is the problem.....

thanks alot in advance......:)
 

Dave

Joined Nov 17, 2003
6,969
hello friends..
i am trying to control a unipolar stepper motor using ucn5804B driver chip and giving input for driver from an atmega32 microcontroller chip...
but it' s giving a problem....rather than normal rotation of motor i am getting a vibration in motor shaft ...it seems it is changing it's direction of motion very fast ..so not able to move in any direction.....
i have checked all connections and remade whole circuit many times ..
i tried with another piece of motor and driver chip too..but it is giving same response.....i am not able to understand anything ...:(
please help me if somebody knows what is the problem.....

thanks alot in advance......:)
Since you have posted this in the Programmer's Corner I assume you have written the code for controlling the stepper motor. You may be advised to post up your code for us to look at. Before we dig around the hardware it is best to make sure the stepper motor is doing what you intended.

Dave
 

hgmjr

Joined Jan 28, 2005
9,027
That's a good point Dave.

It does sounds like a drive control sequencing/phasing problem which is most likely being managed by the software. That would explain why the problem persists even when the hardware is changed out.

hgmjr
 

beenthere

Joined Apr 20, 2004
15,819
Hi,

A stepper virbrating like that usually has either too great a load on the shaft to rotate, or else the applied stepping frequency is too high. There is also a resonance point where motor torque drops by a large percentage. If there's no load on the shaft, change your timing loop to decrease the stepping rate.
 

Papabravo

Joined Feb 24, 2006
21,159
For each motor/load combination there are generally two resonances. One is the result of a mechanical time constant and the other is the result of an electrical time constant.

The low frequency mechanical time constant should be in the 200 Hz. range. The high frequency electrical time constant is typically in the 3-5 kHz. range. To get around the mechanical resonance you must either operate at a low constant speed, OR you must ramp the velocity up and down using a trapezoidal velocity profile. When you reach a stepping rate near the electrical time constant the motor will loose torque and vibrate. It's the nature of the beast.
 

Thread Starter

deepak_c

Joined Jun 19, 2006
6
Thanks alot for replying friends....
i am just trying to test that my motor , driver and muc are working fine together..so i am just working on a simple test code...
i am posting my code here...
Rich (BB code):
#include <stdio.h>
#include <conio.h>
#include <avr/io.h>
void Delay(int n) { // dilute to taste
    int j,i;
    for (j = 1; j <= n; j++) {// do nothing
    for (i = 1; i <= n; i++); 
    }// do nothing
}
void main(void) {
outb(DDRB, 0xFF);
PORTB = (1<<0);
while(1)
{
sbi(PORTB, 2); Delay(100);//generating clock pulse at pin2 of muc
cbi(PORTB, 2); Delay(100);
}
}
you can see my circuit at
http://img300.imageshack.us/my.php?image=mycktyj3.jpg

this delay generates 1200 Hz frequency clock pulse......
and i don't have any load on shaft.....and since frequency=1200 MHz ..so i think resonance is also not occurring....
please help....
Thanks alot again....:)
 

hgmjr

Joined Jan 28, 2005
9,027
Try changing the line in your code from

PORTB = (1<<0);

to

PORTB = 0x02; // This sets pin 9 and 10 to select half step....


hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
A couple of things may be helpful.

Can you provide the manufacturer's part number for the stepper motor or a link to the datasheet?

I wonder if it is possible that your 12 volt power source is insufficient to supply the current needed to power the stepper motor. What is the current rating of your 12 volt power supply?

hgmjr
 

Papabravo

Joined Feb 24, 2006
21,159
1200 Hz. is way to fast to start a motor from a dead stop. Just compute the angular acceleration required. A 1.8 degree stepper has 200 steps per revolution and you want to start at six revolutions per second. Are you on drugs?

You need to try something on the order of 10Hz and then ramp the velovity up to 1200 Hz. and then back down. You gotta learn to crawl before you walk and run marathons. You have to start below the mechanical resonance and transition quickly through that region.

For example: If the mechanical resonance is at 200 Hz. Then a velocity profile that looks like:
50 Hz., 150 Hz., 250 Hz. will allow you to transistion through the resonance without stalling.
You might also be able to do:
100 Hz., 300 Hz
or
150 Hz. 300 Hz.
Constant acceleration is equivalent to a linear velocity profile.
 

hgmjr

Joined Jan 28, 2005
9,027
Rich (BB code):
#include <stdio.h>
#include <conio.h>
#include <avr/io.h
 
void Delay(int n) { // dilute to taste
    int j,i;
    for (j = 1; j <= n; j++) {// do nothing
    for (i = 1; i <= n; i++); 
    }// do nothing
}
 
void RampStart(void);
{
 int i;
 
for (i=32000; i < 1000; (i -= 100)
   { 
   sbi(PORTB, 2); Delay(i); //clock pulse at pin2 of muc
   cbi(PORTB, 2); Delay(i);
   }
}
 
void main(void) {
outb(DDRB, 0xFF);
PORTB = (1<<0);
 
RampStart();
 
while(1)
{
sbi(PORTB, 2); Delay(1000);//generating clock pulse at pin2 of muc
cbi(PORTB, 2); Delay(1000);
}
}
Here is a suggested scheme for ramping up the pulse drive to your stepper motor per the suggestion from papbravo. The values chosen are simply placeholders so you will need to tailor them to your specific needs.

hgmjr
 

rajus

Joined Jul 21, 2007
1
Hai I want to control stepper motor through parallel port using matlab-simulink.i learned how to write simple s-functions but i failed to write s-function to control stepper motor.please send me code .THANKS IN ADVANCE
 
Top