Shop OBEX P1 Docs P2 Docs Learn Events
Question on the L298 — Parallax Forums

Question on the L298

morris4019morris4019 Posts: 145
edited 2009-06-03 18:18 in Robotics
I bought a few L298's and am testing them out on a breadboard using the only schematic i could find for hooking up a motor to it (The datasheet). The schematic i am working with is below. I just had a few questions. Pin 4 = Vs and 9 = Vss, I have a breadboard voltage regulator that outputs 9 volts to the STAMP and pin 4. Then I have a switch on my VR that i can turn on another set of leads as well regulated to 5v/6v so i put 5v to pin 9 correct. I would assume this should be find because i built the VR where all negatives are common to each other. Also, I've made sure to use the extra diodes around the motor leads. My other question is about pin 15, it says on the schematic "to the control circuit" and also through a small cap to ground. I have it hooked up directly to ground because I'm not exactly sure what i'm suppose to hook this pin to (especially since the MAX voltage is about 2v i did not want to take any chances.)

Also, I'm assuming that i could use PWM to the 2 inputs but probably not to the enable right? I'm just wondering because as of now I am getting no movement from the motors.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======

······ I'll try everything once [noparse]:)[/noparse]
640 x 480 - 78K
640 x 480 - 62K
640 x 480 - 60K
917 x 408 - 44K
«1

Comments

  • morris4019morris4019 Posts: 145
    edited 2009-05-14 21:14
    OK, so i found that the resistor from pin 15 to ground needed to be smaller, but there is still a problem. I took a reading with my voltmeter on the 9v battery and it was down to about 7.5v. When i hooked it up to the VR and turned the circuit on, i got one good spin for about 1 second. Just what it was programmed to do, but there is a catch, it drained my battery down to right over 5v, which i believe is not going to be enough to run the stamp and the circuit. I would assume that this is not the way the L298 should drain power correct?

    Also, when using PULSOUT to the inputs my stamp restarts the program several times before the motor even spins once. I programmed in a delay of 1 second in between going one direction and another and not even that helped. Any ideas?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]

    Post Edited (morris4019) : 5/14/2009 9:36:04 PM GMT
  • FranklinFranklin Posts: 4,747
    edited 2009-05-14 21:35
    You will probably need to power the motors from a more robust power source. Try a 6v wall wart for testing to eliminate the sag in power you are experiencing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-14 21:50
    9V batteries are pretty useless for powering motors (other than very very tiny ones). A 9V alkaline battery has a fairly high internal resistance that limits the maximum current output and the battery capacity is low, so it becomes exhausted quickly. They're very expensive for what you get. If you need to use a battery pack, I'd suggest a 5 cell AA battery pack using 2300 mAh or higher capacity NiMH batteries which are readily available. RadioShack sells a 4 cell and a 1 cell battery holder that you can wire in series. If you want to use alkaline batteries some of the time, you put them in the 4 cell holder and use a switch or jumper to bypass the single cell battery holder.
  • TimmooreTimmoore Posts: 1,031
    edited 2009-05-14 21:53
    I normally connect PWM to en and C/D fixed L/H depending on direction. The PWM controls the % of time the motor is powered in the direction given by C/D so controls the speed on the motor. There is a limit on the freq of the PWM - the l298 spec says ~25KHz
  • morris4019morris4019 Posts: 145
    edited 2009-05-14 21:55
    Ok, i did not realize that about the 9v. The bot has run this whole time without ever needing replacement batteries on 5 AA. Actually the old r/c car chassis that i am using has a 3 AA holder built in so i ran another 2 AA holder to it with no problems. I should probably just hook up that power source to my breadboard for testing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-05-14 22:21
    So that works great thanks everyone for your help. I will have to remember that about the 9v in the future.

    Tim, this assume is how you were talking about sending signals to the L298?

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    ' Test function of 1 motor with L289.

    '
    Set directions
    DIRD=%0111 'Set outputs to 15 (enable), 14 (forward), 13 (reverse).


    '
    Constants
    enable CON 15 'Enable pin 15
    forDir CON 14 'Forward Direction pin 14
    revDir CON 13 'Reverse Direction pin 13

    speed CON 1000 'Speed constant, used in pulse to enable pin.


    '
    Variables
    counter VAR Word ' Counter for pulsout commands.


    '
    Routine
    'Display message.
    DEBUG CR, "Running Forward..."

    ' First run reverse.
    LOW forDir ' Use low/high to force direction.
    HIGH revDir
    FOR counter = 1 TO 150
    PULSOUT enable, speed ' Pulse the enable pin to control speed.
    NEXT

    PAUSE 1000 'Delay in between pulses.

    DEBUG CR, "Running Backward..."
    ' Next run forward.
    LOW revDir ' Use low/high to force direction.
    HIGH forDir
    FOR counter = 1 TO 150
    PULSOUT enable, speed ' Pulse the enable pin to control speed.
    NEXT

    OUTD=%0000 'Stop all outputs

    DEBUG CR, "ending..."


    END

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-05-15 01:43
    When running the script along with the L298, it is very jump when using pulsout. I can't get away from checking sensors and things in between each pulse (or every few at the max). Should i just use high/low without any variable speed? Meaning should I put a constant high to the enables and just use high/low to the inputs?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • GWJaxGWJax Posts: 267
    edited 2009-05-16 16:39
    OK working with the L298N chip this is what I have done for the Wall-E project for testing. Below is the script for the BS2 and also attached are a few schematics I used. When running the motors use a separate power source for both the motors and the BS2 but keep the grounds connected. Also when running motors from the BS2 or any stamp use an Optp-Coupler to protect your stamp from any spikes that may occur from the motors. Also I see that your motor casings are not grounded so I'll add a photo that you can use to reduce the electrical noise from them when the move. you can use the PWM command to control the speed of them but you must use a HIGH command on the enable trigger. Below is a small test routine that I used for testing only for full on and full off of the motors. Also if you use my schematics for the L298N C1= 1.0 uF C2,C3 are 0.1uF caps

    because of the Opto-Coupler movie is to big to upload I'm attaching the youtube version of it here





    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' Motor movement for Wall-E H-Bridge using a L298N chip Test routine
    ' By GWJax 04 May 2008
    '==============================================================================
    ' Set Wall-E's Varaibles

    '
    ' Set Wall-E pin lay out
    Wall_E_LfBack PIN 8 'sets left track backwards to pin 8
    Wall_E_LfFront PIN 9 'sets left track foward to pin 9
    Wall_E_RtBack PIN 10 'sets right track backwards to pin 10
    Wall_E_RtFront PIN 11 'sets right track foward to pin 11
    Wall_E_Rt_E PIN 12 'sets right motor on/off
    Wall_E_Lt_E PIN 13 'sets left motor on/off
    '
    ' setup pin I/O's
    LOW Wall_E_lfBack
    LOW Wall_E_LfFront
    LOW Wall_E_RtBack
    LOW Wall_E_RtFront
    LOW Wall_E_Rt_E 'disable right motor
    LOW Wall_E_Lt_E 'disable left motor
    '
    Main:
    GOSUB Wall_E_STOP
    GOSUB Wall_E_FowardFast
    PAUSE 1000 ' let run for one sec.
    GOSUB Wall_E_STOP
    GOSUB Wall_E_BackFast
    PAUSE 1000 ' let run for one sec
    GOSUB Wall_E_HBStop ' opps turn off the motors!
    PAUSE 500 ' pause 1/2 sec
    GOSUB Wall_E_Stop ' reset lines for floating
    GOSUB Wall_E_CW
    PAUSE 500 ' run for 1/2 sec
    GOSUB Wall_E_Stop
    GOSUB Wall_E_CCW
    PAUSE 500 ' run for 1/2 sec
    GOSUB Wall_E_Stop
    PAUSE 2000 ' wait for 2 sec
    GOTO Main ' return to the main and do again

    '
    'Wall-E stop moving
    Wall_E_STOP:
    LOW Wall_E_Rt_E
    LOW Wall_E_Lt_E
    LOW Wall_E_lfBack
    LOW Wall_E_LfFront
    LOW Wall_E_RtBack
    LOW Wall_E_RtFront
    RETURN
    '
    Wall_E_FowardFast:
    HIGH Wall_E_Rt_E
    HIGH Wall_E_Lt_E
    HIGH Wall_E_RtFront
    HIGH Wall_E_LfFront
    RETURN
    '
    Wall_E_BackFast:
    HIGH Wall_E_Rt_E
    HIGH Wall_E_Lt_E
    HIGH Wall_E_RtBack
    HIGH Wall_E_LfBack
    RETURN
    '
    'Wall-E move clock wise
    Wall_E_CW:
    HIGH Wall_E_Rt_E
    HIGH Wall_E_Lt_E
    HIGH Wall_E_RtBack
    HIGH Wall_E_LfFront
    RETURN
    '
    'Wall-E moving counter clock wise
    Wall_E_CCW:
    HIGH Wall_E_Rt_E
    HIGH Wall_E_Lt_E
    HIGH Wall_E_LfBack
    HIGH Wall_E_RtFront
    RETURN
    'Wall-E hard break stop
    Wall_E_HBStop:
    LOW Wall_E_RtBack
    LOW Wall_E_RtFront

    RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
    658 x 433 - 29K
    499 x 125 - 8K
    352 x 411 - 3K
  • morris4019morris4019 Posts: 145
    edited 2009-05-17 01:28
    GWJax, do you have problems when using the PWM to dc motors? Here is exactly what is happening and, like i said before, it only seems to happen when using PWM to control the motors. Probably because of the on/off/on/off.... etc. Forward and reverse speed are of course slower (because only half the time they are on), but when it comes to turning CW or CCW (motor A forward/motor B reverse), it can barely turn, and it shudders or shakes while doing it. I always feel sorry for it and pick it up. haha. But when i go to using HIGH/LOW on both enable and directions i get good carpet and even rough terrain coverage (i tested it outside), but no speed control. Plus it makes his movement look pre-programmed, not like he turns just enough to be out of the way of the obstacle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-05-17 01:30
    Oh, and I have heard of putting a small cap between the leads, but i have never seen the "Floating case". Is the grounded case a good application for a dc motor that always turns the same direction, whereas the floating would be, for instance on my project, with bi-directional motors?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • GWJaxGWJax Posts: 267
    edited 2009-05-17 14:08
    the floating case is just if your motors metal case is not grounded and yours does not look like they are. I would go with this route with 2 caps. as of grounding the case it is up to you application if you have room to ground them other than that it makes no difference where how the motors move. these are designed to to reduce the electrical noise from the the motors so you don't damage any electronics out if they stall or start and stop fast...

    Jax
    morris4019 said...
    Oh, and I have heard of putting a small cap between the leads, but i have never seen the "Floating case". Is the grounded case a good application for a dc motor that always turns the same direction, whereas the floating would be, for instance on my project, with bi-directional motors?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • GWJaxGWJax Posts: 267
    edited 2009-05-17 14:26
    No I do not with the Opto-Couplers installed to remove all spikes from the motors to the MCU. If you add a small PWM routine here I run it on my platform and see if it has the same problem as yours. Also make sure you install a large heat sink on the L298N with Mylar in between them and of course heat sink grease. When running the chips the tab gets really hot and needs that sink to cool it down. the reason for the Mylar is because the tab is grounded ad you don't want the heat sink grounded unless you have a good place for it else it could touch up against something and cause the magic smoke to release from your circuit. Just a waring that all. "Smiles and Blushes" because I did that one with out thinking..

    Jax
    morris4019 said...
    GWJax, do you have problems when using the PWM to dc motors? Here is exactly what is happening and, like i said before, it only seems to happen when using PWM to control the motors. Probably because of the on/off/on/off.... etc. Forward and reverse speed are of course slower (because only half the time they are on), but when it comes to turning CW or CCW (motor A forward/motor B reverse), it can barely turn, and it shudders or shakes while doing it. I always feel sorry for it and pick it up. haha. But when i go to using HIGH/LOW on both enable and directions i get good carpet and even rough terrain coverage (i tested it outside), but no speed control. Plus it makes his movement look pre-programmed, not like he turns just enough to be out of the way of the obstacle.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • morris4019morris4019 Posts: 145
    edited 2009-05-17 19:12
    I've attached the latest version on the script i've been running on my bot.

    Running specs:

    ·· motors x 2 = GM9(Solarbotics)
    ·· voltage···· = 7.5·(5 AA)
    ·· motor driver = L298

    I have not had a chance yet to isolate power sources 1 for each motor and stamp, but trying to get everything together to get it done within a few days. And I REALLY appretiate all the help guys. Everyone is so informative... makes learning easier, and more fun hop.gif



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-05-29 02:00
    Any ideas GWJax? On why it pulses so much?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-05-31 02:17
    Using the Propeller to control a L298, can i not use a counter module of one cog, set as perhaps NCO mode to control the enable pin? Then either setting dira/dirb to high should control direction.

    The reason i ask is, I was looking through the 2 objects in the Obex that i found, one is "PWM Motor Driver (H Bridge)" the other "L298 PWM Motor Control". I looked through the code and I am wondering why they are both using spin and Assembly? I'm have NO knowledge of assembly language, I only use BASIC/C++/visual basic/PHP/some java/HTML/XML and now learning SPIN. In my head, after doing my research on the spin language, I thought I should be able to use PWM with a counter module, or am i wrong?

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • TimmooreTimmoore Posts: 1,031
    edited 2009-05-31 03:58
    I use something I built using Phils PWM code that uses the video generator rather than counters. I use it for a motor object that can drive upto 8 motors since phil's code can generate upto 8 pwm's with 1 cog. Heres the thread http://forums.parallax.com/forums/default.aspx?f=25&m=272529. If you are interested I can post the motor object I have used it with the tb6612, l293 and mc33887 and it should handle the l298 without problem though I haven't tried it.
  • morris4019morris4019 Posts: 145
    edited 2009-05-31 05:32
    I loaded Phils PWM code on to my Prop and it works great. Now i'm having trouble getting the "Pulse" action, or short pauses out. I edited the demo program so that it does goes from 0 to 100% and stays there. But even at 100% it is still very jittery, its sounds as if there are about 3 very aparent pulses per second. I put pressure on the output of the motor to slow it down and really hear how the motor was pulsing and you can really tell that there are about 3 pulses per second. Is there any way to get a smooth constant rotation with this object?

    Like i said before I am using a GM9 gearmotor (bought from solarbotics) and the L298 with 9v (6 AAs) output to motors. 3.3v logic input from Propeller.

    To get a good picture of what i'm dealing with, with no load on a bench you can basically just hear the pulsing. But when wheels installed and under load, say making a left turn, it is very jerky from these pulses.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • TimmooreTimmoore Posts: 1,031
    edited 2009-05-31 07:23
    What freq are you setting the pwm to? I use 21000 for the tb6612 and 5000 for the l293 and mc33887. From what I remember of the L298 21000 should work for it as well. You should check the datasheet, you want the freq to be fast otherside you dont get smooth control but if its faster than the chip can handle it will get hot and lose power.
    Also how have you wired the l298 up? I use it with the pwm is going to enX pin and the inX pins are controlling the direction.
    From what I could see in the picture above I dont think you have diodes on the motors - you need this or you will blow the l298.
  • morris4019morris4019 Posts: 145
    edited 2009-05-31 15:46
    I do have the diodes on the motor (but like i said before, thanks for reminding me, i some times forget), I've tried lots of different frequencies, and really, like you said 5000 is about the best. But, I don't really have speed control. When i switch to a high freq like 21000, the motor doesn't even spin. 5000 down to about 1000 slows it down very slightly, then it drops off lower than 1000.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • GWJaxGWJax Posts: 267
    edited 2009-05-31 16:50
    Sorry mike I forgot that I had to ripdown my wall-e platform that has the same circuit that yours does. I'm working on getting it back up and running and I'll let you in on how I use the PWM with out the jerking movements. this might take me another week to get it in order or less. I'll post what I fine very soon.

    Jax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • TimmooreTimmoore Posts: 1,031
    edited 2009-05-31 16:53
    What are you doing with the C and D inputs? If they are the same then the motor will stop. You want to set them different if you are moving (which one is high changes direction). If you want to stop, set pwm to 0 and C and D to the same.
    This is the code I use for speed control

    Pub SetSpeed(Motor, Speed) | m
    '' Set the speed on Motors with bit 1 to speed
    '' Coasts if speed is 0
    '
      repeat m from 0 to NumMotors-1
        if Motor & (|< m)                                   'for each motor command is for
          if CurrentDirection[noparse][[/noparse]m] ^ (Speed & $8000000)
            pwm.duty(PwmPin + PwmOffset[noparse][[/noparse]m], 0)              'set motor to coast if changing direction
          if (((Speed > 0) & |<m) ^ (Reverse & |<m))        'Calculate In Pins for correct direction
            outa[noparse][[/noparse]In1Pin[noparse][[/noparse]m]] := 1
            outa[noparse][[/noparse]In2Pin[noparse][[/noparse]m]] := 0
          else
            outa[noparse][[/noparse]In1Pin[noparse][[/noparse]m]] := 0
            outa[noparse][[/noparse]In2Pin[noparse][[/noparse]m]] := 1
          pwm.duty(PwmPin + PwmOffset[noparse][[/noparse]m], (||Speed)<#MAX_SPEED) 'set pwm duty cycle
          CurrentDirection[noparse][[/noparse]m] := Speed & $80000000          'Save new direction
    
    

    Motor is a bitmap so you can set multiple motors. Speed is +ve for forward and -ve for back. I set the pwm to 0 when changing direction, so you dont get high currents though the motors. reverse is a bitmap of the motors which need to run reversed (i.e. forwards is backwards). So you can see I check if speed is -ve or +ve and set C and D (or In1/in2) correctly and then set the pwm duty cycle making sure I remove the -ve from the duty cycle.
  • morris4019morris4019 Posts: 145
    edited 2009-06-02 00:06
    No they are not the same, at the moment I have it only turning one direction, just testing different speeds for now.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • GWJaxGWJax Posts: 267
    edited 2009-06-02 00:43
    morris4019 said...
    Any ideas GWJax? On why it pulses so much?

    Morris4019, I have made an Excel spread sheet to calculate the PWM command codes and it has a D/A converter schematic for this operation. I'm working on how to show you how to use the PWM command that is designed for the BS2. As you may know the PWM command is not the same as a standard MCU PWM Command. using this spread sheet will help you find the voltages you need and what resistor and capacitor you need for the fastest refresh times. I am using this in conjunction with an Opto-Coupler circuit that will turn on/off the L298N HBridge chip with out the shudder on the motors. The Platform is almost ready and I'm working on a real simple code just to get you started with the PWM command. See attached Excel file and play around with. Just type in the yellow blocks and the spreadsheet will do the rest. Enjoy for now..

    Jax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • morris4019morris4019 Posts: 145
    edited 2009-06-02 20:11
    Awesome thank you so much!



    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • TimmooreTimmoore Posts: 1,031
    edited 2009-06-02 21:51
    You might find this useful http://www.sparkfun.com/commerce/product_info.php?products_id=9213
    Sparkfun has a breakout board using the L298, the schematic is available as well.
  • morris4019morris4019 Posts: 145
    edited 2009-06-03 02:22
    Looking through the link above, at the schematic. i never thought of using an inverter the way they did. Making it so there are only 2 pins needed total for each motor. I've never used the 74HC1G04, is it just an inverter? I looked through the datasheet and was a little confused so sorry about the simple question.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • morris4019morris4019 Posts: 145
    edited 2009-06-03 02:24
    GWJax, i am using the PROPELLER to power the bot, it has alot more freedom and power. Sorry for the confusion.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • GWJaxGWJax Posts: 267
    edited 2009-06-03 03:14
    OK that makes seance know. I'll work on the Propeller SPIN style now. This may that some time now but at lease my professional board just arrived today. I'll work on it this weekend and drop out the BS2 STAMP series programming then..

    Jax

    morris4019 said...
    GWJax, i am using the PROPELLER to power the bot, it has alot more freedom and power. Sorry for the confusion.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • morris4019morris4019 Posts: 145
    edited 2009-06-03 04:32
    So good news everyone. I took a little time to look through the code that Phil has set forth and made a tremendous breakthrough... Although i don't quite understand the assembly; YET - I GOT IT TO WORK! The frequency does not seem to matter with the L298, I tried, in 1k increments from 1000 to 20000 with no change. The duty however, on his weighted numbers from 0 to 255 has to stay above 231 to even spin the motor at all. I modified it to accept different values, based on the code i've already written, so that i can have speed control. Also, i've taken a little tidbit from the sparkfun schematic and added an inverting buffer to the mix so that I only require 2 pins (an enable and a direction) for each motor. The direction pin goes straight to dirA while also through the inverter to dirB. Works like a charm. Big thanks goes out to everyone on this one. I could not have done it without all of your help. Now that i've tested all pieces of my bot as modules I'm going to start putting it back together with all of the improvements... Except for the inverting buffer, all i had was an octal inverting buffer, i'm waiting for a quad, because space is definetely an issue on my board.

    Thanks again everyone, once again you've pulled me from the bottom and helped me learn a whole lot more than what i started with. [noparse]:)[/noparse]

    Also, now that i've completed the circuit for my beacons, i was wondering if anyone had any tips on ways to actually built the platform/chassis of the beacon? I was almost thinking of cutting up some round tupperware, but i was just wondering how others have done it.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • TimmooreTimmoore Posts: 1,031
    edited 2009-06-03 05:08
    The pwm clock is speced to be typical 25Khz and max 40Khz so its not surprising that you dont see much change there.
    A bit puzzled by the duty value. I find the full range is normally usable. There is often a small range around 0 that doesn't start because the motors/gears need a bit to overcome friction. If you have mis-aligned gears this can be larger - I would check if the motors have much resistance to moving by hand.
    In terms of chassis, I have used anything from foamboard with motors hot glued to it, polycarbonate, expanded pvc, aluminium, abs, a pcb board, a toy track. foamboard is a cheap, quick way to try stuff but not tough. Expanded pvc is pretty easy to use and a bit tougher. Polycarbonate/abs good but a bit harder to use. I know people who have built the chassis from wood. Lego works as well. If you dont want to spend time doing it yourself or want ideas
    http://www.sparkfun.com/commerce/product_info.php?products_id=9207 for a pcb idea
    http://www.pololu.com/catalog/category/26 for polycarbonate
    http://www.budgetrobotics.com/shop/?cart=772317&cat=5&amp; for expanded pvc
Sign In or Register to comment.