Available online at www.sciencedirect.com Available online at www.sciencedirect.com
Procedia Engineering
ProcediaProcedia Engineering 00 (2011) Engineering 15 000–000 (2011) 2276 – 2280 www.elsevier.com/locate/procedia
Advanced in Control Engineering and Information Science
Design of stepping motor control system based on AT89C51 microcontroller QI Fa -Quna,JING Xue-Dongb,ZHAO Shi-qinga,a* a
School of Mechanical and Electronic Engineering,ShaanXi University of science and technology,Xi’an,710021,China b
Shanghai Institute of Technology,shanghai,201418, China
Abstract This paper describes a control system of microcontroller AT89C51 used in stepping motor. These included the keyboard input and LED display circuit,control circuit,magnifying and driving circuit and the corresponding program flow drawing. This system can be applied in many stepping motor control regions. The experiment showed that the system can be used stably and reliably in control stepping motor and perfect compliance with the requirements of project.
© 2011 Published by Elsevier Ltd. Selection and/or peer-review under responsibility of [CEIS 2011] Keywords: Stepping motor; Control system; Microcontroller; AT89C51
1. Introduction Stepping motors are widely used in electrical and mechanical equipments, which can directly convert electrical pulse signal into angular displacement or linear displacement of the implementing agencies. The pulse signal received by stepper motor drive can drive a stepper motor to rotate a fixed angle in accordance with the directions set, and control the amount of angular displacement by controlling the number of pulses. The stepper motor’s speed and acceleration can also be controlled by controlling the pulse frequency. And the output of the angular displacement of stepper motor and speed are proportional to the input of the number of pulses and pulse frequency. Traditional circuit design of the stepper motor’s control and drive circuit is not only complex or costly, but also difficult to be modified or adapt to the higher intelligence occasion, and with poor portability after the system is formed. In this paper, AT89C51 * QI Fa -Qun. Tel.: 15991619424. E-mail address:
[email protected].
1877-7058 © 2011 Published by Elsevier Ltd. doi:10.1016/j.proeng.2011.08.426
QI et al.al/ / Procedia – 2280 QIFa Fa-Qun –Qun,et ProcediaEngineering Engineering15 00(2011) (2011)2276 000–000
2
microcontroller is used as controller to control the stepper motor. The control system is more simple, reliable and flexible. 2. System Design All figures should be numbered with Arabic numerals (1,2,...n). All photographs, schemas, graphs and diagrams are to be referred to as figures. Line drawings should be good quality scans or true electronic output. Low-quality scans are not acceptable. Figures must be embedded into the text and not supplied separately. Lettering and symbols should be clearly defined either in the caption or in a legend provided as part of the figure. Figures should be placed at the top or bottom of a page wherever possible, as close as possible to the first reference to them in the paper. This stepper motor control system mainly consists of ATMEL89C51 microcontroller, motor driver chips, buttons, LED display of common anode in serial port mode, power and clock circuit, and so on. The block diagram is shown in Figure 1. With the Built-in Watchdog of AT89C51 can ensure the normal operation of the system. The system has the characters of simple, low cost, highly reliable, versatile, and so on. In practical applications, in order to have lower cost, the stepper motor was driven by using L298N.
Fig.1 Block diagram of stepper motor control system
3. Hardware Design 3.1. Keyboard, LED modules In order to improve the intelligence level of the system, the 8 × 8 keyboard and 16-bit LED display was used to get machine conversation, and the SL0~SL2 was applied to translate the key scan lines. The 4~16 decoders was use to translate on SL0 ~ SL3-bit display scan line. In fact, a broader application, the size of the keyboard and display’s number of bits can be determined according to different needs. The keyboard input the commands about stepper motor speed, steering, step, start and stop, etc, LED digital display stepper motor speed and the dynamic shift, while the system is working. The SCM system uses a common keyboard / display and controller chip 8279 to manage the keyboard and display to reduce the burden on the host and improve the stability of display. The connection of the 8279, keyboard and display in the paper is shown in Fig.2. 3.2. SCM Control Module The module, shown in Fig.3, is mainly consisted of AT89C51 microcontroller and its peripheral circuits, optical coupler, 74HC244 chips and other components. For simplicity, the figure drew only one phase of the circuit, the same as the rest of the phase circuit. AT89C51 microcontroller’s internal 4KB Flash and128B RAM can meet the storage requirements of the system. SCM’ port P1 is mainly used to output stepper motor’s winding control signals of each phase, and flexibly selects P1.0 ~ P1.7 according to different models of the motor. In order to increase the flexible control of stepper motor, external interrupt port INTO of the SCM was used to test speed resetting and steering settings buttons of the motor during the rotating, setting the INT1 in edge triggered mode. AT89C51 microcontroller is generally
2277
2278
-Qun et al. / Procedia Engineering 15 000–000 (2011) 2276 – 2280 QIQI FaFa -Qun / Procedia Engineering 00 (2011)
programmed with parallel port. Microcontroller’s several I/O ports can be directly used to link to parallel lines in theory. However, if the board did not do a good job, the computer parallel port may be burned, so 74HC244 chip is added to protect the parallel port. At the same time the commonly used three-state gate of the bus circuit is borrowed, mainly because of its output current up to 20mA, which is enough to drive the LED in the optical coupler. Optical coupler (Figure Y1) works as an isolator for SCM and external circuit. Signals can be transmitted from the microcontroller to the followed power amplifier circuit, but the interference signal cannot be sent to the microcontroller. The module circuit is shown in Fig.3.
Fig. 2 Connection of 8279, keyboard and monitor
3.3. Signal isolation and amplifier module Generally, the load power of stepper motors in the system is larger, need to isolate stepper motor driver’s strong electric from weak electric of the microcontroller control system, so as to avoid damage to the microcontroller control system, promote reliability of the system and enhance anti-jamming capability. In this paper, power amplifiers was applied to transmit weak signal into strong signal, providing operating current for the stepper motor and use optical couplers (Y1 in Fig.3) to play the role as isolator of the microcontroller and peripheral circuit.
Fig.3 Circuit of SCM control module
3
QI et al.al/ / Procedia – 2280 QIFa Fa-Qun –Qun,et ProcediaEngineering Engineering15 00(2011) (2011)2276 000–000
4
4. Software Design The whole system consists of keyboard, LED display module, and step pulse generator module. Operator can set the stepper motor’s start, stop, speed, and steering by the buttons. Its speed or steering can be changed, then the speed and steering can be dynamically displayed in the LED display. Microcontroller uses external interrupt to detect the optical coupler’ the interrupt port and interface chip 8279’s, generating the corresponding control pulse signal for each phase winding of the stepper motor depending on the content of the interrupt. The main program flow chart is shown in Fig.4. 4.1. Keyboard, LED module This module mainly identifies the scan of the key, pre-processes the input data and shows the motor’s speed and steering Etc. Initialization includes the initialization of parameters and 8279.After being initialized, the 8279 scans keyboard, eliminates the shock of the keyboard, gets the input data or command and exchanges information with the microcontroller by interrupting. Microcontroller executes corresponding data processing program according to different information obtained, and generates program according to pulse control signal, then sends the results into the 8279, that controls the LED to display the data and the stepper motor’s rotational status etc.
Fig.4 the main program flow chart
4.2. Pulse Generator Module As the data formats of Pl Port is relevant to the stepper motor’s model, so SCM generates corresponding electrical pulse signal output by the Pl Port according to the stepper motor’s model and the input data. It is essential to have a pulse sequence shown in Fig.5 to drive the stepper motor normally. The pulse sequence is represented by periodic, pulse height and on/off time Etc. Response to each step of the stepper motor takes certain of time, that is, a high pulse needs to retain a certain time so that the motor can achieve a perfect position. On/off time can be realized by using delay in software, which determines the actual speed of the stepper motor.
Fig.5 Pulse sequence
Stepper motor has three working ways, such as single-shot, double shot and multi-shot. Four-phase, five-phase, or six-phase stepper motor's working method is similar to the three-phase stepper motor's
2279
2280
-Qun/ Procedia et al. / Procedia Engineering 15 (2011) 2276 – 2280 QIQIFaFa-Qun Engineering 00 (2011) 000–000
working method, so only the three-phase stepper motor’s excitation way cross-references shown in Table 1 are listed. Other types of stepping motor’s can be analogized by this way. Table 1 Three-phase stepper motor’s excitation table Manner of working
Process
Single three clap
Excitation
Control bit C
B
A
P1 output
control phase
1
0
0
1
A
01H
2
0
1
0
B
02H
3
0
0
1
C
04H
1
0
1
1
AB
03H
Double three
2
1
1
0
BC
06H
clap
3
1
0
1
0
0
CA
05H
1
A
01H
2
0
1
1
AB
03H
Three-phase
3
0
1
0
B
02H
six clap
4
1
1
0
BC
06H
5
1
0
0
C
04H
6
1
0
1
CA
05H
5. Conclusions In this paper, AT89C51 microcontroller and software programming techniques are used to control the stepper motor. This way is practical, simple, and flexible. In order to control different types of stepper motor, as long as modifying simple hardware and software can get the desired results, such as modifying the motor’s speed and steering while it is working. The circuit is simple, reliable, compact and portable. After several experiments, the system is very perfect and of high practical value. 6. Copyright All authors must sign the Transfer of Copyright agreement before the article can be published. This transfer agreement enables Elsevier to protect the copyrighted material for the authors, but does not relinquish the authors' proprietary rights. The copyright transfer covers the exclusive rights to reproduce and distribute the article, including reprints, photographic reproductions, microfilm or any other reproductions of similar nature and translations. Authors are responsible for obtaining from the copyright holder permission to reproduce any figures for which copyright exists. References [1] TANG Jing-nan, Shen Qin. Development and Examples of 51 Microcontroller’s C Language[M]. POSTS & TELECOM PRESS, 2008, p. 127–174 [2] TIAN Li, TIAN Qi, DAI Fang-zhen. Quick Start of Microcontroller C Programming Language[M]. POSTS & TELECOM PRESS, 2008 ,p. 277–299 [3] ZHANG Xin-rong. Design of the Stepping Motor Control System based on Microcontroller[J]. Journal of Automation Applications, 2010;9(7): p. 6-8. [4] WANG YI YOU Li-jia. Study of Step Motor Control System Based on AT89S51 Single Chip Microcomputer[J]. Journal of Mechatronics,2008;4. p. 86-88 [5] CHEN Shi-long. Stepping Motor Control System based on Microcontroller[J].Journal of Ningde Teachers College (Natural Science), 2009,1(21): p. 16-19. [6] LI HUA.Practical Interface Technology of MCS-51 [M].BEIHANG UNIVERSITY PRESS,1993,p. 148–158
5