Pages: [1] 2   Go Down
Author Topic: Arduino Stepper Shield  (Read 5275 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hiya all!

I made a post in a different forum about an idea i have for an arduino shield.  (see here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1189567413)

To bring you up to speed, I decided to use the L297 / L298 combo to drive the stepper motors.  In the setup I'm trying to do, each motor will have 2 wire control: direction and step.  Full/half stepping will be selected by a jumper, and the vref is controlled by a potentiometer.

Here is the datasheet I've been working off of that details about how to use the circuit: http://www.st.com/stonline/books/pdf/docs/1334.pdf

I've read through it a few times, but I still have a couple questions:

1. on L297 pin 3 (home) what do i connect this to?  can i leave it unconnected?  i dont think i need to know when its at home. datasheet says: Open collector output that indicates when the L297 is in its initial
state (ABCD = 0101).
The transistor is open when this signal is active.

2. on L297 pin 1 (sync) do i connect this to the other L297's on the board?  i'm a bit hazy on what it means to sync them.  one of the main uses i have in mind for the stepper shield is to control a 3 axis CNC machine / 3D printer.  i'm guessing i'm supposed to connect them, but i'm just not sure. datasheet says: Output of the on-chip chopper oscillator.
The SYNC connections The SYNC connections of all L297s to be
synchronized are connected together and the oscillator
components are omitted on all but one. If an external clock source
is used it is injected at this terminal.


3. on L297 pin 20 (reset) i dont think i'm going to use this.  do i leave it unconnected?  connect it to ground?  vcc? data sheet says: Reset input. An active low pulse on this input restores the
translator to the home position (state 1, ABCD = 0101).

4. is the potentiometer wired up correctly?  also, what is the value i should use for it?  i specified 10K, but somewhere else i saw they used 2K.  any suggestions?

5. on L297 pin 10 (enable) i want the stuff to always be on.  i hooked this directly up to vcc.  is this the right way?  is there any reason why i would want to have the arduino control it?

6. are there any things you see that might be wrong about the design?  this is my first time in Eagle, although i've spent alot of time in kicad.

I dont know how to attach files to the forum (or if you even can), so heres the link where you can download it: http://www.osotite.com/stepper-shield.sch

Thanks in advance guys!
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

anyone out there?  even if you just answer one of my questions, i'd be grateful.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Hiya all!

I made a post in a different forum about an idea i have for an arduino shield.  (see here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1189567413)

To bring you up to speed, I decided to use the L297 / L298 combo to drive the stepper motors.  In the setup I'm trying to do, each motor will have 2 wire control: direction and step.  Full/half stepping will be selected by a jumper, and the vref is controlled by a potentiometer.

Here is the datasheet I've been working off of that details about how to use the circuit: http://www.st.com/stonline/books/pdf/docs/1334.pdf

I've read through it a few times, but I still have a couple questions:

1. on L297 pin 3 (home) what do i connect this to?  can i leave it unconnected?  i dont think i need to know when its at home. datasheet says: Open collector output that indicates when the L297 is in its initial
state (ABCD = 0101).
The transistor is open when this signal is active.

2. on L297 pin 1 (sync) do i connect this to the other L297's on the board?  i'm a bit hazy on what it means to sync them.  one of the main uses i have in mind for the stepper shield is to control a 3 axis CNC machine / 3D printer.  i'm guessing i'm supposed to connect them, but i'm just not sure. datasheet says: Output of the on-chip chopper oscillator.
The SYNC connections The SYNC connections of all L297s to be
synchronized are connected together and the oscillator
components are omitted on all but one. If an external clock source
is used it is injected at this terminal.


3. on L297 pin 20 (reset) i dont think i'm going to use this.  do i leave it unconnected?  connect it to ground?  vcc? data sheet says: Reset input. An active low pulse on this input restores the
translator to the home position (state 1, ABCD = 0101).

4. is the potentiometer wired up correctly?  also, what is the value i should use for it?  i specified 10K, but somewhere else i saw they used 2K.  any suggestions?

5. on L297 pin 10 (enable) i want the stuff to always be on.  i hooked this directly up to vcc.  is this the right way?  is there any reason why i would want to have the arduino control it?

6. are there any things you see that might be wrong about the design?  this is my first time in Eagle, although i've spent alot of time in kicad.

I dont know how to attach files to the forum (or if you even can), so heres the link where you can download it: http://www.osotite.com/stepper-shield.sch

Thanks in advance guys!

I did some research and here are the answers I cam up with to my questions.  I'm somewhat confident in them, but please let me know if you notice any mistakes.

1. i'm just leaving the home pin unconnected.  i dont need it.
2. i'm connecting all the sync lines together.  i found a circuit someone had made for a 3 axis machine (which is what I want this for...) and he had them all connected.
3. i added a 10k resistor inline with it to Vcc.
4. i'm going to use a 1k pot.  hopefully this is the right value.
5. added a 10k ohm resistor in series to Vcc.
6. i sure would love it if someone looked over my design... i'm going to upload version 2, you can download it here:

you can download it here: http://www.osotite.com/stepper-shield-v2.sch

there are a few things i still need to do:

* add molex power connector for 12v in.
* add 7805 power circuit to create Vcc
* add analog header so one can use the unused analog arduino pins (0-6)

any other suggestions of things to add to this board?  input is welcome.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

I did some research and here are the answers I cam up with to my questions.  I'm somewhat confident in them, but please let me know if you notice any mistakes.

1. i'm just leaving the home pin unconnected.  i dont need it.
2. i'm connecting all the sync lines together.  i found a circuit someone had made for a 3 axis machine (which is what I want this for...) and he had them all connected.
3. i added a 10k resistor inline with it to Vcc.
4. i'm going to use a 1k pot.  hopefully this is the right value.
5. added a 10k ohm resistor in series to Vcc.
6. i sure would love it if someone looked over my design... i'm going to upload version 2, you can download it here:

you can download it here: http://www.osotite.com/stepper-shield-v2.sch

there are a few things i still need to do:

* add molex power connector for 12v in.
* add 7805 power circuit to create Vcc
* add analog header so one can use the unused analog arduino pins (0-6)

any other suggestions of things to add to this board?  input is welcome.

okay, well i've put the finishing touches on the board and put it into subversion. you can check it out here:  http://reprap.svn.sourceforge.net/svnroot/reprap/trunk/users/hoeken/arduino-stepper-controller/

i'm not a newbie, but i'm also definitely not a pro.  i'd love to get some feedback on this circuit before i blow $100 to order boards and build it.  even a 'yeah, that looks right' would be nice.  thanks arduino crew. =)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd love to reply if I had the knowledge, but alas I am a newbie  :'(

I will however take a look at it and if I can make any suggestions or such I will, I think it is great that someone is making a Stepper shield.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks great.  I have a few small suggestions from the interface / software point of view, but I've asked the rest of the team (that knows more about hardware than I do) to take a look too.  Again, I think this could be a great Arduino shield, and we'd like to work with you to get it made.  

Did you consider putting two of the limit switches onto the pins with external interrupts (2 and 3)?  That could allow a more fail-safe stop.  Maybe the limits for the Z-axis, since doing only X or Y seems somewhat asymmetric?

What about making it possible to set all three steppers to half or full steps from a single digital pin of the Arduino, with the ability to override them individually with the jumpers?  

Other than that, it looks good to me (with my limited knowledge of electronics).  

Any thoughts on the layout?



Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It looks great.  I have a few small suggestions from the interface / software point of view, but I've asked the rest of the team (that knows more about hardware than I do) to take a look too.  Again, I think this could be a great Arduino shield, and we'd like to work with you to get it made.  

Did you consider putting two of the limit switches onto the pins with external interrupts (2 and 3)?  That could allow a more fail-safe stop.  Maybe the limits for the Z-axis, since doing only X or Y seems somewhat asymmetric?

What about making it possible to set all three steppers to half or full steps from a single digital pin of the Arduino, with the ability to override them individually with the jumpers?

Other than that, it looks good to me (with my limited knowledge of electronics).  

Any thoughts on the layout?


thanks!  i'd love to get some input from the hardware guys.  i've looked around on the net, and found quite a few l297/298 based designs and copied the best parts from each that i could find.  i'm starting to feel really good about this design.  i think its going to be awesome.

i hadn't actually looked into interrupt stuff much.  i had assumed that you could do it on all pins.  i guess you cant, so i'll re-arrange that so those 2 pins have limit switches on then instead of motor control.  i think that having the x and y min switches be on the interrupt would be the best idea (one common use of the x/y minimum switches is to 'home' or calibrate the axes to a zero point.  having hardware interrupts on those would be a good failsafe.)

as for being able to set it to full/half steps with arduino, it would be nice... but unless we moved the limit switches to analog, we dont have any pins left.  for each motor we have: direction, step, min and max.  with 3 steppers thats 12 pins.  we need tx/rx for serial communication, and that leaves all the pins as taken.  i've played with the limit switches, and its possible to do them as analog, but having half as analog and half as digital makes the software a PITA as well.

also, theres not much of a need to switch between full/half in software.  you might need to switch for testing to see what works best for you, but once you know, then you'll generally just want to use that all the time.  if anything, it would be nice to control the enable/reset/vref settings from software, but they aren't super important either.  vref is controlled by a trimpot, and you will only really need to tune that once for your specific motors.  enable isnt a major requirement, because from what i gather, the choppers make it so the motors dont overheat if they are not moving, but with torque applied (ie what happens when enable is tied to high, but you arent stepping your steppers)  the reset is really not needed, as it basically just resets the internal counter to 0, and we dont use the internal counter.

i'm not an electrical engineer, but i've done quite a bit of research about this type of circuit so i think the above assumptions are correct. if they aren't, someone please point it out!!

as for the layout, i'm not sure yet.  obviously it has to be a shield, but i'll probably just copy the layout style from other stepper boards.  i do know i'd like to get the L298N chips all in a row so you could use a strip of aluminum as heatsink, but thats pretty minor.
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

@Hoeken, I already have several versions of a stepper shield PCB, I'll post them in the next few days under CC so you can use them.
You might find that using the L297 makes the board very expensive, it's about $9 per chip. At that rate your board will cost about $75 in parts; If you want ohters to use your design, you might want to be aware that you can get a non-arduino commercial solution for les than that.

If you want to include driver logic, you would be much better off using an Atmega168 programmed in Arduino ( 4$) to generate the stepper pulses, rather than than three $9 chips. I don't know why that driver is so expensive, but with a single Atmega generating the control pulses,  you could serially control each shield.

Daniel
« Last Edit: September 20, 2007, 01:21:49 pm by Daniel » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Daniel,

I'm looking forward to hearing from you - especially on how to control motors (I have two of them) with the atmega chip!

Thank you.

Peter
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

hi Peter

the Atmega driver idea is just a suggestion...you have to design it yourself! My shield uses the Arduino to generate control logic signals for the L298.

D
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
@Hoeken, I already have several versions of a stepper shield PCB, I'll post them in the next few days under CC so you can use them.
You might find that using the L297 makes the board very expensive, it's about $9 per chip. At that rate your board will cost about $75 in parts; If you want ohters to use your design, you might want to be aware that you can get a non-arduino commercial solution for les than that.

If you want to include driver logic, you would be much better off using an Atmega168 programmed in Arduino ( 4$) to generate the stepper pulses, rather than than three $9 chips. I don't know why that driver is so expensive, but with a single Atmega generating the control pulses,  you could serially control each shield.

Daniel

Hey Daniel,

Thanks, I'd love to look at those designs.  Hopefully we can come up with something that does what I want it to do, and is also useful for the rest of the community.  The L297 is a bit pricey, but you can find it at decent prices.  Jameco has it for $5.00: http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=288067

Also, I've looked up commercial 3 axis boards that use the L297/L298 combo and they generally run about $150, so this kit would still be cheaper.  If I got it manufactured, it would still be competitive, and probably less than that as I'd be doing it under the not-for-profit RRRF corp. see: http://www.xylotex.com/3axBoard.htm and http://www.technologicalarts.ca/catalog/product_info.php?products_id=251

As for using an atmega, one of the reasons i've read about using the L297 is because it gives you the 'chopper' style stepper driving by sensing the voltage through the coils, and adjusting it appropriately.  this gives you the best possible performance for your steppers, as well as making controls super simple (step/direction).  Also, I'm not much of an electronics person and the L297/L298 combo is *very* well documented, as well as tested.  I'm intending to use this board as a base for the RepRap project, so I'd prefer to go with something tried and true.  Also, I'd rather not have to write more firmware than i have to to drive the steppers... the L297 just does it all for me.

The open source part is also a big deal to me.  Sure there might be commercial systems, but the stepper controller is the core of the RepRap system, and having that core be open source and modifiable is very important.  I'm sure you folks at Arduino can understand smiley-wink

Finally, I really like the idea of an arduino shield, because once you build/buy the board, then you just insert it into the arduino board, and you're ready to go.  having that full solution, ready to plug and play makes it very attractive.  alot of the people involved in this project aren't especially electronically savvy, so it would be nice to have that packaged solution ready to go.  for example, we have materials engineers who might be playing with different materials, or mechanical engineers playing with different positioning systems, and to be able to provide them with a solid 3 axis stepper driver would be awesome. Especially if its combined with the excellent Adruino programming environment.

This is all really exciting.  I can't wait until I have the first board in my hands!!
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

hey

that's all very cool. I will post my files in the next  days; they're licensed CC-BY-SA, so you can manufacture them if you want. Eventually I will post the gerbers, parts list and supplier info too. All open smiley

My design is stacking, so you can put as many shields as you want on top of each other... theoretically you could have a stack of eight motor shields without any problems.  

Sorry I don't have the time to help you with your design, but maybe these files will give you some ideas!

Another price item you might want to check out are the Schottky diodes: you'll need 24 of them, and they are not cheap: count on 50 cents each in small quantities. You have to buy in quantity 500 or 100 to get a good price.

I think you could do the Atmega instead of L297 route quite easily, using the Analog in pins (2 for each motor) to watch the motor current and calculate the chopping.  In fact it seems like the Atmega 168 has pretty much the same functions as the L297, except that it's programmable and the code can be open-sourced if you go that route.  

D


PS: BTW I am not one of the folks "at Arduino".... smiley I guess you haven't read the threads under the news section!
I'm one of the folks at Freeduino smiley-grin
« Last Edit: September 20, 2007, 03:32:06 pm by Daniel » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
hey

that's all very cool. I will post my files in the next  days; they're licensed CC-BY-SA, so you can manufacture them if you want. Eventually I will post the gerbers, parts list and suppliers info too.

My design is stacking, so you can put as many shields as you want on top of each other... theoretically you could have a stack of eight motor shields without any problems.  

Sorry I don't have the time to help you with your design, but maybe these files will give you some ideas!

Another price item you might want to check out are the Schottky diodes: you'll need 24 of them, and they are not cheap: count on 50 cents each in small quantities. You have to buy in quantity 500 or 100 to get a good price.

I think you could do the Atmega instead of L297 route quite easily, using the Analog in pins (2 for each motor) to watch the motor current and calculate the chopping.  In fact it seems like the Atmega 168 has pretty much the same functions as the L297, except that it's programmable and the code can be open-sourced if you go that route.  

D


PS: BTW I am not one of the folks "at Arduino".... smiley I guess you haven't read the threads under the news section!
I'm one of the folks at Freeduino smiley-grin

fantastic!  i'll keep my eyes peeled.  i also feel the manufacturability is important for open source hardware.  i've read a bit of that discussion, but i prefer to keep out of things like that.  i do agree with you on quite a few things though =)

stacking is good.  with my 3 axis design, i'm not sure what use it would be... all the pins are taken.  i am bringing out headers for the remaining pins though.

no worries on the help... your suggestions are good, and looking at other designs is also good, as it helps me to see any errors i might have made by comparing them.

yeah, there are a couple expensive parts in the circuit, but any way you slice it you have to pay a decent amount to get good quality stepper drivers.  i'll be doing a full price analysis once i get the board design finalized, which i will definitely post here once its done.  i think that this route is a good enough compromise between cost and quality for me.

~Zach
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

try Future electronics for the L298's....

The Schottky's can be cheap ones if you don't foresee large motors.

You really might want to investigate the Atmega solution; in a sense it just means that instead of plugging into the Arduino baord itself to get the control signals, you put the Arduino chip on the stepper shield itself.

With the L297 you need enable, dir and step pins for each motor (9 Arduino pins), all of which could be boiled down to one pin: Serial RX.   That makes your Arduino relatively free to do other things. The L297 code is not that big of a deal.

D

PS: what is the license on your files?
« Last Edit: September 20, 2007, 03:37:34 pm by Daniel » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
try Future electronics for the L298's....

The Schottky's can be cheap ones if you don't foresee large motors.

You really might want to investigate the Atmega solution; in a sense it just means that instead of plugging into the Arduino baord itself to get the control signals, you put the Arduino chip on the stepper shield itself.

With the L297 you need enable, dir and step pins for each motor (9 Arduino pins), all of which could be boiled down to one pin: Serial RX.   That makes your Arduino relatively free to do other things. The L297 code is not that big of a deal.

D

PS: what is the license on your files?

i've been using www.octopart.com for part lookups... they give a nice overview of prices.

unfortunately i just dont know enough at this point to attempt the Atmega solution, but maybe i'll look at that for round 2.  this is really a side project, and i dont want to get too side tracked, or go off on some exploratory path.  i want to go with a known-good solution that is guaranteed to work.  the l297/l298 does that exactly.  i appreciate the suggestion though.

the license we've been using so far for reprap stuff is GPL, which i think serves us well.  as long as the design remains free, we think you should be able to do whatever you want with it.  if you want to manufacture it, great.  all we ask is that any changes you make, you contribute back to the project.  it worked for linux, and i think it will work for us.  thats what this design is/will be licensed under.
Logged

Pages: [1] 2   Go Up
Jump to: