Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Stepper Motors for Dummies  (Read 3433 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

So we got this project for uni but me and all of my group members are mechanical engineers, not electrical. As a result we know nothing about what were doing with the arduino or motors except for a few basics. We've been doing research about how to connect motors up and managed to get normal DC motors connected and turning on and off (though without any speed/power signals, just on/off). We were then told that these are unreliable and therefore should use stepper motors.

What.The.

The only ones available to us immediately are these

http://www.jaycar.com.au/productView.asp?ID=YM2754&keywords=stepper+motor&form=KEYWORD

and we have no clue how to connect them to the arduino and a power supply or how/what signals to send. Did more research. It seems that all the information on how to use these involves heavy electrical lingo that we just don't understand.

We were wondering if anyone can refer us to a simple, step by step tutorial for this? If not can someone help us out?

At the moment we have two motors, one to drive the robot and the other to steer it. We'll probably need stepper motors for both.

Thank youuuuu.
Logged

0
Offline Offline
Shannon Member
****
Karma: 226
Posts: 12963
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That motor seems to be a standard 12V unipolar motor, perhaps 6 wire? - they don't give a pin-out for the connector which means you will have to use a multimeter to work out how the windings are connected.

Have you seen: http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors/ ?
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
God Member
*****
Karma: 4
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We were then told that these are unreliable and therefore should use stepper motors.

"Unreliable" how? If all you're doing is driving a vehicle forward, a DC motor is fine. If you need precise control in position, then a stepper motor is better, but for general locomotion, a stepper is actually worse, because you have to tune the step rate to the load/speed of the vehicle.
There are also servos. As mechanical engineers, you probably should know about those :-) Servos are motors with additional encoders that tell you exactly how they're currently rotated, so you can get a very good reading on what's "actually" going on. The simplest form of servo is the "hobby servo" that turns +/-90 degrees or so and is used for remote control toys, but industrial servos can rotate arbitrary amounts and keep giving you good readings.

For a stepper motor, you need a "cadence." It's all about magnetics. Assuming you know how a magnet-with-coils motor works, think of stepper motors as one set of up/down coils, and one set of right/left coils (for a permanent magnet/axle going hither/yon.) Now, to spin the magnet, you want to energize the coils so that the magnet rotates first straight up, then 45 degrees clockwise, then 90 degrees clockwise, then 135 degrees clockwise, ...
You create this cadence by outputting to windings A (up/down) and B (right/left):
A: +, B: 0 == top
A: +, B: + == 45 degrees
A: 0, B: + == 90 degrees
A: -, B: + == 135 degrees
A: -, B: 0 == 180 degrees
A: -, B: - == 225 degrees
A: 0, B: - == 270 degrees
A: +, B: - == 315 degrees
As long as you run the motor through each of those states in turn, with some appropriate delay between each to compensate for inertia/speed, your motor will run smoothly. I e, to go from 90 degrees to 225 degrees, clockwise, you have to run the motor through the states 90, 135, 180, 225, with a small pause (several milliseconds, typically) between each transition.

Internally, the stepper motor actually has what amounts to many little magnets offset by a few degrees, which is why you get hundreds of steps per turn, instead of just 8 -- divide the degrees in the table with the appropriate factor for the motor's resolution.
Also, if you want "full torque" at all times, you want both windings to always be energized, which means that you drop four of the eight steps (called the half-steps) -- you end up with the 45, 135, 225, 315 degree entries from that table.
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1026
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's some info on a stepper controller I am still creating using an ATtiny2313 chip. I originally developed the code on my Arduino.

http://arduino.cc/forum/index.php/topic,84809.0.html

Each 2313 controls 1 axis - has a Step and Direction input. 4 outputs for the 4 motor phases. I hooked mine to 4 HRFB(N60A FETS to drive the motor. Those FETs are good fo 9 Amps so they might be overkill. Each driver could be built for approx $15US.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're not supplying much info - does the robot need to run at different speeds? How fast/slow? How would you control it (make adjustments while moving)?  I don't know why DC motors are unreliable...but they can't be precisely controlled like steppers can (so maybe that is what was meant). If resistance is altered the current alters in inverse proportion affecting the motor speed - but that won't be at all precise. It would certainly cause a car to accelerate. A servo would be useful for instance for steering where you only want the motor to move through a fixed range.

Steppers are high precision - common steps are 200 per rev and they can be microstepped - but I would use something like an Arduino/Easydriver (http://www.schmalzhaus.com/EasyDriver) combination with a bipolar stepper. That can give you accuracy of 1600 steps per rev - with precise timing. Good for things like CNC rigs - but you seem to be driving something that doesn't need any of that.

DC motor = unlimited range, not precise
Servo motor = limited range, precise
Stepper motor = unlimited range, precise
Logged

0
Offline Offline
Shannon Member
****
Karma: 226
Posts: 12963
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A bit further on stepper motors - broadly speaking there are two classes of stepper, ones designed to be driven from a fixed voltage and ones designed for fixed current drive.

The former are often unipolar and have relatively high resistance (10 to 30 ohms) and high inductance windings.  They also generate a large back-EMF so that the step speed is limited by the drop-off in drive as the back-EMF approaches the supply voltage, perhaps at as low a speed as  200rpm.  Such motors are often rated by voltage and current of the windings, such as 12V, 0.15A.  They are the simplest steppers to use but don't go particularly fast (and the torque drops off with speed).

The later type are typified by having low winding resistance (an ohm or two), say perhaps 1.5ohm and 2.2A rating. Thus for a fixed voltage drive you'd be limited to 3.3V (impractical).  These motors are designed to be driven from a _high voltage_ supply via a "chopper" or "switching" constant-current regulator drive module.  The high voltage supply means large back-EMFs are comfortably handled (so very high speeds possible), and constant-current regulation preserves torque at high speeds.  Using a chopper/switching regulation system means high efficiency (so that 2.2A motor might only take 0.4A from a 24V supply at low speeds, yet the windings get the full 2.2A.   Such motors are typically 4-wire bipolar motors, and often the rating is given as current and resistance (the voltage is not the important parameter).  The motivation for this kind of motor is high speed operation at high torque - for instance a CNC drive train.

In practice you find a nice driver module for such a motor like the Pololu A4988: http://www.pololu.com/catalog/product/1182
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys thanks for the input!

I bought that stepper motor and tried hooking it up as per this website:

http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors/

I was wondering if you could help me clarify a few things. Firstly, the stepper motor has 5 wires coming out of it. The sequence that it requires according to the data sheet is this:

Pin | Colour | ccw <-----------------> cw | Phase
-------------------------------------------------------
  1 | Orange|      |      |   +   |  +  |     | /B
  2 | Purple |      | +    | +     |     |     | /A
  3 | Yellow | +   | +    |       |      |  + | B
  4 | Blue    | +   |       |       |  +  |  + | A
  5 |
  6 | White | +    |   + |    +  |  +  |  +  | COM

Now this is slightly different to what that website had. So my questions are as follows.

(side questions that i guess doesnt really matter: what does the "phase" column mean? whats the "/A" and "A" thingies?)

If I'm using the diagram for a uni-polar stepper motor (which it is) then firstly, where does the power supply to the motor connect to? doe the positive terminal connect to the WHITE wire, and the negative terminal to the Darlington Array "COM" pin?

Secondly, if i use the exact same code that was written at the end of that page, are all the wire connections in that diagram correct for me? I know the code was written for a bi-polar motor and that I would have to add the other two pins to the code, but otherwise is it correct? If not, what do i ave to change for the wiring/code? Can my motor even be used in both directions??

And lastly, the darlington array is perfectly symmetrical and am not sure what its orientation is, as in which side is input and which is output... any idea?

Sorryyyyyyyyyyyyyyyyy for all of this but (i think this is clear) i have no idea what any of this isssss!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, ive just tried connecting everything up... I'll tell you exactly how i connected it.

The four wires (orange purple yellow blue) are connected to the one side of the Darlington array pins. The arduino pins 8-11 are connected to the Darlington Array pins opposite that of the motors. The 12V power supply is connected with the positive terminal to the white wire of the motor and the negative terminal is connected to the ground of the darlington array. Aside from that the arduino has its own power supply to it.

Now, the motor just wiggles and jitters, not really turning. Ive changed the arduino code so that the steps per revolution is 48 (as per the motor).

Any suggestions?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok turns out the problem was that the motor was sitting with its centre pin on the table so it wasn't allowing it to turn.

Now to the next problem, the motor and the darlington array seem to gain heat when i turn it on. the motor doesnt seem to turn properly either- i tell it to take 48 steps but it seems to take just over it (which is just inaccurate). any ideas now?

Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1026
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Things are heating up because current is flowing.

Working with just a battery - connect the white wire to + and then in sequence touch Orange, Purple, Yellow, Blue to the battery -. You might need to repeat this sequence several times, but when you do this does the motor move the same direction for each step? If so then it is wired correctly. How fast are you trying to step? start out slow and then go aster. If you step too fast for your setup the motor will just hum or buzz. Check your output sequence with LEDs and resistors to make sure the sequence is correct.

Make sure the motor works the way you think it works before worrying about the program. If you have 2 phases swapped the motor will not step properly.

Are you using a stepper library or are you writing your own code?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Stepper Library works perfectly with this motor.

However, the Arduino wiring diagram is different.

It needs to be wired in this order to work. (assuming your using the same digital pins 8,9,10,11)

Ardiuno to the ULN2003(an) Darlington Array

pin 8 > 1
pin 9 > 2
pin 10 > 3
pin 11 > 4

ULN2003(an) Darlignton Array to YM2754 Stepper Motor

pin 16 -> Blue     (phase A)
pin 15 -> Purple  (phase /A)
pin 14 -> Yellow  (phase B)
pin 13 -> Orange (phase /B)

Power / GND: ULN2003(an) Darlington Array / YM2754 and Arduino

COM -> 12v supply @ 1.1 amps maximum
COM -> White, YM2754 Stepper

GND -> GND 12v Supply
GND -> GND Arduino


Overheating and other problems to avoid.

The YM2754 is designed to only receive 1.1 amps, anything more than this will cause the temperature in the YM2754 to rise over its intended operating temperature (around 80 degrees C). This is because a stepper motor even when idle has a holding current running through it. This serves one of two purposes. 1: To provide a holding torque while idle 2: Have current on tap to move the motor.
If you are going supply the motor with a power supply that's got more to give, then you need some sort of current limiting circuit in front of the Darlignton Array to reduce the current down to no more than 1.1 amps.

Programming:  These motors are really only designed to have a maximum step speed of 400 in the stepper library. As they only have 48 steps there isn't really much precision for detailed movements, but its enough for some basic movement projects.

If you get 'jitter' especially running the MotorKnob sketch, you dial this out by removing precision from the analogue read variable.

This should hopefully help people who have the same issues smiley

enjoy
« Last Edit: March 03, 2013, 02:55:07 am by hybrid_nz » Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: