L297/298 problems

Discussion in 'General Electronics Chat' started by eggplant, Feb 19, 2011.

  1. eggplant

    Thread Starter New Member

    Feb 19, 2011
    Hi all,

    Came accross this forum whilst trying to figure out my problem. There are similar posts I have read but Im still confused.

    I am building a small CNC router and have most of the parts now. At the moment I am trying to sort out the stepper drivers, Im using an arduino (AVR based micro controller board) at the moment as find this easy for testing purposes and cheaper than blowing up a pc, and I have yet to make my pc interface card. Eventually the idea is that the cnc machine, whilst the software (yet to be decided) will run on the pc, the machine will be at the other side of the room using an arduino and bluetooth or wireless to "connect" to the pc.

    The steppers I have are from a well known auction site and are a little over spec for my needs, but the idea was to make a small machine initially then use as many parts as possible to make a larger one once I learned more and figured out what works and what doest.
    The motors are bipolar, the specs are :

    Step angle, 1.8
    Rated current 2.8A
    Phase resistance 1.13Ω
    Phase inductance 3.6mH
    Holding torque 263 oz/in 18.9kgf/cm

    I bought a 297/298 component kit which is basically the components to make a circuit very similar to the ones on the 297/298 datasheets. I made a few changes, put pin headers for the various ports on the 297 and also put a potentiometer and resistor accross Vref - I read this whilst doing some research and it seemed a good idea to be able to adjust the vref.

    I made a board in eagle -a link to the schematic is here and built it.

    I used a very basic test program initially which basically sends a pulse to the clk pin on the l297, the program is as follows but written in C rather than english !

    set clk pin low
    wait X microseconds
    set clk pin high
    wait 1 microsecond

    the value of X works from about 400/600 for the fastest speed depending on the voltage to the L298.

    the above runs constantly in a loop. I fired it up with a standard 12V 3A typical "power supply" like ones that come with pretty much any low voltage home appliance. After a bit of tinkering with the vref (which I initially set to 1V) , various settings on half/full and the control/inhibit thingys, and various settings with the value of the delay in my program I got it to work.

    It was slow, and depending on the clock speed and also the vref potentiometer adjustment the motor either ran smoothly, gave a high pitched whine and turned slowly or not at all, or it made a grating sound and moved very roughly.

    When it ran smooth it was fine, plenty of torque but slow. The max I could get it to run well with the 12V supply was 120RPM. This was with my X value of 600 microseconds.

    After some research, it seemed that I needed more voltage, so I plugged in a 19V laptop power supply. This allowed an X value of 500uS and gave a speed of 145 RPM.
    The higher voltage seemed to be working, so I plugged in a 32V / 1.5A supply from an HP printer. Managed to get 225 RPM then POP ! power supply protection kicked in.
    Once it had reset, I connected up again but the motor just hummed and wouldnt turn, one of the large 0.5Ω sense resistors was red hot.

    I made another board as I had ordered 2 kits, basically the same but added jumpers for the half/full, inhibit/phase etc.
    Ran the tests again and got the same results, even (stupidly) ran it with the HP 32V supply which also gave the same result !!!! I am now waiting on some new 298's to come.

    I hope the above isnt too much but I thought it best to give as much detail as possible.

    So onto my question - where am I going wrong ?! From my tests so far it seems that there are several factors that affect the smooth running and speed:

    my program/delay time between steps of course

    the vref adjustment seems to make a large difference as I adjust it, it can make the motor stop, humm, buzz, grind or run smoothly.

    The control pin that changes the chopper mode makes a seemingly random difference.

    The half/full setting also makes a difference but it doesnt seem to do half steps.

    Can anyone please offer some initial pointers in the right direction, I "just" need the motor to go faster. I know there are ready made drivers available but I would rather do as much of it myself as I can for the learning side but also for the enjoyment, and satisfaction of having made it myself.


  2. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    Hey Welcome to AAC

    Got a good advice for u, quit using obsolete IC's, and go for the new allegro devices. Much much better.

    I know, I did.

    It's just that L297/298 aren't too reliable
  3. hgmjr


    Jan 28, 2005
    How about posting your source code. Use the code tags that are available in the "Go Advanced" reply editor to make the code easier to read.

    Maybe we can spot something that can be improved in your motor driver algorithm.

  4. shortbus

    AAC Fanatic!

    Sep 30, 2009
    Like R!f@@ said the L297/L298 is a bad idea for a CNC. They are limited in the number of steps/motor speed.

    There are a bunch of stepper driver chips out there that are in the scheme of things actually cheaper let alone better. Especially if you figure in the time to trouble shoot a circuit to make the L297/L298 work with your CAM program. Just the time it takes to make your uC code work with the CAM program is going to take time if you aren't fluent in code programing.

    I'm in the starting stages of a CNC myself and bought my drivers (Pac-Sci) off of ebay. they were pretty cheap, when you consider the hassles I side-stepped, lets me spend more time and energy on the actual mill.
  5. SgtWookie


    Jul 17, 2007
    One of the big problems with the L298 is that they used Darlington transistors as voltage followers on the high side and as saturated switches on the low side.

    At higher currents, the total voltage drop across the bridge gets to be excessive (around 4.9v), and multiplied by the current (say, 2A) you wind up with roughly 4.9v * 2A = 9.8 Watts per H-bridge, so ~19.6 Watts or so power dissipation for the package.

    This is a non-trivial amount of heat to remove from the package.

    The L298 is rated for a maximum 2A continuous current, and even at that current, you would need a very efficient (large) heat sink.
  6. eggplant

    Thread Starter New Member

    Feb 19, 2011
    Many thanks for all the replies. It looks like Im going to leave the 297/298 idea.

    A coincedence, I found some pac sci 5210 driver modules on ebay for cheap which I forgot about until they arrived yesterday, I ordered them as I figured that if I set one of these up with one of my motors and it worked then I could be on with mounting motors and other parts of the project whilst I figured out my 298 problem. I would still like to build the driver modules myself but I dont have enough knowledge to build one from scratch so will have to use a design that is already available. One problem I have is that there are no local electronic stores where I live, apart from Maplins, they are stupidly expensive and dont really have a lot of components apart from "day to day" components. This means having to order parts and wait each time I need to make a change.
    I cant test out my 5210 modules, according to the datasheet they need an aluminium capacitor 4700uF / 50V (the rating for the 5210 is 44V) and I dont have one. Maplins have a 4700uF 35V standard elecetorliytic in stock, would this be ok since the maximum I will be using is 32V from the printer power supply, or even the 19V from the laptop supply for now if 32V is too much - just to see if I can get it running any better - perhaps I ought to look at power first and then go back to the driver ?


  7. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    The Supply demand is found once u know how much the total number of motor u have running simultaneously.

    What type of stepper do you have for ur CNC?

    I have Nema23 motors, they are around 300oz. My supply max is 24V @ 15 amps. This is the axis supply only.

    My Drivers are based on Allegro's TB6560AHQ
  8. shortbus

    AAC Fanatic!

    Sep 30, 2009
    The pac-sci 5210 is also what I'm using. The cap is for making a power supply from a standard transformer and bridge rectifier. If your using a power supply from a printer/laptop the supply cap shouldn't be needed for testing.

    The driver just needs a pulse for stepping and a high or low (5V or 0V) for direction, again for testing. So you won't even have to hook up your computer for testing, just make a 555 timer circuit for the pulses.

    For actually running all three axis on the machine a switching power supply like you printer/laptop supply isn't usually desirable. They (pac-sci) and other driver manufacturers want a non-switching supply.

    Do you know about sites like CNCZone.com? I see your from th UK, I think they have a big CNC site there too, but theres a lot of UK members on CNCZone.com .
  9. eggplant

    Thread Starter New Member

    Feb 19, 2011
    Thanks again for the replies. I am making slow but sure progress (albeit sideways as much as forwards!)

    After some basic tests with the 5210, the L298 as people suggested is officially now out of this project. I do have another use for one though so the time, effort and expense experimenting with them hasnt been wasted, and I have learned stuff too which is good.

    They certainly do ! I had a small cpu heatsink on it and it still got hot so it ended up with a fan on too.

    You have 15A for one axis ! Am I missing something, does it require 15A, i would have thought about 4A at the most.

    The motors I have are Nema 23's, 263 oz. The rated current is 2.8A

    Does this rating mean 2.8A for each coil or 2.8A total? The 5210 driver without changing anything has a rating of 2A, again is this for each output or the total? Is runnning a 2.8A stepper from a 2A driver going to cause problems or will it (as Im assuming) simply run at less than it is capable of. The 5210 can be increased to 3A which I will do if need be.

    As you can probably guess, Im still a little confused about the ratings etc, I have read a lot about stppers/drivers but I still seem to be missing the basics somehow !

    Great news, I tested using the exact same setup as with the L298, the motor ran much smoother/quieter and I also got it to run faster. I can now get about 170 RPM and with some very basic acceleration I got to about 190 RPM with the 32V supply (rated at 1.5A only). This still seems slow, what sort of speeds do you get from your setup and with what power/motor?

    I am going to make a 555 board as you suggest. There are a few times I have needed a pulse for other things so it makes sense to have one rather than use the pc or arduino each time.

    The power supplies I have been using are just for testing, I am looking into a power supply that will power all 3 axis once I figure out what sort of spec it will need to be. I have an old audio amp somewhere, maybe I could use parts from that, if not then I may have to buy a power supply as I doubt I will have the components needed to make one, I do have loads of computer PSU's handy but thats about all.

    Thanks, I came accross it a few times whilst searching for info. An overload of information ! I will be reading through and most likely joining the forum.

    Thanks again

  10. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    15A is for all the axis with a marginal value to limit the supply from producing too much heat. I like my stuff to run cooler even though it may be overkill.