Connect with us

stepper motor is missing the steps

Discussion in 'Sensors and Actuators' started by maham ahmed, Jul 7, 2014.

Scroll to continue with content
  1. maham ahmed

    maham ahmed

    10
    0
    Jul 7, 2014
    i am striving to drive my 5 wire unipolar stepper motor through microcontroller...i am using driving ic l293dd. my motor model is Em 284 ,178936 ,stp.42D221-01. i have searched alot about this motor on the internet but i couldn't find any specification. now i am giving a pwm signal generated by pic 16f877a to both of the enable pins of l293dd ic and both enable pins are short.
    Frequency of the pwm signal is 1.22khz and duty cycle is almost 36 %.
    At this motor is taking steps but it is missing the steps and is not running smoothly and is causing vibrations.
    is there any probllem with the pwm signal's freuency or duty cycle ? can i give pwm signal like this?or should i give 5 v constant to both the enable pins.
    why motor is missing the steps?? Also my l293dd heats up during working.
    plz help me out ......
     
  2. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Perhaps I'm missing something...
    How are you operating the Input pins on that chip?
    Can you also please confirm how you have wired the inputs of your stepper motor?
    (Are you using the 5th common wire, or attempting to use the motor as a bipolar 4-wire?)
     
  3. BobK

    BobK

    7,680
    1,685
    Jan 5, 2010
    I don't understand. Why are you using PWM with a stepper motor? What is the PWM supposed to control?

    Bob
     
  4. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Stepper motors can benefit from PWM for finer control of motion. (Usually micro-stepping)
    They also greatly benefit from PWM for 'holding' the current position as it helps to keep heat down.
    Take a look at http://en.wikipedia.org/wiki/Stepper_motor#Phase_current_waveforms for some examples ;)

    The PWM does not phase me... but I would really like to know what he is feeding the l293dd for inputs... or the Stepper motor as inputs. (As well as the stepping frequency please)

    Edit: Correction to PWM Micro-stepping... Additional filters are usually required to smooth out operation or you end up with some ugly noise/vibration.
     
  5. maham ahmed

    maham ahmed

    10
    0
    Jul 7, 2014
    the stepping freq as I mentioned above is 1.22khz...which is the freq of pwm signal.
    nd yes we are using the common wire of Motr nd connected it to the supply voltage that is 12v.

    we used half stepping mode in programming and gave the 4 pins of port b to the input of l293dd.
     
  6. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    So to clarify, your stepper motor common is connected to 12V, and the l293dd is the current sink. (providing path to ground)

    You are using half steps, at a freq of 1.22khz, but you are pulsing both of the enable pins at 1.22khz with a PWM with a 36% duty cycle.

    The problem may be the fact that your 'disabling' the driver every time you change an output. Half step operation requires one of the outputs to hold, while another transitions. (Using PWM to reduce the effective output requires a PWM frequency much higher than the stepping frequency)

    You should not use PWM on your enable inputs for this application.
    Please also confirm that you are using an Active Low output on your pic (As you have tied common to 12V)
     
  7. maham ahmed

    maham ahmed

    10
    0
    Jul 7, 2014
    so it means I should give 5 v to both the enable pins of the driver.right ?

    and for making half step sequence in my case I will have to use active low logic.right ?

    Nd can u plz tell me what's the difference between stepping freq and pwm freq ?
     
  8. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    For sake of explanation:
    PWM is typically used as a digital equivalent to providing an analogue equivalent output to motors and lights. (There are lots of other uses)
    When running a motor with PWM, you can control it's speed by changing the PWM's duty cycle. 30% duty cycle is 30% of it's speed. (rough example)
    Usually high PWM frequencies are used as it is less noticeable then slower frequencies.

    For application with stepper motors, when you want to the motor to 'hold' position, the energy dissipated by the motor increases because the motor is no longer in motion and power is still being applied (otherwise there would be no holding torque). You can help keep the heat down when you want your motor to hold by using PWM. The smaller the duty cycle, the less heat is generated, but the less torque you will have.


    Stepping frequency now is how fast you are feeding steps to your stepper motor. The faster your stepping frequency, the faster your motor will turn. (To a point)
    Please note that if you want to use PWM while the motor is running, you need to pick a frequency for your PWM that is much higher than the frequency that your providing steps to your motor.
    PWM essentially turns on/off your motor very quickly... if it turns off in the middle of a step, your motor will free-wheel until it is turned on again which can result in the chattery noisy result you are getting.
    If your PWM is high enough it happens so quickly that even if it turns off while the motor is taking a step, it will turn on again so fast that you won't notice anything.
    One more issue with using PWM while turning the motor... Stepper motors usually operate at variable stepping frequencies... if the PWM you are using to keep heat down is a multiple of the stepping frequency you end up with issues do to harmonics that you will not notice unless the motor moves at a specific speed. (This is hard to identify)
    For the sake of your project, I would limit the use of PWM to never... or only when you want the motor to stop. (Keep the outputs the same on the microcontroller, and feed PWM to the inputs.)

    Just to clarify, in your application, PWM has nothing to do with motor speed, and will only help you manage waste heat as a trade-off for torque.
    Stepping frequency has everything to do with speed of the stepper motor

    Edit:
    Found an extended data sheet... and although the section is for a 297 and not a 293 look at page 32 (or 5/12) it does have some useful information for driving stepper motors and will show the desired values for the enable pins and the 4 input/outputs. (Note that Stepper motors have a firing order much like cars do... it is important that the order is correct or it will not run well)
     
    Last edited: Jul 8, 2014
    Harald Kapp likes this.
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,361
    2,756
    Jan 21, 2010
    The other (perhaps overly simplistic) thought I have is that perhaps the motor can't step that fast.
     
  10. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    I'll be a little red in the face if this is the case... I thought to mention slowing it down... but I don't think I ever did!
    The PWM implementation that is currently in play needs to go out the door first and foremost though.
     
  11. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,267
    Nov 28, 2011
    Or just being accelerated or decelerated too quickly...
     
  12. maham ahmed

    maham ahmed

    10
    0
    Jul 7, 2014
    ok Thanku..nw my Motr is working smoothly by giving the 5v to both the enable pins.
    bt what if I want to control the speed of mtr through pwm? what should be pwm's frequency? I have tried 1.22khz bt at this freq Motr is missing the steps.

    another problem is my l293dd is getting very hot.I don't knw y.plz tell me.
     
  13. maham ahmed

    maham ahmed

    10
    0
    Jul 7, 2014
    so how can I control the speed of my Motr without using pwm ? can I control the speed by varying the delay between steps?
    if true then I don't think so there will be variety in the variation in speed of motor through the value of delay
     
  14. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,361
    2,756
    Jan 21, 2010
    PWM is not used to control the speed of stepper motors. The rate that you step it controls the speed.
     
  15. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    You will need to adjust your stepping frequency to adjust motor speed.
    The only need you should have for using PWM would be to keep heat down when the motor is stopped and holding position.
    PWM adjusts the speed on regular motors because the average voltage applied to the motor is lower, thus slowing the motor down. Stepper motors are unique in that in a simplistic sense, the motor will always move 1 step even with a variance in voltage supplied.
    http://www.geckodrive.com/g717-90-4.html is an example Stepper Motor from Gecko Drive that has a 1.8 degree step. This means that you will need to make 200 steps to make the motor do one full rotation.
    In THIS example:
    200 Hz = 1 RPM
    1.2kHz = 6 RPM

    Of course this is dependant on the type of step you are feeding it... half step of course will go slower because you are subdividing the steps. Your motor will go slower, but your steps are smaller so you have finer control.

    Would you mind posting the logic you are using to step your motor with? Are you using pre-made code, or did you explicitly specify the state of your output pins? There should only be 8 different outputs on your microcontroller to drive a 5-wire stepper.

    As far as the heat in the l293dd is concerned, the datasheet shows an on-board heatsink being used. I think it is expected to run warm, but you may need to compensate. Excess heat could also be generated if there is a fault in the steps you are feeding your motor.. (But it is running smoothly as you say, so that may not be the issue) Hopefully someone else with thermal experience can help.
     
  16. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    What else are you using with your circuit? Why ask if you can control the speed of a stepper with PWM?
    Are you using this in an R/C? As many of the outputs for these controls are PWM to control the brushless motors and servos.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-