Chapter 2 - Tools
CNC - Stepper Motors
Stepper Motor Control Circuits
I have finally reached a point that I think I understand the different types of stepper motors, variable reluctance, permanent magnet unipolar and bipolar motors and have even have an idea about some of the hybrid stepper motors out there. But how do you make them run? What kind of electronics are used to make the whirr into life? This section will describe some methods to the madness as well as point you to some areas of the Internet that I have found some control circuits.
One thing I want to make clear before I start is that I am focussing on permanent magnet unipolar stepper motors. This is not because I prefer them over all the other types, but rather because those are the type that I have most easily got my hands on when scrapping old printers.
Stepper Motor Control Circuits
I will be focusing on unipolar motors in this section, but I will also try to place links to controllers and circuits for bipolar motors as well.
Stepping a Stepper Motor
As you may recall from the STEPPER MOTOR research section, a stepper motor is run by sending a sequence of pulses to each coil in the motor causing it to jog or step in one direction or another. The direction is dependant on the order that you energise the coils. The are three basic ways you can send these pulses to the coils these are Full Stepping with one coil, full stepping with two coils, and half stepping. (I need to make a distinction here. There is a term used when full stepping with one or two coils but I cannot remember them off the top of my head. When I find them or if I recall them I will update this part of the page. Suffice it to say though that when you full step the motor with two coils, that you get much more torque from the motor because you have the magnetic field of the coils to hold the rotor in place.)
Full Stepping With One Coil - In the table below you will notice each coil in the motor. These are labeled as Θ1, Θ2, etc. The values listed below these are either a 0 or a 1. 0 means that no power is applied to the coil and a 1 means that power is applied to the coil. Each row of the table represents time. If you look at the table you see that on the first row (time period) that the first coil is energized and the other three coils are off. During the next time period you see the first coil has been shut off while the second has been turned on. This causes the rotor to move one position. If each time period we de-energize the coil and energize the next coil we can make the motor turn. When we reach line five we simply start the pattern over again. This process will full step a motor using one coil.
This type of control can be set up a number of ways from using stepper motor control ICs to using simple logic. One that comes to mind is a 2 bit binary counter made from JK Flip Flops and some decode logic for each phase. This can be done like below:
(Image of single step circuit here.)
Full Stepping With Two Coils - The table below describes how a motor is stepped using two coils. The table set up is the same as above with the coils listed at the top and each row representing time. The only difference is that two adjacent coils are energized.
The above circuit can be implemented with XOR gates and JK Flip Flops. The circuit shown below was the first discreet component circuit I found on the internet and I have prototyped it on some protoboards. I used this circuit to drive some 2N2222 transistors to run a floppy drive motor, and it works.
(Pic of xor jk circuit here)
A couple of things should be noted about single stepping a stepper motor. When single stepping you limit that maximum speed at which a motor can run. It will reach a point that it will miss steps and not perform. I understand this to be cause from two things, one has to do with the motor and the frequency it is running at. (I do not pretend to understand this) The other is that the faster you cycle the coils the less time each coil has to build up a magnetic charge or stated another way, the coil does not rise to its full current value before it is switched off. Because of this the faster the motor runs the more torque it will lose, to the point that there is not enough magnetic force to move the rotor to the next position. (This can be overcome by driving the motor at a higher than rated voltage, but more on this later.) And the second problem you encounter with full stepping the motor is that it is subject to jerky starts and stops. (This is caused as I see it from the number of steps the motor has per revolution. Obviously, the fewer the steps the more jerky the motor will be.) This can be overcome by half stepping, 1/4 stepping, 1/8 stepping, etc.
Half Stepping a Stepper Motor - When you full step with a single coil the rotor moves to point to the coil that is energized. When you switch to the next coil, the rotor moves to face that coil. When you full step with two coils the rotor move to point between the two coils that are energized. Again, when you de-energize the first coil and energize the third coil the rotor moves to point between coils two and three. If you were to conceptually overlay these two methods you end up with the table you see below. To help visualize this, you will notice that the 1st, 3rd, 5th, 7th and 9th rows look just like the first table above and the 2nd, 4th, 6th and 8th rows look just like the second table listed above. So to expand on the rotor movement description above we find the when coil one is energised the rotor points to coil one, then in the next time cycle (row 2) we leave coil one on and turn on coil two, this causes the rotor to move and point between coils one and two, then the next time cycle (row three) we turn off coil one and leave coil two on. This causes the rotor to point to coil two. You can work your way down the table like this. The end result is that the rotor points to twice as many locations as it makes one revolution. So if I had a stepper motor that would make 200 step per revolution while single stepping, I would expect it to make 400 steps (double) by making it half step.
There are gains to be had by running your motor this way. Because a coil is energised a little longer it has time to build up a larger magnetic field and allow you to run it at higher speeds before you lose torque and start missing steps. The second advantage is that you can get smoother starts and stops because we double the resolution (steps per revolution) of the motor.
There are many ICs available to perform this function. These ICs usually have two inputs. One for a stepping pulse and another line for the direction. These ICs can be emulated with basic counters and decoders if one was inclined to do so. The second circuit I built was like this. I used a 74x193 four bit counter with a 74x138 decoder and coupled it with some basic logic to create the sequence above. You can see the schematic below:
(Counter Decoder driver circuit here)
Stay Tuned - More to come!
After doing some reading here and there on the internet, I discovered that stepper motors run these CNC machine. Hmmm... OK well it sounds to me like I need to figure out what a stepper motor is and how they work. Where do you get them? Do you have to buy them? Can they be salvaged from something else? There I go again with the questions. Let's see what we can make of the stepper motor mess.
Before I start on this topic I want to remind you that there is a lot of information on this topic on the Internet and I strongly recommend that you take some time and look at it. Please do not take what I have to say as law. I could have it all wrong. I will give a resource of information on this project as I discover it in the resource section of this project.
Located in the resource section of this project, you will find a link to the control of stepper motors by Douglas Jones. This document can explain more about stepper motors than I could ever hope to convey on my own on the types available and how they operate. I would suggest reading that document. It is very informative and well written.
Types of Stepper Motors - Unlike normal AC or DC motors, stepper motors have many wires attached to them. These wires are used to run (or more accurately, step) the motor. Stepper motors come in two basic types. These are permanent magnet and variable reluctance. You can generally tell the two apart by turning the shaft of the motor. If it has noticeable step or cogs the motor is likely to be of the permanent magnet type. Of these two types of motors, I have only played with the permanent magnet motors.
Permanent Magnet Stepper Motors - Permanent magnet stepper motors usually have two coils in them. These coils can be with or without center taps. If the coils have center taps then they are an unipolar motor and if they are two separate coils without center taps they are bipolar stepper motors. The bipolar motors typically have four wires. Unipolar motors usually have either five or six wires. The number is determined based on the center taps. Some center taps are tied together therefore giving five leads others, the center taps are separate and give you six leads. I have only used unipolar motors at this time.
How to step the motor. Unlike a regular motor, a stepper motor will not run by simply applying power to the leads and throwing a switch. Stepper motors run by sequentially energizing the coils that make up the motor. There are two basic methods to do this. Either half stepping or whole stepping. A great example of this can be found in the resource section by going to Jone's Stepper Motor page. I see no need to reinvent the wheel here unless the good info drops off the net.
Where to find stepper motors. For the experimenter, stepper motors can be found pretty easily. Some places to look for them are old 5-1/4" floppy drives, printers, copiers, some xray equipment, etc. New stepper motors can be bought from Hobby CNC and other places around the net. At this time I have found or salvaged about 15 stepper motors. Most very small and not suitable for a CNC, but I figure they can be used for learning purposes.
Stepper Motor Characteristics - Stepper motors come in a bunch of different sizes and a few different shapes. So I think I should address what makes a motor suitable for a project and what does not. The two main characteristic I think you need to look at are (DEG/Step) or (Steps/Revolution) and how much the holding power of the motor is. The holding power is usually expressed as oz-in.
Steps per Revolution - Stepper motors move a certain amount of distance for each step they make. If the stepper motor takes 30 steps to make one revolution, then that motor is 30 Steps per Revolution. The steps per revolution can be expressed as a degree per step by dividing 360 by the number of steps in one revolution. In our above example 360 / 30 = 12 degrees per step. Generally speaking, the more steps/rev the finer control you can develop from the stepper motor. For example, a 30 Step/Rev motor coupled directly to a 16 TPI lead screw will advance the table or work .002" per step. While a stepper motor of 200 steps/rev would advance it .00003" per step. You can see how the number of steps per revolution could impact your project. Now if your stepper motor is not of a high enough step resolution don't worry just yet. You can double the steps in a motor by half stepping and if I have read sources correctly, you can even get them finer by micro-stepping.
Holding Power - Stepper motors are rated by how much pressure it takes to force them to move from a location when the coils are energised. This measurement is in ounce inches. Obviously, the higher this number the more holding power the motor has. For cutting foam I would guess that you would want a motor of at least 50 - 75 ounce inches. This may be wrong and could require more. At this time I have not really looked deep into this motor characteristic to fully understand what it means.
Now that we know a little something about what a stepper motor is, it is time to figure out what leads are what. After all, of all the stepper motors I have found, only three of them were marked. I have a couple of 5-1/4" floppy drive motors that I am going to use as a learning tool. See Bench Experiment 1 to learn how to identify the leads on a stepper motor.