L297 stepper motor controller

Hi Jonathon,

in terms of the power supply current, the bigger the better, but of course this all depends on the size of motor(s) you will use.

Forget the "IC Bridge" diodes... just use discrete ones. In the diagram they call them 'fast diodes' which is synonymous with Schottky diodes. Try one of these Digikey part numbers, it's not very critical: SR305DICT-ND or SR306DICT-ND.

Basically any Schottky diode with a 50V voltage rating and a 2 or 3 amp current rating will do the trick. The bigger the motor, the bigger the power supply. If you can solder SMT parts, then you can get a package with all the diodes in it, see "Schottky barrier diode arrays" in the curent Digikey catalog.

For the regulator you need the old standby circuit for the 7805... see the diagram here:
http://www.tigoe.net/pcomp/img/7805-w-motor.jpg

which is part of an excellent explanation of motor controls done by ITP at NYU:
http://www.tigoe.net/pcomp/labs/lab-motors.shtml

Throw in a few extra 100uF capacitors on both sides of the regulator, just to be safe.

In my stepper driver, I used .47ohm power resistors for RS1 and RS2... they are there to sense the current flow int he motor windings. Two one-ohm 1/2 watt resistors in parallel for each one will do the trick.

Sounds like you aren't an electronics newbie anymore, you're doing great!

Daniel -> 'Throw in a few extra 100uF capacitors on both sides of the regulator, just to be safe.'

hmmm.... Like this ??

(which reminds me... what apps do you use for your schematics and PCBs?? I found tinyCAD and freePCB - Should I try something else?? Now back to the topic....)

What I don't understand is... what is the point of the 5V / 9V Power output pins on the Arduino board?? If i remember correctly, when arduino is powered by an external supply (ie not USB), the 9V pin actually outputs the same voltage as the supply voltage. So, if I run arduino on a 12V power supply, don't I get the clean 5V and unregulated 12V that i need?

hello jonathan

For schematic diagrams I recommend Eagle Cad. you can find it on http://www.cadsoft.de . there is a free edition that works up to 100mm x 80mm of pcb (on the schematic side there are virtually no limitations)

When I need to make beautiful schematic diagrams I use eagle, export into EPS and open it in illustrator. do a select all, change the font to a nice one and I get a print ready schematic.

BTW Arduino is designed always on Eagle.

going back to your circuit.

What you need around a 7805 is just 2 capacitors per side. 100n to clean up higher frequency noise and an electrolitic capacitor of 100uF or more that is used for compensating voltage fluctuactions.
when your motor starts there is a power surge and the voltage generally drops. the large capacitors compensate for this by releasing the "energy" they have "stored".

massimo

Thanks Massimo!

just to be sure.... like this?

Also, i'm still wondering....

what is the use of the 5V / 9V Power output pins on the Arduino board?? If i remember correctly, when arduino is powered by an external supply (ie not USB), the 9V pin actually outputs the same voltage as the supply voltage. So, if I run arduino on a 12V power supply, don't I get the clean 5V and unregulated 12V that i need?

Regards / Jonathan

Jonathon:

I think Massimo is in Sweden and I am in Canada, near the pacific, so here is part two of your international answer!

In terms of the 12V motor supply and the clean 5v supply, the answer lies with the motor. When a stepper motor turns on, it draws large amounts of current into its windings. A small motor could draw 10 amps for a few milliseconds, for example. These large current draws make the supply voltage drop, unless your power supply can handle it.

Supply voltage drops are bad news for microprocessors! This is why the two supplies are always best spearated: never run any inductive load from the same supply as the microprocessor. You are asking for unpredictable trouble if you do.

Another reason for separating the supplies is to prevent noise from getting back into the microprocessor. Motors and inductors put out a large voltage spike when their fields collapse, and you don't want this to get back into the microprocessor supply, so you use a separate supply.

The general rules are:

  • try not to drive anything with an arduino pin that draws more than a few milliamps- say 10ma or so.
  • try not to drive large loads that source their current from the arduino's regulator, as this might interfere with the stability of the Atmega8's power supplies.
    -never drive an inductive load that sources it's current from the processor power supply! Use a separate supply.

Hope this helps!

Daniel

PS: the larger the filter cap on the motor side of the regulator, the better: there really isn't a limit, but in practice anything up to 470uF on the 12V side would be reasonable. You can add as much as you want.

Daniel

Massimo is in milan , the capital of design :slight_smile:

I subscribe to everything you wrote in the post.

I guess the stuff we wrote here could be turned into a nice article for the website.

massimo

Well, I've certainly been finding both of your advice very helpful! so i would second that motion!

I'm planning to breadboard the circuit very soon, so I will post some pictures of that, and the final schematic that I use. After this, I intend to make a circuit using the l297 and the ULN2075B to control a unipolar stepper.

Also I have a nice working circuit that uses a TTL 74194 shift counter as the transalator. I'll post some picures of that too (under a different topic). I'm interested to compile a group of circuits to control both unipolar and bipolar steppers, that offer a range of price vs functionality options.

Just for the record...

Jonathan is in London, the capital of rain and tea!

(and i changed my user name to 'flat stanley' for those who remember my 'little accident' just after the London workshop!)

I just checked the farnell site for the l298 and it is listed as no longer stocked?????

Any idea why that might be?? I'm worried that these chips are on their way to retirement!!

Is there some other setup which I should be investigating??

any advice would be nice!

jonathan

any advice would be nice!

Jonathon,

It's probably not stocked anymore since Europe is going RoHS compliant, and it's not compliant.

Try this: usually a nice email to the local sales rep will get you three or four samples. Offer to credit them in your next show. Failing that, I believe the chip is still widely available in North America: try this!

PS: it is stocked somewhere in Europe, as the price at this place is in Euro's, five of them...
http://www.bmm-electronics.com/Product.asp?Product_ID=746

Well, its been about 3 weeks since my last post on this thread and by now I should have got a working L297/8 circuit. However, the reality of live, with a job and a family, has meant no electronics fun for 3 weeks and zero progress.

However, I have managed to buy the ICs and now I have a little time i've met my first problem >>> the L298 doesn't fit onto a breadboard. Looking on the data sheet, it is described as a 15 lead Multiwatt package.

Is there an easy way to fit this IC to the b/b?? Or do I need to go some other way??

Thanks as always / Jonathan

Is there an easy way to fit this IC to the b/b??

You are best to skip the breadboard and go straight to a hard-wired version, since there is a lot of power and noise floating around, and the chip has to be heatsinked in any case.

On a perf-board, put pins 1,3,5,7... in one row, and then put pins 2,4,6,8... in the row behind it. A little tricky, but it works. Some pin-bending required.

Once things slow down on my end I will design a stepper driver PCB for it that fits on the Arduino... unless someone else wants to in the meantime? I have the working design with schematics.

Daniel

Hi: this one is a miser solution, but works: I've used an IDE wire (cut it and use each extreme to connect to each file of pins) to put one L298 and one 7805 into a CPU heat sink+fan cooler. It hasn't heatsink grease or mica (I think it's bad).

Thanks for this great post (please, post the schemas ;)!!). Btw. someone could explain how connect the L297 to a darlington for unipolars (or two L297 plus one ULN28003)??

Regards:

Nach.

There is a schematic for using the L297 with a unipolar motor on the L297 application notes pdf (not the datasheet).....

http://www.st.com/stonline/products/literature/an/1734.pdf

its page 15, fig 22.

It involves a darlington array, 4 protection diodes and 4 AND gates.

I'm planning to try it once I get the L297/L298 working together nicely.

Allegro have some new ICs out for controlling unipolar steppers that do the job of the L297 and the darlington array in one chip. I contacted my local sales rep and got some free samples. I haven't tried them yet though. (i'm old fashioned, so I like to learn how to do things the hard way before I use the shortcuts!)

http://www.allegromicro.com/sf/97052/


Regarding heatsinking the L298.... If you plan to step your motor slowly, for instance just a few steps per second, will the IC still need sinking?? How hot does that guy get anyway??

Thanks Jonathan.
Massimo point out that application note in this post too. But after read that little paragraph and look its illustration I can't take anything. It looks like a marvelous egyptian hieroglyphic.
For example: before all the points on this post about bipolars (additions and diferences from the datasheet), is valid the rest of the circuit [L297+L298] with the described ULN2075B? Does It need corrections? But if I want chopping (I want chopping)... what can I do? How can I do it with the ULN28003 (for two axis driver)?

It's very hard and frustrating... After my first toast-session (one unlucky SN74LS158N) I take it carefully.

Yes, just readed your other post I wrote to the ST and they ask me to local dealers. I mailed one local dealer past week but I'm still waiting for a response :'(.

Nach.

owd: I love your 3d diagram of the Arduino board. Did you make it? Can you post a copy of the original files so we can use it to make more diagrams?

Mellis, now you can say "I met Gollum": No! No! It's mineee! My ownnn! My preciousss!
Obviously it's a bad joke: I'll send you (next time, I don't have the files here).

Nach.

hey all:

I was just rummaging through some boxes and found one of my L297/298 stepper motor drivers. It's about ten years old, and still works like a charm. In fact, I regularly throw it across the room when teaching electronics classes, to demonstrate how simple designs can also be reliable and rugged.

Here's a (terrible) pic taken with my laptop camera, showing the driver unit with the cover removed:

The case is Hammond 1590B diecast aluminum. In the pic you can see the L298 screwed to the case at the top for heatsinking, DB9 connectors at the bottom and left for input signals and motor connnections, and the motor protection diodes. There's also a 7805 in the middle to provide internal voltage regulation, and two large power resistors for the L298 current sensing. There are also blobs of epoxy and hot glue on all the hardware, since a loose screw inside something once cost me thousands of dollars and a couple of plane flights to fix it. The whole unit is about one inch by two inches by four inches.

The schematic for this is exactly the same as the one on page 14 of the ST datasheet, with the addition of an LM7805 regulator for the power, a few caps and a reverse-polarity diode.

Jonathan, hope this will help with your UK version!

Daniel

and one more fabulous laptop photo, showing it with the lid on, ready for throwing.

I'm back!! - after 10 days holiday in Prague! and feeling fully recharged by tons of beef and dumplings!

Daniel - thanks for the pictures!! :wink:

So, some more questions....

  1. As discussed earlier, the schematic on the datasheet has loads of capacitors and some more are needed for the 7805. I can see what capacitance I need but I don't know what kind of capacitors to use?? does it matter??

  2. You are using perf board, right?? This is probably a real dumb question, but how do you use perfboard?? Do you just solder wires on the bottom of the board?? Please share any perf board tips or advice!!

The schematic for this is exactly the same as the one on page 14 of the ST datasheet, with the addition of an LM7805 regulator for the power, a few caps and a reverse-polarity diode.

are the extra caps just the ones required for the 7805 and what is the reverse polarity diode doing??

Thanks a million / Jonathan