how do i control an l298

Discussion in 'The Projects Forum' started by txfirefighter4721, Aug 3, 2009.

  1. txfirefighter4721

    Thread Starter Member

    Jul 30, 2009
    13
    0
    If I were to use an l298 chip to control two small 12vdc motors what schematic would i use to control the polarity of the motors. Can I simply put power to one input and get a cw rotation on one of the motors and power to the next input to get a ccw rotation out of the same motor. Also can I put a variable resistor to the inputs to control speed. I really need some help. Thanks
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    More specifically, look at the bottom of page 6 of the datasheet that mik3 linked to.

    If you are going to use PWM to control the speed of the motor(s), I suggest that you apply it to the EN input(s).

    Also, don't suddenly reverse the direction of the motor(s), as it will be very hard on both the motor(s) and the L298.
     
  4. txfirefighter4721

    Thread Starter Member

    Jul 30, 2009
    13
    0
    Can you give me an example of how to incorporate a pwn into a simple schematic. I'm really new at this and I'm diving head first into it. Can you give me some schemtic examples and their explanations please. May ill have a better idea then.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's a couple of PWM circuits from Bill Marsden's albums:
    [​IMG]

    The one on the left is easier to build, and has a wider range.
    There are a pair of LEDs with current limiting resistors on the output so that you can get an idea of what percentage of time the output is spending high vs low.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    What is it exactly that you wish to do? Simply saying that you want to control two DC motors in forward and reverse direction isn't a lot to go on.

    What's the voltage and current rating for the motors, for starters?
     
  7. txfirefighter4721

    Thread Starter Member

    Jul 30, 2009
    13
    0
    I'm building an underwater rov. Ive got the reversing part down and have started on the full schematic. The currents for the motors are 12vdc with about an amp at stall. They souldnt burn anything up. Basically I want three motors to run x y and z axis on the sub. They need to be able to reverse thrust and speed up or down. There will also be a gear motor for pan up and down for the camera. My exterior design if very similar to the rov's on the site www.seabotix.com if you care to look. Very basic but hard to a newbie in the circuitry field.
     
  8. txfirefighter4721

    Thread Starter Member

    Jul 30, 2009
    13
    0
    Wookie,
    Can you explain the schematic to me please. What is Vcc? Where do I need to attack the left sch to the l298?
     
  9. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    txfirefighter,

    Vcc is whatever supply that you intend to power you motors with. You indicated that you were using 12V motors so most likely Vcc is equal to 12 Volts in your case.

    hgmjr
     
  10. txfirefighter4721

    Thread Starter Member

    Jul 30, 2009
    13
    0
    Ok thanks.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, I didn't realize that you were attempting to build something for use underwater.

    In that case, you won't be able to use potentiometers (variable resistors) unless you can find some somewhere that are water-tight. I have never needed to look for anything like that.

    It certainly will be a specialty item; stocked by very few, and quite expensive.

    Anyway, you wanted an explanation of Bill's circuit.
    As hgmjr mentioned, Vcc is the + supply voltage; in your case it will be +12v.
    Pin 8 of the 555 is the supply pin.
    Pin 4 is the RESET pin, and must be held high in order for the 555 to operate.
    Pin 1 is the GROUND pin, and must be connected to the supply return (the battery - terminal) in order for the 555 to operate.
    Pin 2 is the trigger input; when the voltage on the trigger falls below 1/3 Vcc, the output (pin 3) will go high.
    Pin 6 is the threshold input; when the voltage on the threshold increases above 2/3 Vcc, the output (pin 3) will go low.
    CR1 and CR2 can be a variety of diodes. 1N4148 and 1N914 computer switching diodes are typically used for applications like this. CR1 and CR2 control the charge and discharge paths through R2 for the timing capacitor, C1.
    R2 adjusts the PWM percentage of the output. When set in the middle, the PWM output will be at roughly 50%.
    C1 is the timing capacitor. The waveform on C1 will look nearly triangular, and vary from just about 1/3 Vcc to 2/3 Vcc.

    I must say that you've chosen a fairly ambitious project for a "n00b". The problem with newbies attempting ambitious 1st projects is that the probability of success is very significantly diminished.
     
  12. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    With a 12V supply a 1A motor will typically get only 9.5V because of the output voltage losses of the L298 IC.
     
Loading...