L297 stepper motor controller

hi jonathan

  1. The 5v cominoug from arduino when connected to the USB are supplied from the computer. this means that if you overload it you risk damaging the computer (altough it's a very remote risk)
    Whenever you plan to power anything bigger than a couple of LED use an external power supply. Anyway motors (unless tiny) should not be powered from the regulated 5V supply but should use the unregulated voltage supplied to the board (this usually floats between 7.5 and 9v)

  2. Going from memory the OSC pin determines the PWM frequency used to drive the motors. if you change those values you change the pwm freq.

  3. a trimpot is a potentiometre that can be adjusted with a screwdriver. connect one end of the trimpot to 5v, the other end to ground and the pin in the middle to vref. tweak until the motor runs smoothly

  4. You can use it with unipolars. you'll have to hook up the motor in a different way. (look http://www.st.com/stonline/products/literature/an/1734.pdf here for details)

you can drive the 298 directly from arduino if you dont need any of the sofisticated features it has.

for simple circuits a nice L293D (D not E or B) has power drivers and diodes integrated.. you can see a circuit here http://www.potemkin.org/cms/Pid/StepperMotor

massimo

for power, you need a separate supply (in the manufacturer's schematic they specify 36V, but I uses 12V/2A), and from this suply you can just drop in a 5V regulator for the L297, an LM78L05 or a LM7805 will work fine. As Massimo says, you shouldn't load the Arduino with anything more than a few milliamps! The driver will draw such large currents that connecting it's power suply to the Arduino's risks passing the power supply transients back to the Arduino.

Thanks guys!

I'm getting closer to actually trying to build this thing! Just a few more questions.....

I'm gonna start with this circuit....

I have a few simple questions....

1. Daniel - you recommended a 12V/2A power supply. I can only find basic AC adapters at maximum 1.2A. Could you give me a link to one like you recommend?? - I just didn't look properly - Forget this stupid question!

  1. The diagram suggests using the L6210 which is a '2 schottky bridge motor controller'. This seems to be discontinued. Would you recommend another IC or is it cheaper to use seperate diodes?? Daniel suggested Schottky diodes. Can you give me a part number?? I have found so many different diodes. I don't understand how to select the appropriate one. Also, maybe I'm confused, but I was thinking, can I use the l293d instead of the L6210??

  2. Daniel - you wrote 'Use an onboard regulator (7805) to provide nice clean power to the L297, and lots of bypass capacitors'. Does this mean that I need to use some capacitors with the 7805 or are they included inside the 7805?? If i do need to use the 7805 with some external capacitors, how do I wire it up??

  3. Very simple one... Does 'Rs1Rs2=0.5ohms' mean that both resistors should equal 0.5 Ohms or that the total resistance of Rs1 and Rs2 should equal 0.5ohms??

Thanks for helping out a slow learning electronics geek wanabe! / Jonathan

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.