Stepper motor problem

Discussion in 'Programmer's Corner' started by deepak_c, Jan 4, 2007.

  1. deepak_c

    Thread Starter New Member

    Jun 19, 2006
    6
    0
    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......:)
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Please post a schematic of the circuit? The stepper motor section would be most helpful.

    hgmjr
     
  3. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    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
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    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.
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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.
     
  7. deepak_c

    Thread Starter New Member

    Jun 19, 2006
    6
    0
    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...
    Code ( (Unknown Language)):
    1.  
    2. #include <stdio.h>
    3. #include <conio.h>
    4. #include <avr/io.h>
    5. void Delay(int n) { // dilute to taste
    6.     int j,i;
    7.     for (j = 1; j <= n; j++) {// do nothing
    8.     for (i = 1; i <= n; i++);
    9.     }// do nothing
    10. }
    11. void main(void) {
    12. outb(DDRB, 0xFF);
    13. PORTB = (1<<0);
    14. while(1)
    15. {
    16. sbi(PORTB, 2); Delay(100);//generating clock pulse at pin2 of muc
    17. cbi(PORTB, 2); Delay(100);
    18. }
    19. }
    20.  
    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....:)
     
  8. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  9. deepak_c

    Thread Starter New Member

    Jun 19, 2006
    6
    0
    Thanks for reply.....
    i have already tried half step form also.....it is also giving the same response....:(
     
  10. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  11. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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.
     
  12. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  13. rajus

    New Member

    Jul 21, 2007
    1
    0
    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
     
Loading...