Open-loop control system of stepping motor based on single chip microcomputer

Publisher:Meilin8888Latest update time:2011-11-29 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.
Stepper motor open loop control system block diagram
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]

(2) Optoelectronic isolation circuit
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.

Reference address:Open-loop control system of stepping motor based on single chip microcomputer

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号