Stepper Motor Control System using Microcontroller and PC

Introduction  

The purpose of this project is to control a stepper motor, with instructions received from the PC via a serial communication link to the 8051. Stepper motors are often used in conjunction with micro controllers to provide precisely controlled motor power. Stepper motors are electrical motors that rotate to a precise number of degrees corresponding to each step applied, as compared to regular motors, which simply rotate continuously. To driving a stepper motor we have to apply a series of voltages to the four coils of the stepper motor. The coils of stepper motor are energized in a predefined sequence to rotate in steps.

The Stepper Motor

A stepper motor is similar to a conventional electrical motor in addition it has the added ability to rotate for a fix amount of degrees for each voltage pulse given to it. This ability of stepper motor allows the it to move between two fixed points precisely. the operation of a stepper motor is shown in Figure below. In the picture of a typical stepper motor along its winding and connection is presented. It may be noticed that there are six leads of stepper motor instead of the usual two leads of usual motors. The increased or greater wires are actually needed to make electrical connection among multiple coils in the motor, which this allows the motor to move in "step" a fraction of a rotation. Pulsing the coils will cause the motor to rotate clockwise or anticlockwise depending on the sequence of pulses chosen. The speed or rotational velocity is functioned or controlled through the frequency of the pulses to the coils.

Generally the stepper motors are available with various steps per revolution like 12, 24, 72, 144, 180, and 200 which corresponds in shaft increments of 30, 15, 5, 2.5, 2, and 1.8 degrees per step.

There are many types of stepper motors available in market like Stepper motors can be bipolar, requiring two power sources and/or a switchable polarity of power source, or it may be Unipolar, requiring only one power source. They are powered by dc current power supply and require digital control circuit to produce the coil energizing sequences for rotation of the stepper motor. A stepper motor can have a permanent magnet or variable reluctance dc motor that has the following performance characteristics:

1. Make it possible for Rotation in both directions,

2. It have Precise angular steps,

3. It is responsible for Repetition of accurate motion,

4. The stepper motors can hold specific torque at zero speed,

5. The stepper motors have capability for digital control. 

Examples of Application of Stepper Motor

In many applications where motors are used for rotating any mechanical parts of machines. Some times fixed amounts of rotation are required instead of continuous rotation. Fore example, lets discuss a printer, there is need to move parts precisely in steps. In order to print some text and graphics from printer, it needs to know where the printer head is currently located in relation to the frame and how much paper to printer has been fed. Other examples of stepper motor applications are robotic arms movements, hard disk drives and analog clocks. All of these machines require precise movement of their parts or require knowledge of the exact location of the rotating equipment from any reference which is only possible by using stepper motor. 

Types of stepper motor

There are three types of stepper motor: 

  1. Variable Reluctance Motor
  2. Unipolar Motors
  3. Bipolar stepper motor
As we have used Unipolar Stepper motor in this project so we are mainly concerned with this. Some details about Unipolar stepper motor are given as:

Unipolar stepper motor:

Power Connection of Uni polar Stepper Motor
 Figure-1: The Power Connection of  A Unipolar stepper motor

The Description and Connection of  A Unipolar stepper motor:

 Unipolar stepping motors with 5 or 6 wires are usually wired as shown in the schematic in Figure 1, with a center tap on each of two windings.  During the use of stepper motor, the center taps of its windings are wired to the positive supply, and the two ends of each winding are alternately grounded to reverse the direction of the field provided to the winding. The stepper motor cross-section as shown in Figure 1, is of a 30 degree per step motor. The Stepper Motor winding number "1" is used for the top and bottom stator pole, while stepper motor winding number "2" is used for the left and right motor poles. The rotor of the motor is a permanent magnet having 6 poles, in which 3 south and 3 north, arranged around its circumference. For higher angular resolutions, the motor must have proportionally more poles. The 30 degree per step motor is one of the most common permanent magnet motor designs, although some other like 15 and 7.5 degree per step motors are widely available. As shown in the figure above, the current flowing from the center tap of winding "1" top stator pole to be a north pole while the bottom stator pole is a south pole. This will attract the motor into the position as required. If the power to winding "1" is removed and winding "2" is energized, the motor will turn into 30 degrees, which is equal to one step. To rotate the motor continuously, we have to apply power to the two windings in a sequence. Assuming the positive logic, where a "1" means turning on the current through a motor winding, the following two control sequences will rotate the motor as illustrated in Figure 1 clockwise for 24 steps which are equal to 4 revolutions.


Specification of Stepper Motor

Value

Unit

Step angle

1.8

Degree

Step angle tolerance - non cumulative

5.4

Minute

Nominal phase (winding) parameters and ratings: voltage

5

Vdc

Resistance at 20 C

5

W

Current

1

A

Inductance

10

mH

Holding torque

460

mNm

Detent torque

30

mNm

Working torque (max)

320

mNm

Rotor inertia

135

gcm­­2

Pull-in-rate

880

Steps/s

Ambient temperature

-20 to +50

oC

Temperature rise (max. above ambient)

80

oC

Insulation Class

B

 

Weight

600

g


Table-1:The specification of Stepper Motor

Microcontroller 

89C51 Microcontroller has been used in the project to provide the controlling sequence phase exercitation. Microcontroller actually receives the data from the personal computer trough serial port and generates the pulse sequence for require number of steps and for required number of time having proper time breaks. It produces the sequence on the first four pins of port A. Then the voltage sequence is amplified using Darlington coupled transistors for the required level of current. Microcontroller receives the following data from PC and stores them in the following specified registers: 

Data

Registers

Number of rotations

R1

Number of steps

R2

Delay between two steps

R4 and R5

Control Byte

R3

 

Table-2: Registers Contents of Microcontroller Atmel AT89s51

Serial port Mode and Baud Rate

In this project we have used serial port to have proper communication between personal computer and the microcontroller. The port has been used in Mode1 i.e. 8-Bit UART with variable baud rate. In mode-1, there are10 bits transmitted on TXD or received on RXD. These consist of Start bit (always 0) 8 data bits and a stop bit (always 1). In the 89C51 Microcontroller baud rate is set by timer 1 overflow rate. The baud rate has been fixed to 9600 bits/sec

Parallel port

To transmit the required sequence of data to stepper motor phases port-1 has been used in the project, first the proper data is calculated according to the rotating direct of the motor and stored in micro accumulator then it is shifted to port-1.

Timer 0

Timer-0 is used for the delay generation between successive steps to rotate the motor at specific speed. The timer run in mode 1 (the 16 bit mode), and the initial values are sent from the PC according to the required rate of rotations

A sample calculation for timer load values will be made on soon in this document.

Timer 1

Timer-1 is used for the baud rate generation for the serial port communication. It has been used in mode 2 the auto reload mode.

Personal Computer

Personal Computer is used to take input from the user and then make trivial calculations with this data and just send it to the microcontroller the microcontroller takes over the control and perform the given task. 

Data Input through PC

Following four data are made input to the pc from the user: 

  1. Total number of rotation
  2. Total numbers of steps
  3. RPM (speed)
  4. And the direction

RPM is used to calculate the delay between two successive steps to generate the required RPM using this formula: 

Steps/sec        = RPM  x  200  /  60

 delay ( m sec)  =        Int(1000000) steps/sec

this delay is calculated in microseconds

Example: -

RPM=100

Steps/sec         = 100  x 200 / 6   = 333.33

delay               = 1000000 / 333.33333   = 3000 m sec

Then delay is multiplied with it to generate the proper values for timer initializing values and is transferred to the microcontroller. Low byte of delay is transferred to microcontroller register R4 and high byte is transferred to register R5. 

Serial communication between Microcontroller and PC

Communication between personal computer and microcontroller is done using the serial port of both. Every time when a new data is received from the user through the front-end program, it needs to be sent to microcontroller to be processed up on accordingly. As there is a very little amount of data to be transferred from PC to microcontroller serial port was chosen to make the communication. The port has been used in Mode1 i.e. 8-Bit UART with variable baud rate and the baud rate has been fixed to 9600. but there is a voltage levels compatibility problem between the COM ports of personal computers and the microcontroller 89C51.voltage levels for two devices are shown in the following tables: 

Devices

Data bit 1

Data bit 0

Unit

PC (COM1 or COM2)

+12

-12

V

Microcontroller

5

0

V

 Table-3: The Voltage levels conversion on serial ports using MAX232.

In the next post the software (programming code for microcontroller for control of stepper motor will be uploaded.

Software is here: Interface of Stepper Motor with Microcontroller AT89S51 with Software and code in C++ Language and Assembly Language 


No comments:

Post a Comment

Please ask if you have any question regarding the programming of MCU, or have any problem in development of your electronics project. microcontroller51.blogspot.com

Popular Post (All Time)