Silicon ChipA quick primer on stepper motors - January 2019 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: It's getting hard to avoid tiny SMDs
  4. Feature: From body parts to houses: the latest in 3D Printing by Dr David Maddison
  5. Project: DAB+ Tuner with FM & AM and a touchscreen interface! by Duraid Madina & Nicholas Vinen
  6. Feature: A quick primer on stepper motors by Jim Rowe
  7. Project: ATtiny816 Breakout and Development Board with capacitive touch by Tim Blythman
  8. Product Showcase
  9. Serviceman's Log: Chasing wild geese isn't as fun as it sounds by Dave Thompson
  10. Subscriptions
  11. Project: Zero Risk Serial Link by Tim Blythman
  12. Review: “CircuitMaker” PCB software. It’s FREE! by Tim Blythman
  13. Project: The PicoPi Pro Robot by Bao Smith
  14. Vintage Radio: 1958 Stromberg-Carlson Baby Grand Radio by Associate Professor Graham Parslow
  15. PartShop
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: USB digital and SPI interface board, November 2018; GPS-synched Frequency Reference, October-November 2018; Automatic Reverse Loop Controller, October 2012

This is only a preview of the January 2019 issue of Silicon Chip.

You can view 40 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "DAB+ Tuner with FM & AM and a touchscreen interface!":
  • DAB+/FM/AM Radio main PCB [06112181] (AUD $15.00)
  • Dual Horizontal PCB-mounting RCA sockets (white/red) [RCA-210] (Component, AUD $2.50)
  • PCB-mount right-angle SMA socket (Component, AUD $3.00)
  • 465mm extendable VHF whip antenna with SMA connector (Component, AUD $10.00)
  • 700mm extendable VHF whip antenna with SMA connector (Component, AUD $15.00)
  • PCB-mount right-angle PAL socket (Component, AUD $5.00)
  • Short Form Kit for the Micromite Plus Explore 100 (Component, AUD $75.00)
  • Case pieces for the DAB+/FM/AM Tuner (PCB, AUD $20.00)
  • Firmware (BAS and HEX) files for the DAB+/FM/AM Radio project (Software, Free)
  • DAB+/FM/AM Radio main PCB pattern (PDF download) [06112181 RevC] (Free)
Articles in this series:
  • DAB+ Tuner with FM & AM and a touchscreen interface! (January 2019)
  • DAB+ Tuner with FM & AM and a touchscreen interface! (January 2019)
  • Build-it-yourself DAB+/FM/AM radio (February 2019)
  • Build-it-yourself DAB+/FM/AM radio (February 2019)
  • Our new DAB+ Tuner with FM and AM – Part 3 (March 2019)
  • Our new DAB+ Tuner with FM and AM – Part 3 (March 2019)
Items relevant to "ATtiny816 Breakout and Development Board with capacitive touch":
  • ATtiny816 Development/Breakout Board PCB [24110181] (AUD $5.00)
  • ATtiny816-SFR programmed for the ATtiny816 Development/Breakout Board [2411018A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Software for the ATtiny816 Development/Breakout Board [2411018A.HEX] (Free)
  • ATtiny816 Development/Breakout Board PCB pattern (PDF download) [24110181] (Free)
Items relevant to "Zero Risk Serial Link":
  • Isolated Serial Link PCB [24107181] (AUD $5.00)
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (Component, AUD $5.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (clone version) (Component, AUD $3.00)
  • Isolated Serial Link PCB pattern (PDF download) [24107181] (Free)
Items relevant to "The PicoPi Pro Robot":
  • Sample programs for the PicoKit PicoPi Pro line-following robot (Software, Free)

Purchase a printed copy of this issue for $10.00.

A quick primer on Stepper Stepper Motors Motors by Jim Rowe Stepper motors are used in all kinds of electromechanical devices including hard disk drives, CD players, CD/DVD/Blu-ray drives and players, plotters, engraving machines, laser cutters and printers (including 3D printers). This article explains how they work and how to use them. A stepper motor or stepping motor is essentially a brushless DC motor that’s designed to rotate its shaft in discrete steps rather than continuously. Each step is made in response to a sequence of current pulses fed through adjacent pairs of electromagnet coils, with each pair wound on opposite sides of the stator assembly. If no further pulses are applied, the rotor will remain in the new position but if another sequence of pulses is applied, it will make a further step. And if further pulse sequences are applied, it will continue stepping. A significant advantage of stepper motors is that they can be made to rotate the rotor shaft through a defined angle without the need for positional feedback. As a result, they are often used in “open-loop” control systems, where the position of an object like a printer head needs to be accurately controlled but without requiring the added cost of a full-scale closed-loop servo system. Another advantage of stepper motors is that they can be made to rotate the rotor in either direction by merely changing the pulse sequence fed to the pairs of stator coil windings. They 38 Silicon Chip have a fair bit of torque, including while stationary, and if they have no gearing, there’s no backlash. So they are useful in applications where they need to resist movement from external forces, including gravity. Where fine control is necessary, it is possible to “microstep” a stepper motor, which allows very fine control over the shaft’s position, with steps less than 1°. Because that is done without gearing, there is minimal backlash or risk of inaccuracy due to gear slop. Stepper motors have not been around as long as the more familiar brushes-and-commutator type of DC motor, or either the synchronous or induction type of AC motor. Stepper motors were invented in 1965 by Morton Sklaroff, an engineer working for US firm Honeywell Inc. They started to appear at the beginning of the “digital era”. Since the late 1960s, they’ve become widely used, especially in applications involving both digital electronics and electromechanics. They’re now made in large numbers and in a wide range of shapes and sizes, from subminiature sizes designed to drive the optical head leadscrew of Australia’s electronics magazine CD/DVD/Blu-ray disc drives, all the way up to much larger and highertorque units capable of driving actuators in CNC machinery. Types of stepper motors Nowadays there are three common types of stepper motor, known as the “permanent magnet stepper”, the “variable reluctance stepper” and the “hybrid synchronous stepper”. The hybrid type is the most common; it is essentially a combination of the other two types and provides maximum torque and power in the smallest physical size. This is the type we’re mainly going to cover here. Even within the hybrid stepper family, there are various configurations regarding the number of pairs of stator poles and windings. Some have two phases (ie, two pairs of stator poles and windings) while others may have three or four phases. Very large steppers may even have five phases, ie, a total of 10 stator poles and windings. The most common steppers have the minimum configuration of two phases and hence four stator poles and windings. siliconchip.com.au Inside a hybrid stepper Two important characteristics of a hybrid stepper motor are that it has a rotor with an axially polarised permanent magnet and that both the rotor and the stator poles have ‘teeth’. The interaction between the teeth of the rotor and those of the stator poles plays an important role in the way this kind of stepper works. Fig.1 shows the inner working of a two-phase hybrid stepper. It shows an axial view of the inside of the assembled stator and rotor at left, while at right is shown a side view of the rotor alone. The rotor consists of an axially polarised cylindrical permanent magnet, with toothed ‘cups’ at either end. Both of these cups have 50 teeth, with the tooth pitch thus corresponding to an angle of rotation of 7.2° (360° ÷ 50). Importantly, the two cups are offset from each other by one-half of the tooth pitch, so the teeth of one cup are aligned with the gaps between the teeth of the other cup. This gives the motor an effective step resolution of 3.6° degrees (7.2° ÷ 2). Each of these rotor cups effectively provides that end of the rotor’s magnet with 50 “micro pole tips” spread around the cup periphery, each capable of interacting with the teeth of the stator electromagnet poles. So the rotor magnet effectively has 50 north pole teeth and 50 south pole teeth, each spread equidistantly around the circumference of those cups, but with a fixed 3.6° offset between the two sets of teeth. And when the rotor is fitted inside the stator, the tips of both sets of magnet pole teeth are close to the teeth of the stator poles. As shown in Fig.1, the motor has four stator poles spaced 90° apart, arranged in pairs which are opposite each other. The pairs of stator windings 180° apart are connected in series but with opposite polarities, so that when current passes through both, one has a magnetic north pole adjacent to the rotor while the other has a south pole adjacent to the rotor. These magnetic polarities reverse if the current passes through the windings in the opposite direction, with north becoming south and south becoming north. Fig.1: the construction of a typical hybrid synchronous stepper. It has a rotor with an axially polarised permanent magnet and four windings inside the laminated stator. Both the rotor and the stator poles have teeth, this allows the rotor to turn clockwise or anti-clockwise in small increments (typically 3.6°). winding configurations for a common two-phase stepper motor. The “unipolar” configuration is shown at left, with the “bipolar” configuration at right. Note though that these names refer to the requirements of the driving circuitry, not the motor itself, which clearly has more than one pole. In the unipolar arrangement, the two stator windings for each phase are connected in series, with their interconnection point brought out as a centre tap. So there are three wires for each phase, eg, A1-CT-A2 and B1-CT-B2 for a total of six wires. You can recognise motors with this configuration by the number of wires. With the bipolar configuration, the two stator windings for each phase are either connected in series or in parallel but in either case, only two wires are brought out per phase. So if a stepper only has four wires, it’s almost certainly wired in this configuration. The main difference between the two configurations is the way they are meant to be driven. With the unipolar arrangement, only one side of each centre-tapped pair of windings is meant to be driven at a time, whereas with the bipolar arrangement, both windings must be driven simultaneously. Stepping and sequencing To drive a stepper motor, you need hardware and possibly also software to generate the required sequence of pulses to feed the windings. This process is often called “indexing”. Early on, a basic system of indexing was used, now known as “fullstepping”. This allowed a stepper to achieve its innate stepping resolution, for example, steps of 3.6° for a hybrid two-phase stepper with 50-tooth rotor cups, giving 100 steps per revolution. But after a while, designers found that they could achieve double this stepping resolution by using a more complex indexing system, known as “half-stepping”. With the type of stepper mentioned above, you get steps of 1.8°, ie, 200 steps per revolution. Later designers developed an even more complex indexing system which involved driving the stator windings not with rectangular pulses, but with stepped approximations of sine and cosine waveforms. This system became known as “microstepping” and it allows a stepper to achieve even smaller steps. Fig.2: the four stator windings can be connected in two configurations: 1. Opposing pairs of windings connected in series with the centre taps (junctions) brought out, resulting in six control wires (unipolar). 2. Opposing pairs of windings connected in series/parallel without any centre taps, resulting in four wires (bipolar). Winding configurations Fig.2 shows the two main stator siliconchip.com.au This makes the bipolar configuration more energy efficient but complicates the required driving circuitry, as detailed below. Australia’s electronics magazine January 2019  39 Fig.3: typical driving circuitry and control waveforms for a two-phase unipolar stepper motor. The centre taps are permanently connected to the DC supply while the ends of the windings are selectively driven low. The driving pulses can be short, resulting in full-stepping (shown on the top graph) or longer and overlapping, resulting in half-stepping (shown on the bottom graph). For example, microstepping a hybrid two-phase stepper with 50-tooth rotor cups can achieve a stepping resolution of 0.9° or 400 steps per revolution. Another advantage of microstepping is that when the motor is used for multi-step operation (like continuous rotation), its shaft rotation is significantly smoother. But since the hardware and/or software requirements to achieve microstepping are somewhat more complicated than full-step and half-step indexing, we’re not going to discuss it in further depth here. Instead, we are going to look at what is needed for basic full- and half-stepping of unipolar and bipolar hybrid stepping motors. If you’re interested in microstepping, we suggest that you buy a stepper motor driver IC or module with microstepping capabilities and check its data sheet or manual for information on its capabilities and control interface. Driving a unipolar stepper Fig.3 shows the basic circuit used for driving a unipolar hybrid stepper The inside of a 6-wire stepper motor. Most of this type of stepper motor can be run as either unipolar or bipolar depending on the wire configuration. 40 Silicon Chip Australia’s electronics magazine motor. The centre taps of the two pairs of windings are both connected to a source of DC power; typically +12V. The ends of all four windings are each connected to the outputs of four power inverter gates. Each winding can be fed with a pulse of current by driving the input of its inverter high. Diodes D1-D4 protect the outputs of the inverters from being damaged by the inductive back-EMF spike from the motor windings when the current flow stops. They ensure that the voltages at A1, A2, B1 and B2 can never rise above +12V by more than a diode forward voltage drop (around 0.7V). This circuit can drive the stepper in either full- or half-step mode. The only difference is the sequence of pulses fed to the inputs of the four inverters. This is shown on the right of Fig.3. The upper diagram shows the drive sequencing for full-stepping, while the lower one shows the modified sequencing for half-stepping. For full-stepping, current is only flowing in a single stator winding at any time. The windings are driven in the following sequence: A1, B1, A2, B2, then back to A1. Each pulse results in the motor rotating by a single step. Reversing the sequence causes the motor rotation to reverse. The steps are colour coded in Fig.3, with steps shown in red, yellow, blue and green respectively. The shows the motor performing twelve full steps, siliconchip.com.au Fig.4: the driving circuitry for a bipolar stepper motor is more complicated, as the windings need to be driven with H-bridges so that current through each winding can be reversed. Its control pulses are identical to a unipolar stepper (Fig.3), with the interface circuitry performing the necessary translation to switch on each transistor when appropriate. by repeating the full sequence three times. The modified pulse sequence for half-stepping uses the same basic A1B1-A2-B2 sequence but with an important difference: now, two adjacent pulses can overlap, and do so for 2/3 of the time, at both the start and finish of the primary pulse in each winding. So the full pulse sequence for a halfstep has become (B- + A+) | A+ | (A+ + B+) | B+ | (B+ + A-) | A- | (A- + B-) | B-. This is made clear by the overlapping colours in the diagram. It is this pulse overlapping which results in the motor performing half-stepping, by providing rotor positions between the single-winding current situations. As before, the half-step pulse sequence is simply reversed to get the motor to perform half-steps in the opposite direction. Note that the current pulse waveforms in each winding are now 3/8 on and 5/8 off, whereas the waveforms for full stepping are 1/4 on and 3/4 off. driver circuits, to allow us to reverse the voltage and therefore current polarity in either stator winding. The H-bridge driver for the A1/A2 winding comprises transistors Q1-Q4, while that for the B1/B2 winding comprises transistors Q5-Q8. Although the transistors are shown as NPN bipolar types, Mosfets can also be used, and often are. Note also that diodes D1-D8 are again to clamp the back-EMF from the motor windings at the end of the current pulses, to protect the bridge transistors. Two inverters and two non-inverting buffers are used to drive each bridge. Driving a bipolar motor Fig.4 shows the driver circuitry and pulse sequences for full- and half-stepping of a bipolar stepper motor. The main difference in the driving circuitry is we now need a pair of H-bridge siliconchip.com.au A NEMA 17 bipolar stepper motor. This smaller size of stepper motor is used in animatronics, printers etc. Australia’s electronics magazine For example, the InA+ control input drives upper transistor Q1 via a noninverting buffer, while also driving lower transistor Q3 via an inverter, so Q3 is off whenever Q1 is on and vice versa. Notice that both Q3 and Q4 will be turned on when neither input InA+ and InA- is pulsed high. This provides a measure of braking between pulses. The net result is that when a positive logic pulse is applied to input InA+, this causes a pulse of current to flow through the upper stator winding in the direction from A1 to A2 and when a positive logic pulse is applied to input InA-, a current pulse will flow through the same winding in the opposite direction (A2 to A1). The lower bridge operates in the same way. Resistors Rsa and Rsb, between the bottom of each H-bridge and ground, allow the current flowing in each winding to be monitored. This can be used to limit the current and hence protect the motor windings in the event of an overload. The two graphs on the right-hand side of Fig.4 should look rather familiar. They are in fact identical to those on the right of Fig.3. Which is not all that surprising, since bipolar steppers differ from the unipolar variety only January 2019  41 in the sense that they use a different method to achieve the same result. So while bipolar steppers need a more complex driver system, they are the same when it comes to the control pulses required for full- and halfstepping. Microstepping As mentioned earlier, half-stepping works by overlapping the drive between subsequent windings in the stepper motor. You may be able to imagine how, if you could vary the current level, you could gradually reduce the current in one winding while gradually increasing the current in the next winding, to achieve a smooth transition. This is effectively how microstepping works. As we said above, we won’t go into detail about that method here, except to say that for efficiency reasons, it isn’t usually done by linear circuitry. Instead, high-frequency PWM control signals are used, with the duty cycle for each winding drive input varying in a sinusoidal manner, to achieve that smooth hand-over from one winding to the other. Besides providing a method for even more accurate control over the rotor shaft position, microstepping also provides much smoother rotation, getting rid of the noticeable steps that occur when the motor is driven in full-stepping or half-stepping mode, and most of the ensuing vibration and noise. Stepper motor sizes Table.1 shows the dimensions of the most common sizes of stepper motor, according to the US National Electrical Manufacturers Association (NEMA). There are seven standard sizes, ranging from NEMA 8 to the NEMA 42. The inside of a 4-phase, 8-wire unipolar stepper motor. 42 Silicon Chip Table 1: standard dimensions for the seven NEMA sizes of stepper motors. The numbers 8, 11, 14 and so on correspond to the dimensions of the motor’s square mounting faceplate in tenths of an inch. So the faceplate of a NEMA 14 stepper measures 1.4-inch x 1.4-inch, or 35.56 x 35.56mm. But there are many stepper motors around which do not correspond to any of these standard NEMA sizes. Some have intermediate mounting plate sizes, others have circular twohole mounting plates and so on. Often, steppers salvaged from old printers or disc drives are like this, but they can still be put to use. You can see a selection of steppers in our lead photo, all of different shapes and sizes. Only the one at upper left is a standard size (NEMA 17). Closing comments Hopefully, this article has given you a useful insight into the most common types of stepper motor and how they are used. But we should mention another couple of details before closing. In Figs.3 & 4, we have simply shown the pulse sequences needed to achieve full- and half-stepping but we have not explained how the pulse sequences are generated. It’s easy to generate the required pulse sequences using a microcontroller and that is generally how it’s done nowadays. But dedicated indexing/ controller ICs can also generate the pulse sequences. These devices only need to be instructed which stepping mode is to be used (full/half/micro), the stepping direction and either the number of steps or the stepping speed and they do the rest. The common STMicro L297 stepper motor controller IC is one such device, handling not only all the indexing but also the output bridge current sensing and control. It’s designed to work Australia’s electronics magazine together with the L298 dual H-bridge driver IC. Some stepper motor driver ICs also include an on-chip indexing controller of their own. The Texas Instruments DRV8825 is one such device. It includes an indexing controller to drive its two internal H-bridges. The Toshiba TB6612FNG is similar, with two separate controllers, one for each H-bridge. We should also mention that unipolar motors can be used with bipolar driver circuits, simply by ignoring the centre-tap of each winding pair and only connecting their ends. This effectively converts them into a bipolar motor but it will need a higher supply voltage to achieve the same torque compared to driving it in unipolar mode. Next month, there will be an El Cheapo Modules article which describes three different stepper motor drivers. Useful links Stepper motor switching sequence: www.ni.com/white-paper/14876/en Hybrid stepper motors: siliconchip.com.au/link/aam6 Stepper motor basics: siliconchip.com.au/link/aam7 wikipedia.org/wiki/Stepper_motor www.cs.uiowa.edu/~jones/step/ Stepper motor sizes: siliconchip.com.au/link/aam8 NEMA standard: siliconchip.com.au/link/aam9 reprap.org/wiki/NEMA_Motor SC siliconchip.com.au