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

L297-L298 stepper motor control

Discussion in 'Robotics & Mechatronics' started by banh, Aug 18, 2004.

  1. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    Hi,
    I'm going to connect the circuit to control step motor using both L297, L298 as in the L297 specification.

    A few things i widh to ask:

    what should the CONTROL pin's value be: 0 or 1?
    WHat's the effect of HALF/FULL Step (provided i use the same CLOCK all the time)? is it correct that i does not change the speed but just have a higher resolution of the motor revolution?
     
  2. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    banh,

    because you are vietnamese, you can come to www.diendandientu.com to see my translated tutorial of Stepping control of Douglas W. Jones. He's my "online" teacher. He's taught meeh via email for 2 years.

    If you wanna see the original document, search for Douglas W. Jones

    Its a wonderful Stepping control tutorial.

    The torque in these 2mode of full step and half step is different.

    At full step, if you enable 2 winding at a time, you get 1.4 times stronger torque than normal. But at half step, the torque will change each half step, 1, 1.4, 1, 1.4 ...etc. Half step is the combination of 2 full step mode.

    Half step creat higher resolution.

    revolution = cycle, it depends on the number of pulse, not on the half step or full step modes.

    With full step, you need N pulses to turn the motor a revolution, in half step, you need 2N pulses. Pulses here means a control vector.
     
  3. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    Thanks falleafd,

    what i'm still blurr is the value of the CONTROL input of the L297? Can it take any value?
     
  4. dave

    Dave New Member

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


     
  5. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore

    is it correct that if i use ABCD, i don need to use INH1, INH2? In this case CONTROL should be 1?
     
  6. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    No, INHx are connected to enable bit of L298, and they are outputs of L297. You cannot control it normally. To control these pins, you need CONTROL input to select the mode of control.

    ABCD is connect to the inputs of L298, to generate pulses on dual H bridge. INH is used to stop the L298. It's active LOW, because as output low on INH, it inhibits (stop) ENABLE bit on L298.

    You can use CONTROL signal to select the chopper on ABCD or INH. You only need to use control HIGH (chopper on ABCD) if you need this technique.
     
  7. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    thanks,
    :)
     
  8. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    about Vref for L297, how to calculate?
    say, Rsens=0.5 Ohm, and my motor takes 2A -> Vref is 1V?
     
  9. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    Yes.

    Vref of a driver chip is the output, that you can use your ADC to measure this voltage, and disable the driver if the Vref higher than the max Vref.

    Your motor is normally running at 2A, but at starting it may rearch 3A. So you cannot stop the motor at 3A. You can use a controller to lock the driver if it's at 3A for very long time or if it's higher than 3A.

    So, in this case, your Vref should be 3A * 0.5Ohm = 1.5V.

    However, try to choose Vref ~ 5V which applied to VDD of your uC. In this case, you can use your comparator but not a ADC to control the driver.

    Why? Because, some uC do not support ADC, but it supports comparator, such as: 16F628, or 16F628A.
     
  10. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    i don't understand,

    Vref is the input into L297? how come you say "Vref of a driver chip is the output, that you can use your ADC to measure this voltage".
    inside L297 already has comparators with Vref as inputs so that it will chop whenever voltage (by current of motor & Rsense) exceeds Vref.
    So Vref is the volatge we should set for the L297, correct (i.e. it is input to L297) ?
     
  11. falleafd

    falleafd New Member

    Joined:
    May 13, 2003
    Messages:
    412
    Likes:
    0
    Location:
    Vietnam
    Oh, sorry, I said about the Vref on uC, that I use to control L298. SenseA, and SenseB are connected to Vref of uC, that is why I say Vref is the output from driver chip.

    However, a internal comparator of L297 can be used, and you can apply the max voltage to chopper the driver, if the current is going too high.

    However, I don't use it in my driver, because as I said, a high current could be created at the beginning (especially with DC motors), so if you chop down the chip, you cannot control the driver anylonger.

    That why I use SenseA, and SenseB connect directly to microcontroller. I use software to detect the high current. If high current is higher than normal current for so long time, I'll cut down the chip. For short circuit protection, you should use hardware. Software is used in this case to protect the chip and the motor if you apply a heavy load, or the motor is stopped by external forces.

    With stepping it seems to be oki with comparator protection, so you can use the Vref inputs as you want.
     
  12. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH
    It depends on the motor that is connected, the desired speed and the efficiency you're trying to achieve.

    Setting it to 0 will send current control thru to INH1 & INH2. This turns OFF all transistors in the H-bridge when the current exceeds the reference level. This will result in current to decay faster and will allow the motor to run faster but hotter. This is used for steppers with high inductance.

    Setting it to 1 will send current control thru to ABCD. The freewheeling motor current will decay slower. The current will fluctuate less and so there is less ripple, less core loss and run cooler. Low inductance motors will benefit from this control method.

    With the same clock, running at half steps will reduce the RPM to half that of full steps. Half steps will reduce vibration and acoustic noise.
     
  13. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    thanks for your reply. :)
     
  14. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    My circuit is as attached. however i found that Motor is very "weak", and slow. WHat factors do you think i can change to improve?
     

    Attached Files:

  15. banh

    banh New Member

    Joined:
    May 19, 2004
    Messages:
    33
    Likes:
    0
    Location:
    Singapore
    i fix the problem already. I forgot to connect gnd for L298.
    btw,
    what is the effect of the capacitor & resistor into pin OSC? experiment, i don't see any change it made (e.g. i change the capacitor, or i even get rid of it)?
     
  16. loup-garou

    loup-garou New Member

    Joined:
    Mar 28, 2008
    Messages:
    86
    Likes:
    0
    Location:
    Malta
    from the datasheet, this detemine the chopper rate, but seems that it don't have effect. :confused:
     
    Last edited: Dec 2, 2008
  17. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,026
    Likes:
    951
    Location:
    NJ
    Hi,

    Just to note, you can use a motor driver voltage much higher than 6v
    to get the motor to go faster. If the chopper circuit is working right
    the chip will not burn out the motor as it will regulate the current
    by chopping it.
    Typical voltages are 30v or more, even with 5v rated coil motors.
     
  18. loup-garou

    loup-garou New Member

    Joined:
    Mar 28, 2008
    Messages:
    86
    Likes:
    0
    Location:
    Malta
    hi MrAl,

    but, it is already much higher than 6v as it can reach 46V (on the L298 datasheet), another important thing, the voltage depends on the motor caracteristics !!

    or didn't I understand you ?
     
  19. loup-garou

    loup-garou New Member

    Joined:
    Mar 28, 2008
    Messages:
    86
    Likes:
    0
    Location:
    Malta

    great explanations,

    but there are things which are not yet clear into my mind,
    the datasheet says about the INH1:
    does this mean that:
    -if CONTROL is set to 0V, will there still be a protection from high current since INH1 and INH2 are disactivated ? cause I've read that those two pins Disable the L298 when high current is detected .
    -does the CONTROL pin set depends on the motor kind (bipolar or unipolar) ?

    another thing:

    from the datasheet, three driving modes are possible :
    *NORMAL DRIVE MODE
    *HALF STEP MODE
    *WAVE DRIVE MODE

    the second and third modes needs INH signals (so CONTROL = 1 volt) and not the first mode, why ?

    in the timings page 5 and 6, INH signals are present with phase signals (A,B,C,D), isnt this contrary to what was written before :

    thanks in advance.
     
    Last edited: Dec 2, 2008
  20. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,026
    Likes:
    951
    Location:
    NJ

    Oh ok no problem then, i thought the schematic showed 6v.

    Wait a minute...the schem posted by banh *does* show 6v, that's why i commented in the first place.
     
    Last edited: Dec 3, 2008

Share This Page