Drive

The stepper motor controller

The “simple” stepper motor controller

In some applications, the stepper motor is simply invaluable. Despite the relatively complicated control compared to typical DC motors, this type of motor is characterized by constant torque practically from standstill to a certain rotational speed, at which the impedance of the motor windings begins to play a dominant role. Therefore, it is easy to implement a type of drive that, despite the considerable weight of the object, will be able to move it slowly without the need for a gear.

Of course, such a drive cannot be made in isolation from the laws of physics and probably, if we care about the accuracy of this movement, we will have to make some kind of feedback that will inform the control system whether the movement has really taken place or whether the engine is oscillating and is unable to overcome the load. Usually, an incremental encoder is used in the function of such a feedback, which is coupled to the engine axis or has a roller that converts the linear movement of the object into the rotary movement of the encoder axis.

Most stepper motor applications use the fact that the number of steps (strokes) per full revolution is known and results from the motor’s construction. Knowing the gear ratio connected to the motor axis, it is easy to convert such a single stroke to the corresponding linear displacement, and having the displacement value in units of measurement, convert it to the number of strokes, send the corresponding number of sequences to the motor, and we have a ready-made plotter, CNC milling machine, printer, and many other devices, the existence of which we are often unaware. For example, how many car users know that in addition to the combustion engine, they have a number of stepper motors “under the hood” driving various shutters and levers?

Stepper motor control at a basic level is not particularly complicated. In the simplest motor controllers, we usually deal with either direct control or so-called half-step control, in which the basic stroke is divided by 2. In slightly more advanced ones, micro-step control can be achieved, in which the basic stroke is divided by a certain integer – most often from the range of 3 to 32. Theoretically, it is also possible to obtain non-integer division, but it is rather of no practical use. However, this type of control requires PWM modulation.

When a stepper motor is controlled in a full- or half-step manner, the stator magnetic field rotates 90° or 45° electrically for each motor stroke, respectively. Generating such a field is relatively easy, since only two current levels are required: rated and off. They can be easily obtained with any control system. By switching the winding currents on or off, 8 different combinations of winding currents and corresponding 8 magnetic field positions in the motor can be obtained. If a controller is available that can generate any winding current, from 0 to 141% of the rated current, it is possible to generate a rotating magnetic field of any orientation, and thus to select any electrical angle of the stroke, for example: 1/4, 1/8 or 1/32. In addition to changing the direction of the magnetic field, its intensity can also be varied, which allows smooth movement of the rotor at low frequency. At frequencies 2 or 3 times the fundamental frequency, microstepping has little effect on rotor vibration because the mechanical inertia of the rotor acts as a low-pass filter.

Like everything, microstepping has its drawbacks. Often, in practice, either a large division of the basic step cannot be used, or a more powerful motor must be used than would be required for control without division. Although the electronics used to work with microstepping are more complex than those for full or half-stepping, the overall complexity of the system, including the motor, gear, and drive components, is lower.

Basic or half-step control of a stepper motor requires supplying its windings with a certain sequence of voltages, the number of which depends on the motor’s construction. The most convenient way to create such a sequence is by using a state machine that changes in time with the input clock pulses. By counting these pulses, you can easily convert them to the corresponding linear displacement. Having a microcontroller at your disposal, you can create feedback by connecting an encoder to it. The microcontroller will also provide the ability to easily create a program state machine, microstepping control, regulating the motor winding current using PWM, measuring this current, calculating its true effective value, creating a graphical user interface, network communication and other functions for which the only limitation is your imagination. However, believe me, because the author of the article has faced the development of such controllers in the past, that this is not an easy task and requires solid knowledge not only in the field of software and microcontroller operation, but also commutation, reducing the level of emitted EMI interference, reducing their impact on the control system, cooling components and many others. And then you have to somehow pack and package it all, add reliable and solid connectors, and adapt it to the applicable standards.

I got carried away a bit. Not every application is so difficult and demanding – sometimes it is enough to simply set the engine in motion. In such applications, the simplest controllers will work well, formerly implemented using discrete TTL or CMOS systems, and currently using cheap microcontrollers. Numerous projects of such controllers have been published in Elektronika Praktyczna, including two that are bestsellers in sales of our self-assembly kits.

The stepper motor controller

The electrical diagram of the AVT1314 stepper motor controller, the description of which was published in EP 8/2001, is shown in Figure 1. It is made entirely of discrete elements – you will not find a processor or specialized circuits in it in vain. It consists of a clock generator implemented on a Schmitt gate (IC3B). The operating frequency of this generator, and thus the engine speed, is determined by the value of the resistance R2 + PR1 and the capacitance of the capacitor C1, and can be adjusted in a wide range using the mounting potentiometer PR1. The next controller block forms a fragment of the diagram with EXOR gates and JK flip-flops. With their help, a modulo 4 counter was made, on the outputs of which the high level is shifted in time with the clock pulses, as described in Table 1. Switch S1 is used to change the counter’s operating direction, and thus to change the direction of the motor’s rotation, the coils of which are switched in accordance with the states at the counter’s output. Using the S2 switch, we can stop or start the engine. The coils of the four-phase stepper motor are powered by transistors T1…T4. The use of high-power BUZ10 type transistors in the model system is a solution that guarantees the correct operation of even very high-power engines.

The stepper motor controller

The description of the AVT1725 controller was published 12 years later. Like most modern devices, it was implemented using a microcontroller, which influenced its functionality. In addition to the significant simplification of the design, the possibility of microstepping control was obtained, which is carried out with a resolution of 1/64 or 1/8 step. Additionally, it was equipped with a time operation function (time smoothly adjustable in the range of 0.5…70 s). The possibility of turning off the power supply to the motor windings after stopping was also implemented – in this way the motor can brake or rotate freely after stopping (the author of the project called these modes static or dynamic stopping).

The schematic diagram of the AVT1725 controller is shown in Figure 2. The power stage is implemented on the L298 integrated circuit. Its operation is controlled by the ATtiny26 microcontroller, and the power supply is provided by the 78M05 stabilizer. Intermediate sequences are obtained by controlling the motor windings with the PWM waveform. The PWM modulation characteristic has the shape of a triangular waveform. This solution is simple and effective, but in professional controllers a sinusoidal shape is used.

The stepper motor controller

Resistor R5 is used to select the rotational speed range. If it is installed, a higher sequence frequency is selected, approx. 7…100 cycles per second (i.e. full waveform periods in each channel), and the controller works with a lower resolution of 1/8 step. The absence of resistor R5 means a lower frequency of 1…10 cycles per second and a higher microstep resolution of 1/64. Resistor R6 determines whether the motor will have the power supply disconnected during stopping (R6 = braking). The controller also has a time operation function. It is switched on after closing the START/STOP connector, and the switch-on time is set by the position of the slider of potentiometer R1. Potentiometer R3 is used to adjust the direction and speed of rotation – in the middle position the motor is stopped, moving the potentiometer causes a gradual increase in rotational speed. Potentiometer R3 can be omitted, instead a voltage from the range of 0…5 V can be supplied to the DIRECT connector and in this way the motor operation can be controlled.

The stepper motor controller

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker