You are on page 1of 3

International Journal of Computer Science & Communication Vol. 1, No. 1, January-June 2010, pp.

189-191

Microcontroller Based Clockwise/Anticlockwise Stepper Motor Controller Using PC Keyboard Via Com Port
Mandeep Singh1, Rekha2 & Balwinder Singh3
Centre for Development of Advanced Computing (C-DAC), Mohali 160071, India (A Scientific Society of Ministry of Communication and Information Technology, Govt. of India). 2 University Institute of Engg. & Technology (UIET), Panjab University, Chandigarh. 1 mandeep@cdacmohali.in, 2er.rekha@yahoo.co.in, 3balwinder@cdacmohali.in
1, 3

ABSTRACT Computer controlled stepper motors are one of the most versatile forms of positioning systems. Open loop control of stepper motors suffers from a major disadvantage that the rotation of the rotor becomes oscillatory and unstable in certain speed ranges. This paper presents the micro stepping technique which overcomes the problem of instability and at the same time provides high accuracy for micro stepping applications. This technique improves electronically resolution of the stepper motors and suppresses oscillations due to effects of mechanical resonance. This has greatly enhanced its usefulness in modern control applications. Keywords: Microcontroller, Step Sequence, Stepper Motor, Keil Compiler

1. INTRODUCTION

2. SYSTEM DESIGN

In most process applications the cost of the control system is only a relatively small fraction of the total cost and the cost of the processor is only a fraction of the control systems cost. Except in some isolated instances, there is not a large number of situations in which direct replacement of control components with a single microcontroller driven version will result in either substantial cost saving or significantly important performance. A large number of applications have been already done for a variety of unit applications, i.e. control of processes that do not interact strongly with other processes. There are typically special purpose applications for which single microcontroller system has unique hardware and software. This application describes the use of single microcontroller to control the speed, direction and rotation angle of a stepper motor by sending pulse sequences to the motor winding in response to the control commands [1]. Commands executed by the code in this application include: single step the motor rotates in a clockwise or counterclockwise direction (i. e. rotate the rotor through a certain number of degrees) when the corresponding key is pressed from the computer keyboard [1]. This is a general purpose application for which a degree of adjustment or programmability is required to meet the needs of specific processes and their performances.

The system is built around the Atmels (AT89c51) 8-bit microcontroller. In this system a unipolar stepper motor is used (which is used widely in all kinds of floppy drives and CD drives) as shown in Fig. 1 with following specifications: Maximum voltage: 5V DC, Step angle: 1.8 degree, Steps per revolution: 200. Unipolar stepping motors with 5 or 6 wires are available and usually wired as shown in Fig. 2 with a center tap at terminal 1 and 2 on each of the two windings. In use, the center taps of the windings are typically wired to the positive supply and the two ends of each winding are alternately grounded to reverse the direction of the field provided by that winding.

Fig 1: Unipolar Stepper Motor

190

International Journal of Computer Science & Communication (IJCSC)

the coil is turned off. As ULN 2003 has inbuilt driver circuit so it is preferred [5]. The 89c51 has two pins that are used specifically for transferring and receiving data serially. These pins are called TxD and RxD and are part of Port 3 (P3.0 and P3.1). These pins are TTL compatible and therefore require a line driver to make them RS232 compatible. One such converter is MAX232 that converts RS232 voltage levels [2].
Fig 2: Unipolar Stepper Motor Coil

Fig. 3 shows Microcontroller (AT89c51) based circuit which can control all the functions of stepper motor. Crystal oscillator of frequency 11.0592 MHz is used to produce clock frequency for the microcontroller. Pins 21 through 28 of U2 are connected to pins 1 through 4 of U3 as shown in Fig. 4 (Schematic Diagram). However the 89c51 lacks sufficient current to drive the stepper motor windings, so driver ULN2003 (U3) is used to energize the stator. Instead of ULN 2003 transistors can also be used. If transistors are used as drivers, diodes should be used to take care of inductive current generated when

The 89c51 has two pins that are used specifically for transferring and receiving data serially. These pins are called TxD and RxD and are part of Port 3 (P3.0 and P3.1). These pins are TTL compatible and therefore require a line driver to make them RS232 compatible. One such converter is MAX232 that converts RS232 voltage levels [2].

Fig 3. Functional Block Diagram

Fig 4: Schematic of Final Hardware

2.1. Clockwise/Anticlockwise Rotation Here, Unipolar stepper motor having 5 leads is used: 4 leads representing the four stator windings and one for centered-tapped leads. As the sequence of power is applied to each stator winding the rotor will rotate. There are several widely used sequences where each has a different degree of precision. 2.2. Step Sequence Stepper motors can be driven in two different patterns or sequences [3]: Full Step Sequence; Half Step Sequence.

coils are energized in clockwise and anticlockwise direction is given in table1.


Table 1 Full Step Sequence

Clockwise Rotation Wind ing A 1 1 0 0 Wind ing B 0 1 1 0 Wind ing C 0 0 1 1 Wind ing D 1 0 0 1

Anticlockwise Rotation Wind ing A 0 0 1 1 Wind ing B 0 1 1 0 Wind ing C 1 1 0 0 Windi ng D 1 0 0 1

2.2.2. Half Step Sequence In Half Step Sequence motor, step angle reduces to half the angle in full mode. So the angular resolution is also increased i.e. it becomes double the angular resolution in full mode. Also in half mode sequence the number of steps gets doubled as that of full mode. Half mode is

2.2.1. Full Step Sequence In the full step sequence, two coils are energized at the same time and motor shaft rotates. The order in which

Microcontroller Based Clockwise/Anticlockwise Stepper Motor Controller Using PC Keyboard Via Com Port

191

usually preferred over full mode. The sequence given in table 2 is called 8 step switching sequence.
Table 2 Half Step Sequence
Winding A 1 1 1 0 0 0 0 0 Clockwise rotation Winding Winding B C 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 Winding D 1 0 0 0 0 0 1 1 Winding A 0 0 0 0 0 1 1 1 Anticlockwise rotation Winding Winding Winding B C D 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1

3. SOFTWARE

The software program is written in assembly language for AT89c51 and then compiled to hex file using Keil compiler software. The compiled HEX program is then burnt on AT89c51 chip. It works as per flow chart shown in Fig. 5. Another program in C language is used for transmission of ASCII code of the key pressed from the keyboard as shown in Fig. 6. ASCII code of the key pressed is then transmitted serially through serial port (Com1) of computer and is received by the SBuffer (SBuff) of microcontroller. The microcontroller checks the ASCII code of the key pressed from the computer. If the pressed key is F then the microcontroller load step sequence to rotate stepper motor in clockwise direction and if key pressed is R then the microcontroller load step sequence to rotate the motor in anticlockwise direction. The RPM of the motor can also be increased or decreased by changing the time delay.

Fig 6: Flow Chart for C Program

4. CONCLUSION

The implementation of microstepping for a standard stepper motor is presented in this paper. The key feature of this controller lies in its flexibility to provide for high position resolution operation of a given stepper motor control system. In the case of retrofitting an existing standard stepper motor controller to a high position resolution controller, the technique presented here appears to be an excellent consideration. The controller is capable of controlling multiple stepper motors simultaneously with very precise resolution.
REFERENCES [1] Baluta, G, Microstepping Mode for Stepper Motor Control, IEEE International Symposium on Signals Circuits and Systems, 2, pp.1-4, July 2007. Baluta, G. Coteata, M., Precision Microstepping System for Bipolar Stepper Motor Control, IEEE International Conference on Electrical Machines and Power Electronics, pp. 291 296, Sept. 2007. Rusu, C. Szoke, E, Embedded System Design for FieldOriented Stepper Motor Control, IEEE International Conference on Optimization of Electrical and Electronic Equipment, pp. 63 68, May 2008. Rusu, C. Birou, I. Szoke, E, Model Based Design Controller for the Stepper Motor, IEEE International Conference on Automation, Quality and Testing, Robotics, 2, pp.175 179, May 2008. Mazidi Muhammad Ali, The 8051 Microcontroller and Embedded Systems, Prentice Hall of India, New Delhi, India, pp. 492-507, Chap 17, 2007.

[2]

[3]

[4]

[5]
Fig 5: Flow Chart for Assembly Program

You might also like