Stepper Help - Electronics Forums

Author Topic: Stepper Help  (Read 3490 times)

wikiwiggs

  • Trusted Member
  • *
  • Posts: 7
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Stepper Help
« on: January 05, 2013, 03:42:09 PM »
I don't know if this is the most relevant place to post this, so please forgive me if this is not the ideal location.
I stumbled across your schematic on YouTube, and it led me here to your site.
Here's the link so you know what I'm referring to.
http://elabz.com/driving-a-bipolar-stepper-motor-with-arduino-and-uln2803ag/#more-362

I am a complete beginner in the electronics realm of things, and this being said have really struggled trying to get "Bi-Polar" Stepper motors running properly.
It seems to me, that this site is very active, and responsive, and I like that!!!

I spent some frustrating hours trying to run my motor off of my own design I made from some NPN Transistors (Sounds like one of your other comments from Kiran).
In this previous design everything seemed to work OK on low power (Arduino UNO 5V output), but of course this was without any usable torque on a much larger motor a friend let me borrow.
This motor was rated at 12V 1A, and figuring I could use an ATX 12V PC Power Supply, my results ended with burning up some of my NPN Transistors.

After implementing your design, I see some flaws in my own, but to take the corrective action to get my stuff working, I'm not confident in the corrective action that I think I need to take.

My only thought is that I would need a 12W (This seems massive) 12 Ohm resistor per leg of the coil... Is this correct???

Here's a basic diagram of my design without any resistors or diodes.
Since the image is awaiting approval, here's a link to it.
http://wikiwiggs.web44.net/mystepperdesign.html

I've implemented the Bi-Polar driver based on the ULN2803A that you came up with, and I have to say that this was an easy to implement, after I saw your video, I went to mouser and purchased 10 of these chips, I just got them last night and was able to get a small motor running - Thank you.

As far as personal "style" goes, I like to figure out what I'm dealing with, in order that I am hopefully able to have a little bit of "gut-feel" when I'm doing something wrong.
So before I implemented your design using this chip, I spent some time poking around YouTube trying to find out more about the ULN2803A.
I found one that helped clarify to me what was really going on:

My conclusion was that these ULN Transistor arrays on it's simplest level can be thought of as a single NOT Gate per channel.
It helped me get confident, and I partially implemented your schematic design (only because of lack of time).
I left out the user buttons & LED's to control and indicate direction, instead I just changed my code on the Arduino side to see that I had control.

I used an old floppy stepper that I had in my arsenal as to hopefully match what you used on the video.
I since broke off a soldered connection (poor handling on my part), and used a stepper that I had ripped out of a scanner bed.
This motor worked in the same circuit design although it is rated at 8 ohms, the ¼ Watt 22 Ohm resistors provided enough pass through to let it at least step appropriately.

Thanks for the help, and thanks for awesome work & willingness to share it.
« Last Edit: January 05, 2013, 03:54:22 PM by wikiwiggs »

Electronics Forums

Stepper Help
« on: January 05, 2013, 03:42:09 PM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 151
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Stepper Help
« Reply #1 on: January 05, 2013, 05:41:05 PM »
Thanks for your kind words, wikiwiggs. The purpose of that post was a proof of a concept rather than any practical application of the ULN2803 chip to driving a bipolar stepper (4 wires).  This chip is commonly used with unipolar steppers (ones with center of all windings connected to the outside - 5 wires and more) and I just wanted to see if I can make a bipolar motor move using a ULN, whatever it takes. I would certainly not recommend using a setup that's designed to waste 50% of it's power intake on just heating resistors and not making any useful work for any permanent application. Sorry you bought 10 ULNs based on info from my post :) - you're better off not using them for your bipolar steppers but saving then for when you get a unipolar one or use ULNs with LED display projects, DC motors and anything else that requires amplification of the the microcontroller output by providing a current between positive voltage rail and the ground. In other words, ULNs are great when you need to sink current (i.e. your load is connected to the +5V on its other end and you need to connect it to ground to control it) but they are not much use when you need both sink and source (connect to positive rail) the same load, which is what's needed for a bipolar stepper. 

There are certainly much better ways of controlling a bipolar stepper - using half-H driver ICs such as SN754410 (also very common though not as common as ULN) or even specialized stepper driver ICs such as Allegro A3967 which I'm writing about here: http://elabz.com/worlds-smallest-stepper-motor-with-arduino-and-easydriver/.

I will be posting another schematics soon, based on SN754410.

Anyhow, perhaps you can describe what you're going to be using the steppers for, and I could recommend a better way to control it.

Cheers!

wikiwiggs

  • Trusted Member
  • *
  • Posts: 7
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Stepper Help
« Reply #2 on: January 05, 2013, 08:36:55 PM »
I'm guessing that in my application of things, that I would use a minimum of the 12v 1A motor.
I have been tinkering around using all sorts of stuff to try and drive it at the ideal power.

The problem with all of this is, is that I get a little confused with how to do that.
My basic understanding of "the basics" are where I get stuck, and it seems as if maybe your design was a confirmation of my gut feel.

If I have a coil inside my stepper that is rated @ 12V 1A
then the Ω's = 12

If I use the power equation W = V * A
Then my resistors would need to be 12Ω @ 12W !!!

This seems a little nuts to me, and to be honest I'm a little scared to mess with that kind of power too much

So experimenting with this motor without a good understanding of how the power is acting, I'm having trouble getting past the basics.

I would like to ultimately build a 4/5/8 axis CNC.
I know that there are commercial drivers out there, and that they have the cooler features, but like I said, it is my personal style to try and understand what's going on before I use it.

That way if it all breaks down, I want to know how to fix it, hack it, modify it etc...

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 151
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Stepper Help
« Reply #3 on: January 05, 2013, 09:26:12 PM »
Well, that's why you should not use the ULN2803s with bipolar steppers for any application where any serious power is needed. CNC is certainly one of those applications. There are few other finer details to driving a stepper for a CNC rig, and I think you should take a closer look at either specialized CNC controllers or a set of EasyDriver boards (if you're fine with 750mA current limit they allow) - one for each stepper/axis.

As far as understanding the basics, which exact motor you will be using? Bipolar steppers are very commonly used in CNC but I just wanted to be sure.

Arduino site has schematics for driving bipolar steppers with Arduino, and one is based on the SN754410 chip I posted about earlier, it's a great place to start from:  http://arduino.cc/en/Reference/StepperBipolarCircuit

wikiwiggs

  • Trusted Member
  • *
  • Posts: 7
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Stepper Help
« Reply #4 on: January 07, 2013, 11:39:43 PM »
I'm definitely interested in all of this!!!
I'm struggling to figure out practical power sources, and after thinking about your inquiry a little bit, I have to modify my answer a little bit.

I'm getting like 8 of these: Minebea "Astrosyn" #17BB-H132-11
They have a 1/4" threaded shaft sticking out of them, so I'm hoping to quickly couple them to a 1/4" threaded rod for easy linear motion application.

These motors seem small, and seem that they will work with (less swapping resistors) this design, I'm OK with working on the small scale (on the cheap) to get mockup designs proven.
In other words, there is definitely no need to apologize about me purchasing ten of these ICs. ;D

I consider it a challenge to maybe at some point put these motors into a worm gear configuration, and see how much torque I can really get out of them. I know this will sacrifice my speed, but it sounds like a great Z-Axis opportunity for both linear & rotational movement; where my speeds don't have to be that great.

At this point I'm still trying to figure out a decent power source for playing/mockup sake.
These motors seem to be rated at 12V @ 75Ω.
Given the law would make my draw = .16A
& given my Wattage = 1.92W

I was considering these for the resistors:
http://shop.vetcosurplus.com/catalog/product_info.php?products_id=8610&osCsid=g7s2ojbhtq1lvns2q53epljhm5 @ $0.99 a pop

Approx. $8.00 + Tax & Shipping

Motors:
http://www.allelectronics.com/make-a-store/item/SMT-102/STEPPER-MOTOR-W/SCREW-MECHANISM/1.html @ $2.75 a pop

$22.00 + Tax & Shipping

ULN2803A * 10 including Tax + Shipping = 15.00

Add a power supply, and a couple of lead screws and a few more components (gears/pullys/etc..) it seems like I'll be able to prove a lot.

After proving the small stuff, I'm cool with going to the Dual H-Bridge chips, and the bigger motors, but I have to see what these small ones can do.

I'm struggling to find much if any info on these motors.
It would be nice to know the step °, but I'm cool with waiting until they show up to see.

I'm thinking that I may want to also add into the mix of all of this some voltage regulators, but I don't want to experiment too much on the power side of things, as this seems to be the largest unknown, and safety factor in all of this.

Could you offer any help here?
Thanks for your responses.

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 151
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Stepper Help
« Reply #5 on: January 08, 2013, 02:16:46 AM »
I'm getting like 8 of these: Minebea "Astrosyn" #17BB-H132-11
They have a 1/4" threaded shaft sticking out of them, so I'm hoping to quickly couple them to a 1/4" threaded rod for easy linear motion application.
These are nice little motors. @ 12V/160mA they are not very powerful but CNC is a big word -  bunch of things can be included into this definition and they would be appropriate for an application that has no force opposing to the movement of the piece (or the tool). Laser cutter, for example, can be done with these easily. Slow laser cutter, mind you. The 1/4" threaded rod - you may want to step it down because typical 1/4"-20 thread is 20 turns per an inch and these motors look like they have at 40 steps per revolution (I may be mistaken but I had similar design motors that were 40SPR) and therefore your positioning accuracy will be only  1/800"  i.e. 31 micron - A-OK for small work but not that accurate. Also, the smaller the steps the lower the torque needed to move the machine, so these motors would appreciate if you come down to a 8-32 or 10-32 threaded rod - almost twice the accuracy and less torque needed. Be sure to use rolled threaded rod (smooth), not coarse.

Still, get the SN754410 chips - one per motor - I'll come back from a short trip and post a schematics and the software to control those, hopefully in a couple days.

And last but not least - 8-axis CNC?  This sounds like a lot of movement, most people are content with only 3  ;)  A free-forming milling machine made of a robot with a mill at the end  of the arm and a turntable would have less degrees of movement (6 or 7), why so ambitious? I'm just curious what kind of parts you are planning to make on the machine.

Cheers!

wikiwiggs

  • Trusted Member
  • *
  • Posts: 7
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Stepper Help
« Reply #6 on: January 27, 2013, 05:48:56 PM »
Thanks for the reply, sorry, my hard drive took a crash, therefore, its been a little while before I could get back to things.

I'm definitely interested in these drivers, but I'm awaiting your schematics, and power source comments.

As for the little motors, I've got them in, and have got them a few of them moving, using the ULN2803, but as you said, really slow.

All of the resistors are what I don't have at this point, so again coming from my lack of understanding of how the driver chips play a role in all of this, I'm curious to know what your schematic(s) come up with.

<SIDE NOTE>
In the mean while, I've played with some really cool stuff.
As per your recommendations that the ULN2803's are good for LED applications, I've picked up a grab bag of various LEDs yesterday, and been primarily messing around with a 5x7 matrix.

I got my arduino diplaying text messages already!
And I've got my UNO storing the whole alphabet.
Now onto getting the letters to scroll, and messing around with shift registers to pair up the other four 5x7's that came with it.
</SIDENOTE>

As for going 8 axis, I was dreaming up a very complicated foam hotwire machine.
The small motors seem like they may be a pretty good fit here, because the load is the weight of the wire (at least for four of the axis'), and as long as I go slow enough the foam won't provide enough tension to stop them (hopefully speaking of course).

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 151
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Stepper Help
« Reply #7 on: February 09, 2013, 01:02:31 AM »
Sorry, this time I missed your post which went unnoticed by me for a couple of weeks. Good news though is that in the interim I was able to finally re-install the schematics software I drew the stepper controlled diagram in (gEDA/gSchem)  and export the diagram (see the attachment).

This one is based on SN754410, as I said before, and it is configured slightly unusually because I needed two stepper motors to work in tandem moving one axis (long story about that here) . It would be trivial to change the schematics from 2-Axis, 3 motors to a more conventional 3-Axis, 3 motors CNC controller. Please note that this version is designed for LinuxCNC CNC software but I had it also run with slight variation from RepRap CNC software as well.

I guess what I'm trying to say is that the circuit needs a bit of work to adapt to your needs but should give you an idea of the parts needed for using small bipolar stepper motors for CNC. I'm still planning to  clean it up a bit and release both LinuxCND and RepRap versions. But while I'm dragging my feet  :) I thought you could use what's already available.

Please note that the Atmega328P chip used in the controller is not an actual Arduino - it's used as just a stand-alone MCU. A slightly cheaper Atmega8 could do the job, too, I just didn't have it one hand at the time. But I did use the Arduino IDE as the development environment to write, compile and load the software into the chip. So, that's what the Arduino sketch is - the firmware for the MCU, you'll just need a programmer (Arduino UNO itself can work as a programmer) to load  it into the chip.

I hope you had fun playing with the 5x7 LED matrices - my favorite type of LED display. Actually, anything that has LEDs in it is my favorite, I guess I just like shiny things ...  :)

If you have any questions about the CNC controller, do not hesitate to ask either here or start a new thread.

wikiwiggs

  • Trusted Member
  • *
  • Posts: 7
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Stepper Help
« Reply #8 on: February 09, 2013, 03:21:01 AM »
So here's what I did in the mean time awaiting your schematics.
I purchased (5) pololu a4988's and (3) 68 oz./in 400 Steps / 360° (0.9° / Step) Motors from Sparkfun.  I have to say that I love the simplicity of these drivers, however I will try and get my hands on your H-Bridges sometime soon to emulate your circuit. After all, yours is about half the cost on this end of things.

I did notice that you are going after the smaller motors on these, would it be any issue going larger like I did?

The only thing that I forgot on mine was to order some heat sinks to drive these motors the way they were designed, but I'm pretty satisfied with the fact, that with a little bit of heat sinking I'll do be able to drive these motors pretty effectively.

I used some thick vacuum hose like what would be used on cars/trucks and some small hose clamps to couple my motor shaft (5mm Dia.) to a 5/16" - 18 tpi threaded rod. I placed two skateboard bearings at each end, and now all I have to do is mount the motor and rod to some hardware to make this a usable machine.

I did notice that I was running pretty slow, however I used the delayMicroseconds() function and brought the high step to 500 micro sec., and the low delay to 250 micro sec.
This worked pretty good. In other words it didn't seem like I was missing any steps, as I was moving the distances expected. The next steps here are to introduce a 4:1 gear ratio, and increase the voltage. I'm currently using a wall wart at 12v, but these drivers are rated up to 35v.

Some quick notes for anyone else that may find these a4988 drivers useful as well:

These do have thermal lockout protection, if they heat up above acceptable operating temperature, they will cause the motor to act super funny. The lockout kicks on and off pretty fast, so in other words they definitely deserve a heat sink. To solve this for myself, I gave the factory pot setting roughly a 45° turn counter clockwise to limit more of the current running through, and at the expense of a whole lot of torque they ran seemingly perfect.

I also found a source for heat sinks that would seem to work for these chips.
While there you might want to get some thermally conductive adhesive tape to make the install of the heatsinks easier, they sell a lot of them with the tape already on the heatsink.
All the stuff on their site is extremely reasonable for cost, although I have not ordered from them, and can't tell you the cost of shipping, or their worthiness as a true source. So until I get to the point of trying them out, DO NOT take my word for it that these guys are truly what they claim to be. I really hope they are though :-X
http://www.moddiy.com/

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 151
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Stepper Help
« Reply #9 on: February 09, 2013, 06:18:18 PM »
So here's what I did in the mean time awaiting your schematics.
I purchased (5) pololu a4988's and (3) 68 oz./in 400 Steps / 360° (0.9° / Step) Motors from Sparkfun.  I have to say that I love the simplicity of these drivers, however I will try and get my hands on your H-Bridges sometime soon to emulate your circuit. After all, yours is about half the cost on this end of things.

Thanks for the update! The newer A4988 drivers are nice, and I have actually started that project using specialized drivers myself, though different, older chips: A3967.  I would have stayed with them except I've noticed that they do cut power to something like 70% in the microstepping mode and, since I was dealing with already underpowered steppers, I thought using "raw" control, so to speak, would help me with positioning accuracy. That perceived advantage did not materialize but in the end I had a controlled built on much cheaper parts, as you've noticed.   Depending one where you get your parts (China->eBay->me), you can make it for 1/5th of the cost of specialized chips on carrier boards.

I did notice that you are going after the smaller motors on these, would it be any issue going larger like I did?

That's exactly true - if I were controlling those 68oz/in torque NEMA17 steppers, I would have preferred the specialized chips and would not build my own controller. Besides, the SN754410 chips cannot pull 1.7A per phase needed for your stepper. Actually, I'd say a 68oz/in is one heck of a stepper for what you need it for, you might as well lower the voltage/current to save wear and tear on both the machine you build and the controller.

The only thing that I forgot on mine was to order some heat sinks to drive these motors the way they were designed, but I'm pretty satisfied with the fact, that with a little bit of heat sinking I'll do be able to drive these motors pretty effectively.
Wouldn't need heat sinks most likely if you run it at 1/4th of the max amperage and don't make the controller hold position for too long (i.e. be sure to use M30/M0 code at the end of each CAD file and wire it properly to disable the A4988s as soon as the movement ends.

I used some thick vacuum hose like what would be used on cars/trucks and some small hose clamps to couple my motor shaft (5mm Dia.) to a 5/16" - 18 tpi threaded rod. I placed two skateboard bearings at each end, and now all I have to do is mount the motor and rod to some hardware to make this a usable machine.
Hoses make great couplers but they will eventually give out, so buy some spider couplers in advance - $5-$8 on eBay, three-four weeks wait to arrive from Far East.

I did notice that I was running pretty slow, however I used the delayMicroseconds() function and brought the high step to 500 micro sec., and the low delay to 250 micro sec.
This worked pretty good. In other words it didn't seem like I was missing any steps, as I was moving the distances expected. The next steps here are to introduce a 4:1 gear ratio, and increase the voltage. I'm currently using a wall wart at 12v, but these drivers are rated up to 35v.

The 18tpi rod coupled with a 400SPR stepper would be an incredibly accurate machine for what you're trying to do: 400*18 = 0.000138889 in per step (0.0035 mm per step) - given that the nichrome wire melts slots at least 50% wider than itself (or even worse than that) , you are coming up at 100+ times more accurate than you actually need to be :)  It's definitely not a bad thing, just saying that there's absolutely no reason to mess with 4:1 gearbox you've mentioned. Also, such fine steps are the reason you're moving so slow. I would run your controllers at half step, not more fine than that - it's softer than full step  (less vibration) and yet still almost full power so you won't be missing steps.

Some quick notes for anyone else that may find these a4988 drivers useful as well:

These do have thermal lockout protection, if they heat up above acceptable operating temperature, they will cause the motor to act super funny. The lockout kicks on and off pretty fast, so in other words they definitely deserve a heat sink. To solve this for myself, I gave the factory pot setting roughly a 45° turn counter clockwise to limit more of the current running through, and at the expense of a whole lot of torque they ran seemingly perfect.

I also found a source for heat sinks that would seem to work for these chips.
While there you might want to get some thermally conductive adhesive tape to make the install of the heatsinks easier, they sell a lot of them with the tape already on the heatsink.
All the stuff on their site is extremely reasonable for cost, although I have not ordered from them, and can't tell you the cost of shipping, or their worthiness as a true source. So until I get to the point of trying them out, DO NOT take my word for it that these guys are truly what they claim to be. I really hope they are though :-X
http://www.moddiy.com/

Like I said, with careful power management, you probably won't need heatsinks. But if you already have them, they are never making anything worse, so put them on :)

Please keep me posted, I am intrigued by your project - I am mulling over a project in my head that involves cutting wings and other surfaces for smaller RC planes out of thin foamed polystyrene sheets with a low power laser, but this may or may not work, so hot wire may actually be the way to go. So, please keep me posted!

Cheers!

 

Related Topics

  Subject / Started by Replies Last post
14 Replies
3498 Views
Last post February 25, 2013, 12:24:16 PM
by ElectroNick