0 Introduction
A stepper motor is an electromechanical actuator that converts an electrical pulse signal into a corresponding angular displacement or linear displacement. By controlling the number of input pulses, frequency, and the connection sequence of each phase winding of the stepper motor, various required operating characteristics can be obtained. Especially when used with digital equipment, it has greater advantages, so it is widely used in digital control systems.
This article introduces the digital control system of a stepper motor using a single-chip microcomputer. In this control system, the controller is responsible for generating pulses and sending and receiving control commands. This article gives a detailed introduction to the design of the controller, especially the design of the pulse generating circuit.
1 System Design
The block diagram of the stepper motor open-loop control system is shown in Figure 1. The system consists of four parts: stepper motor controller, stepper motor drive power supply, stepper motor and LED status display. This article focuses on the stepper motor controller, stepper motor drive power supply and LED display status.
Figure 1 Block diagram of stepper motor open-loop control system
1. 1 Stepper motor controller
The stepper motor controller is mainly composed of a single-chip microcomputer, a crystal oscillator circuit, an 8K RAM and a photoelectric isolation circuit (see Figure 2).
Figure 2 Composition of stepper motor controller
(1) Crystal Oscillator
Circuit The clock signal of a microcontroller is usually obtained using two circuit forms: internal oscillation mode and external oscillation mode. Connecting a crystal oscillator (referred to as crystal oscillator) or ceramic resonator to pins XTAL1 and XTAL2 constitutes an internal oscillation mode. Since the microcontroller has a high-gain inverting amplifier inside, when an external crystal oscillator is connected, a self-excited oscillator is formed and an oscillating clock pulse is generated. The external circuit of the internal oscillation mode is shown in Figure 3. In this system, the values of C1 and C2 are selected to be 30 pF.
Figure 3 Internal oscillation circuit [page]
The optoelectronic isolation circuit composed of optical isolators is used to isolate the controller from the external drive circuit, so that changes in the external circuit will not affect or damage the control system, thereby improving
the reliability of the system and enhancing its anti-interference ability. The most important parameter of the optical isolator is the current transfer ratio CTR, which is usually 0.2 to 0.9. When the input digital signal provides a certain current (5 to 10 mA), the optical
isolator will output the amplified digital level.
Pay attention to the positive and negative logic of the signal when connecting the optical isolator. The input and output ground wires of the optical isolator must be separated from each other, and the input and output power supplies must be powered separately; if the same power supply is used, external interference signals may be connected to the system through the power supply.
(3) Storage module
The 89C51 microcontroller has only 128 B of RAM on the chip, and the data to be stored in this system is large, so an external RAM needs to be expanded.
(4) Stepper pulse generation circuit
In the stepper motor open-loop system using a microcontroller, the frequency or commutation period of the CP pulse of the control system actually controls the running speed of the stepper motor. The system can use two methods to achieve
speed control of stepper motors: one is delay and the other is timing.
The delay method is to call a delay subroutine after each commutation, and execute commutation again after the delay ends. In this way, a certain frequency of CP pulses or commutation cycles can be issued repeatedly. The delay time of the delay subroutine and the time used by the commutation program are the period of the CP pulse. This method is simple, takes up less resources, and is fully implemented by software. Calling different subroutines can achieve different speeds; but it takes up a long CPU time and cannot handle other tasks during operation, so it is only suitable for simpler control processes.
The timing method is to use the timer timing function in the single-chip microcomputer system to generate a timing signal of any period, so that the system can easily control the period of the CP pulse output. When the timer is started, the timer counts the system and its period from the initial value loaded; when the timer overflows, the timer generates an interrupt, and the system switches to execute the timing interrupt subroutine. Put the motor commutation subroutine in the timing interrupt service program, and the motor commutates once the timing interrupt is triggered, thereby realizing the speed control of the motor. Since there is a certain time interval from the timer loading and restarting to the timer requesting an interrupt, the timing time increases. In order to reduce this timing error and achieve accurate timing, the initial value of the reloaded count should be appropriately adjusted. The adjustment of the initial reload value mainly considers two factors: one is the time required for interrupt response; the other is the time occupied by the reload initial value instruction, including other instruction factors in the interrupt service program before reloading the initial value. After combining these two factors,
the correction amount of the reload count initial value is 8 machine cycles, that is, the timing time is shortened by 8 machine cycles.
When the motor speed is controlled by the timer interrupt method, the size of the timer load value is actually constantly changing. In the control process, a discrete method is used to approximate the ideal speed increase and decrease curve. In order to reduce
the time for calculating the load value at each step, the load value required for the speed of each discrete point is solidified in the system ROM when the system is designed. The system uses a table lookup method to find the required load value during operation, which
can greatly reduce the time occupied by the CPU and improve the response speed of the system. The flow chart is shown in Figure 4.
Figure 4 Acceleration and deceleration control flow chart
1. 2 Stepper motor drive circuit
The stepper motor drive circuit is composed of dedicated chips L297 and L298. The L297 single-chip stepper motor control integrated circuit is suitable for
the control of bipolar two-phase stepper motors or four-phase unipolar stepper motors. It is combined with the H-bridge driver chip L298 to form a complete stepper motor fixed chopping frequency PWM constant current chopper driver.
The L297 stepper motor control integrated circuit generates a four-phase drive signal to control a bipolar two-phase stepper motor or a four-phase unipolar stepper motor. It can
switch between three modes: half-step, two-phase excitation and single-phase excitation. The outstanding feature of using L297 is that only three external input signals, clock, direction and working mode, are required. At the same time, L297 automatically generates the motor excitation phase sequence, which reduces the control
and programming burden of the microprocessor. L297 has two packaging forms: DIP20 and SO20, which can be used to control integrated bridge drive circuits or drive circuits composed of discrete components.
[page]
L297 is mainly composed of a decoder, a PWM constant current chopper with a fixed chopping frequency (2 pieces), and an output logic control.
The L298 chip is a high voltage, high current, dual H-bridge power integrated circuit that can be used to drive inductive loads such as relay coils, DC motors, and stepper motors. The emitters of the lower arm transistors of each H-bridge are connected together, and the corresponding external terminals can be used to connect current detection resistors.
The stepper motor drive application circuit composed of L297 and L298 is shown in Figure 5. This circuit is a fixed chopping frequency constant current chopping drive mode, suitable for two-phase bipolar stepper motors or four-phase unipolar stepper motors, with a maximum voltage of 46 V and a current of up to 2 A per phase. Using two L298s and one L297 together can drive a two-phase stepper motor with a higher power.
Figure 5 Stepper motor driver composition
L297 has three working modes: half-step working mode, bidirectional excitation working mode, and single-phase excitation working mode. The phase sequence waveform of the bidirectional excitation working mode is shown in Figure 6.
Figure 6 Bidirectional excitation phase sequence waveform
When HALF /FULL of L297 is low level, if the decoder works in odd state (1, 3, 5, 7), it is bidirectional excitation working mode. In this mode, the output of the prohibition signal INH1 and INH2 is kept at
a high level. If the decoder works in even state (2, 4, 6, 8), it is a single-phase excitation mode; when HALF /FULL is high level, the decoder generates a half-step working mode phase sequence, that is, an 8-step Gray code timing sequence.
1. 3 LED operation status display
In this system, 74LS164 is used as the display driver with latch and serial connection, which can save I/O port resources, but SIO must be used, which is easy to control when sending data.
2 Conclusion
The open-loop control system of stepper motor has the advantages of low cost, simplicity and convenient control. In this scheme, the load position has no feedback to the control circuit, so the stepper motor must respond correctly to each excitation change. If the excitation frequency is not selected properly, the motor cannot reach the new required position, and the actual load position will have a permanent error relative to the expected position of the controller, that is, "out of step" and "overshoot" phenomena will occur. Position feedback or position feedback can be used to determine the correct phase conversion to adapt to the rotor position, thereby greatly improving the performance of the stepper motor, so that more precise position control and high and stable speed can be obtained.
Previous article:Design of digital control power supply based on 51 single chip microcomputer
Next article:Design of dimming controller based on 51 single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [National Technology N32G430] 5. Add OLED display task
- [ATmega4809 Curiosity Nano Review] Main Technical Data
- Is this a scammer?
- OPA2835
- [HC32F460 Development Board Review] 05 wm8731 plays music through headphones
- Xiaobai wants to learn
- I would like to ask, what reference materials are there for the formulation of optical module standards?
- Multi-tabbed putty - MTPuTTY
- There are always reports of layoffs at major domestic companies. Is the domestic economic environment really getting worse?
- Division of the electromagnetic spectrum