1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

ULN2803 Stepper Motor Circuit Help

Discussion in 'Microcontrollers' started by godatguitar, Mar 18, 2004.

  1. godatguitar

    godatguitar New Member

    Joined:
    Feb 14, 2004
    Messages:
    8
    Likes:
    0
    Hi All

    I am using a ULN 2803 to control 2 stepper motors, and the input to the IC is directly from an I/O port on an 8051 microcontroller.
    The stepper motors are 24V, and "apparently" need 800mA each to operate. Does this sound correct? And is this safe with the ULN2803?

    Basically, as I am aware the output is inverted, so to turn a coil from a motor on I apply a logic 0 to the corresponding input pin on the 2803.

    Also, the circuits I have seen use a Zener diode on the power input to the uln2803, usually slightly higher voltage than the motors require. Apparently this protects back emf? Is this right? Basically I have a 27V, 1.3W zener diode, and i do not want to blow the IC up with too large a current or something.

    Any help would be great.
    Cheers guys
    Paul
     
  2. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH
    No, the maximum current for each output is only 500mA. You should use something bigger like a ULN2064B (1.5A 50V) or ULN2065B (1.5A 80V).

    To turn a coil ON, you still have to apply a logic "1".

    It depends on how you connect the zener diodes. The proper way to connect the 27V zener is to connect the anode to ground and the cathode to one of the coils. You would need 4 pieces of zener diodes. Another way is to connect a single zener diode to the common of the internal free wheeling diodes of the 2803. See the attached schematic. The higher the voltage the faster the current will decay when the coil is turned OFF. This will allow for higher speed stepping. The maximum voltage on the ULN2803 is 50V.
     

    Attached Files:

    • 2803.GIF
      2803.GIF
      File size:
      6.5 KB
      Views:
      16,320
  3. godatguitar

    godatguitar New Member

    Joined:
    Feb 14, 2004
    Messages:
    8
    Likes:
    0
    Hi
    Thanks for the info

    Can you not use the outputs in parallel, ie, create an output of 1A x4 instead of 500mA x 8?
    It means I would need two 2803's to control 2 motors. But I have read it can be paralleled, but just dont know how.

    If not, do you have a better suggestion for controlling 2x 24V 800mA stepper motors? Am I doing it the best way? I am only able to get hold of 2803's or below, for some reason I cant find a local stockists of the others u mention.

    Cheers
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH

    Sure you can try to connect them in parallel. I have done it without any ill effect. For example, pins 1&2 connected together and 17&18 connected together. However, I wouldn't push the output to 1A because any imbalance will stress the transistors to the breaking point.
     
  6. kinjalgp

    kinjalgp Active Member

    Joined:
    Oct 28, 2002
    Messages:
    1,851
    Likes:
    3
    Location:
    INDIA/USA
    You may also use UCN5804 stepper motor driver IC.
     
  7. hoaivan

    hoaivan New Member

    Joined:
    Mar 27, 2004
    Messages:
    4
    Likes:
    0
    help

    i have 2 stepping motors (m42sp-5, working at 12V, 259mA) connected to ULN 2803, so according the second schema motion posted above, i'll need to use a 1,5V zener diodes. Is it right?

    Sorry for my poor english and i'm a newbie. Tks.
     
  8. kinjalgp

    kinjalgp Active Member

    Joined:
    Oct 28, 2002
    Messages:
    1,851
    Likes:
    3
    Location:
    INDIA/USA
    Re: help

    No you won't need 1,5V. You have to use 27V. Those zener's are used as free-wheeling diodes to protect the outputs of ULN2803. The high voltage spikes generated across an inductor due to falling magnetic field are supressed by these diodes. If you want in place of zener diodes, you can also use general purpose diodes like 1N4007(work ok for low speed of operation) or schottky diodes 1N4933 (high speed)etc.
     
  9. hoaivan

    hoaivan New Member

    Joined:
    Mar 27, 2004
    Messages:
    4
    Likes:
    0
    tks kinjalgp for replying me.

    look at my schema, are they right ? Is there any other solution better than this ?
     

    Attached Files:

  10. kinjalgp

    kinjalgp Active Member

    Joined:
    Oct 28, 2002
    Messages:
    1,851
    Likes:
    3
    Location:
    INDIA/USA
    You circuit is ok excetpt that it is recommended to put 4.7k pull-up resistors on P0 of microcontroller.
     
  11. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH
    The bottom circuit looks OK except that you should disconnect pin10 of the ULN2803 from the 12V rail. If it is connected, the external 27V zener diodes will have no effect. This will slow down rate the current decays in the steppers. It will result in poor high speed performance.

    You may also replace all the zeners with a single 15V zener diode connected to pin 10 the same as my original schematic.
     
  12. hoaivan

    hoaivan New Member

    Joined:
    Mar 27, 2004
    Messages:
    4
    Likes:
    0
    how do you caculate that the zener didode must be 15V
     
  13. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    The zener in this case to load the inversed voltage from motors as they free running, and it will help to stop the motor.

    The supply voltage of your motor is only 12V. Therefore, if you use stepping from old floopy disk driver, you can use 12V zener here. But for safety, they usually 15V instead. 27V zener will cause slow control as you run on your motors. 15V is enough.

    And you should connect only one zener for each motor. And you connect the zener from power supply to pin 10. You don't have to put as many zener as this.

    You can search for SMACH application, it's a project of a student of Douglas W. Jones (author of stepping tutorial). And this is a good reference for driving stepping with ULN2803 or ULN2003.

    Goodluck.
     
  14. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH
    That's a good question. Falleafd is right with the explanation. However, upon further review...

    The drawing below illustrates what is happening when you switch the transistor Q1 from ON to OFF. The current (I) through the winding does not turn off instantly. It will force its way through diode D1 and against zener D2. In order for it to flow, the windings will generate a voltage equal to the voltage drop through diode D1 and D3 which is equal to 15.7V. This voltage, plus the voltage at the winding center tap, will result in 27.7V to appear at Q1's collector.

    The windings of the stepper motor act like a transformer. On the other side of the center tap, -15.7V will be induced. Since the voltage at the center tap is 12V, the voltage at the collector of Q2 is -3.7V (12-15.7=-3.7V). This might damage transistor Q2 if it is above 5V.

    If the value of the zener diode were changed to 12V, the voltage at the collector of Q2 becomes -0.7V. I recommend to change to a 12V (or slightly less) zener diode.
     

    Attached Files:

  15. hoaivan

    hoaivan New Member

    Joined:
    Mar 27, 2004
    Messages:
    4
    Likes:
    0
    thanks motion, i have another question for you:

    how to control the speed of a stepper motor ? Just depend on the frequence of the pulse on 4 winding of the motor !
    But what is the frequence that make my motor run fastest. (what is the delay time i must set between each time i setb on the outport of my microcontroller ?)
     
  16. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,329
    Likes:
    653
    Location:
    Derbyshire, UK
    It depends on various factors, mainly the design of the motor and the load on the motor - a heavier load will slow it's maximum stepping rate.

    Easiest thing is to simple try it and see, increase the speed until it misses steps, then back it offf a little.
     
  17. ivancho

    ivancho New Member

    Joined:
    Aug 20, 2003
    Messages:
    333
    Likes:
    0
    Location:
    Kansas
    :arrow: Also remember that the faster a stepper motor goes, the less torque you are going to have. So make sure you are going to have enough torque to move the load at that speed.

    The stepper data sheet will reveal some type of curve for the motor at different voltages, for your reference

    Ivancho
     
  18. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    The stepper run usually run at 4000 pulse per second with no load. And normally, we can run it at 100 pulse per second with strongest load of it.

    A clever way to write a control for stepping on MC is following:


    do this loop forever

    increment the index
    call stepping table
    output the variable updated by stepping table
    delay (t)
    do something else here...

    goto loop


    stepping table should be like this

    addwf pcl, f
    retlw b'00000001' ; step1
    retlw b'00000010' ; step2 ... and go on..


    As you want to run it in half step mode, you can add step 1,5 to the table and go on..

    After that, you can write a delay time function which is computed from the acceleration and velocity you want.

    And of course, you should use a fixed acceleration and use PID control for the high level real time control.

    You can then easily compute a accelerate table and decelerate table and then add it to the delay function.


    Finally, you have a great low cost controller yourself.

    As I see, your name looks like a vietnamese girl, doesn't it? Welcum to this forum.
     
  19. puremobi

    puremobi New Member

    Joined:
    Dec 1, 2008
    Messages:
    27
    Likes:
    0
    hi,
    i found this site recently.ppl here seem to real time experts.
    I personally am doing a project for lift or elevator .This is my post on interent regarding the need to drive my dc motor.iam doing the project in a breadboard as of now.
    the microcontroller output is not sufficient enuf to the l293d.
    l293d requires 'high logic 1' input and gives max 36v voltage output.
    i can make it run in my pcb(previously made,iam making new modifications to it ).but in my breadboard ,the o/p from the micro cont is not enuf to the l293d motor driver ic.
    If i connect the input to 12 v supply then the ic responds..even for 5v there is no response..
    please help me. thank you
     
  20. suhasdalvi

    suhasdalvi New Member

    Joined:
    Apr 11, 2009
    Messages:
    2
    Likes:
    0
    how to interface stepper motor or dc motor to xc9572

    hi all, im doing a project using cpld which requires connecting xc9572 with stepper motor or i can use dc motors also, can any1 help?
     
  21. suhasdalvi

    suhasdalvi New Member

    Joined:
    Apr 11, 2009
    Messages:
    2
    Likes:
    0
    hi i want to interface stepper motor to cpls xc9572, can any1 help me regarding this?
     

Share This Page