Security System Stepper Motor Control Micro Controller Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

There are different types of security models in the present day world. A prototype of security model is considered in which stepper motor is controlled using micro controller. Stepper motor is only considered because of its advantages such as precise positioning and accurate placement. These can be controlled by using microprocessors but micro controllers have several advantages over microprocessors due to which it is considered for controlling of motor. Though there are different types of stepper motors selection of motor is based on the application. Micro controllers produce very minute currents which are not sufficient to drive the stepper sufficient to drive the stepper motor, so a driver circuit is used namely ULN 2003 to amplify the current . ULN 2003 consists of 7 pairs of Darlington pair transistors which are used to amplify the current. Sensors used for protection consists of transmitter and receiver and if any thing is obstructed between them signal will be given to the controller and stepper motor rotates to that side, by connecting a camera to the stepper motor the image can be monitored. This can be further extended and can be used in robotics which is the future of the world.

Index Terms:-Micro controller ,Interfacing circuit Web cam


The AT89s52 is a low power, high performance 8-bit micro computer with 8K bytes of flash programmable and erasable read only memory(PEROM).The device is manufactured using Atmel's high density nonvolatile memory technology and is compatible with the industry standard 80c51 and 80C52 instruction set and pin out. The on-chip flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with flash on a monolithic chip, the Atmel AT89s52 Is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The main advantages of 89s52 over 8051 are

1.Software Compatibility 2.Program Compatibility 3.RewritabilityThe 89s52 micro controller has an excellent software compatibility, i.e. the software used can be applicable to any other micro controller. The program written on this micro controller can be carried to any base.

Program compatibility is the major advantage in 89s52. The program can be used in any other advanced micro controller. The program can be reloaded and changed for nearly 1000 times. stepper motor is an electromechanical device which converts digital pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. The stepper motor can be controlled by using microprocessor also but micro controller is advanced version of microprocessor, so we have used micro controller to control the stepper motor due to its advantages over microprocessors. General micro controller is 8051 and there are lot of micro controllers in 8051 family. we have considered one such micro controller namely 89s52 which have features more than 8051 and also cheap compared with other micro controllers of 8051 family such as 89c51 and 8052. The features of 89s52 are also more than other micro controllers. For motion control, means to accurately control the movement of an object based on speed, distance, load, inertia, or a combination of all these factors, there are numerous types of motion control systems including :1.Stepper motor 2.Linear stepper motor3.D.C. Brush motor

4.Brushless servo control systems 5.Servo control systems

Here we concentrate on stepper motor technology.

DEFINITION :A 'stepper motor" is an electromechanical device which converts electrical pulses into discrete mechanical movements .The name stepper motor is used because this motor rotates through a fixed angular step in response to each input current pulse received by its controller.


A stepper motor transforms electrical pulses into equal increments of rotary shaft motion called "steps". Step motor has non-excited rotor and wound stator. The number of teeth's or poles on the rotor and the number of poles on the stator determines the size of the step. A single pulse develops a detent torque, which turns the rotor by one angular step, and it comes to rest after a short damped upon the system inertia, elasticity and damping. Stepper motor can also provide precise open-loop control systems because no feedback need be taken from the output shaft, since their rotational speed is determined solely by the step pulse frequency independent of load. The unique feature of a step motor is that its output shaft rotates in a series of discrete angular steps. One step being taken each time a command pulse is received when a definite number of pulses are received when a definite number of pulses are supplied; the shaft tunes through a definite know "angle". Stepper motor is marvel in simplicity because it has no brushes, commutators and no windings in the rotor. These are mainly designed for using as a feedback motor in feedback control system. Stepper motors are ideally suited for situations1.Precise positioning 2.Precise speed control . Stepper motors are popular now a day because they can be controlled directly by computers and microprocessor and programmable control is efficient and easiest way to control the motor. Stepper motor can run up to 20,000 steps per second. When the pulse rotating is high, the shaft rotation seems continuous. This is called "Slewing". If the stepping rate is increased too quickly the motor loses synchronism. There is no problem of stalling of stepper motor. Stepper motor develops torques in the ranging from 1 micro N-m up to 40 micro N-m in a motor of 15 cm diameter suitable for machine tool applications. Their power output ranges from about 1 watt to a maximum of 2500 watt.

Stepping motors fill a unique niche in the motor control world. These motors are commonly used in measurement and control applications. Sample applications include ink jet printers, CNC machines and volumetric pumps. Several features common to all stepper motors make them ideally suited for these types of applications. These features are follows.

1.Brushless 2.Load Independent 3.Open Positioning 4..HoldingTorque 5.Excellent Response : Stepper motor is used because it has 1.Small in size 2.Work well over a range of speeds 3.Can be used for motion or position control

WORKING PRINCIPLE :Stepper motors consist of a permanent magnet rotating shaft, called the "rotor" and electromagnets on the stationary portion that surrounds the motor, called the "stator".



The 8051 contain 34 general purpose or working registers. Two of them registers A and B are called special function registers (SFRs). A and B hold results of many instructions particularly math and logical operates of the 8051 central processing unit (CPU). The other 32 are arranged as part of internal RAM in four banks, B0-B3 of eight registers and comprise the mathematical core. The accumulator ACC, register is the more versatile of the two CPU registers and used for many operations, including addition, subtraction, integer multiplication and division and Boolean bit manipulations. The register A is also used for all data transfer between the 8051 and any external memory. The B register is used with Micro Controllers The A register for manipulations and divisions operations and has no other function other than as a location where data may be stored [4]


The program status word is given below figure

THE STACK AND THE STACK POINTER The stack refers to an area of the internal RAM that is used in conjunction with certain op code to store and retrieve data quickly. The 8-bit sack pointer (SP) register is used by the 8051 to hold an internal RAM address that is called the top of stack. The address held in the SP registers is the locations in the internal RAM where byte on the stack operation last. The SP gets incremented before storing data on the stack i.e., stack in the stack grows up, as data is stored. As the data is retrieved from the stack the byte is read from the stack, and then the S Available bytes of stored data. The layout of the program memory are shown in the fig

P decrements to point to next


Microprocessor and micro controllers generate from the same basic idea and manufactured by the same engineers and also made available to the same types of systems designers and programmers. The main difference between them is discussed here. A microprocessor is named after the general-purpose digital computer central processing CPU. But it is not a complete digital computer. The block diagram of a microprocessor CPU is shown below

The above block diagram contains an arithmetic and logical and unit ALU, a program counter, a stack pointer SP, the principal register accumulator, some working registers or general purpose registers, clock timing circuits and interrupting circuits. It can be made complete microcomputer when some more units are added. These units are memory, I/O devices, and special purpose devices; the memory devices are read only memory and random access memory,

The prime use of microprocessor is to read data perform extensive calculations on the data and store those calculations in a mass storage device or display the results. The programs use by the microprocessor are stored in mass storage devices and loaded into RAM as user directs. A few microprocessor programs are stored in ROM. The ROM based programs are primarily small fixed programs that operate peripherals and other fixed devices that are connected to the system.

One can understand the micro controller as a true computer on a chip. The design incorporates all of the features found in microprocessor CPU: ALU, PC, SP and REGISTERS. It also has added the other features needed to make a complete computer: ROM. RAM, PARALELL I/O, serial I/O, counters and a clock circuit. Like the microprocessor, a micro controller is a general-purpose device, but one that is meant to read data, perform limited calculations. The prime use of micro controller is to control the operations of a machine using fixed program that is stored in ROM that does not change over the lifetime of the system. The design approach of a micro controller resembles that of microprocessor, which makes a single design that can be used in many applications, the microprocessor design accomplishes the property of flexible and extensive use of multi byte instructions. These instructions work in hardware a configuration that enables large amounts of memory and I/O to be connected address and data bus pins on the integrated circuit package. Much of the activity in the microprocessor has to do with moving code and data to and from external memory to the CPU. The architecture features working register that can be programmed to take part in memory access process and the instruction set is aimed at expediting the activity across process, and the instruction set is aimed at expediting this activity in order to improve throughput. The pins that connect y\the microprocessor or to external memory are unique, each having a single function data is handled in byte, or large sizes. The main difference of comparison between microprocessor and micro controller can be highlighted from the following fact that most microprocessors have many operational codes for moving data from external memory to CPU, where as the micro controller may have one or two, microprocessors may have one or two types of bit handling instructions and micro controllers will have many. The microprocessor is responsible for rapid movements of code and data from external address to the chip where as micro controller is concerned with rapid movement of bits within the chip the micro controller can work as a computer without any external digital parts whereas the microprocessor requires many additional parts to be operational.

HARDWARE AND SOFTWARE The hardware consists of micro controller, stepper motor and sensor circuit. AT89S52 micro controller chip is used in the hardware due to its economic cost. The features of 89S52 are same as that of 8051 and consists of more memory than it. Based upon our requirement any chip can be used which is family of 8051. The stepper motor considered in our project is 1.8 degrees and sensor circuit consisting of totally 8 infrared sensors placed on it. IR sensor consists of a transmitter and receiver. Driver circuit is required which is used to interface stepper motor with micro controller because minute currents are obtained from micro controller which are not enough to rotate the stepper motor. The currents are to be increased and given to the stepper motor for which ULN2003 is used. This consists of 7 Darlington pair transistors which are used to amplify the current.


A Micro controller is a single-chip microcomputer that contains all the components such as the CPU, RAM, some form of ROM, I/O ports, and timers. Unlike a general-purpose computer, which also includes all of these components, a micro controller is designed for a very specific task -- to control a particular system. Micro controllers are sometimes called embedded micro controllers, which just mean that they are part of an embedded system.

The micro controller development effort resulted in the 8051 architecture, which was first introduced in 1980 and has gone on to be arguably the most popular micro controller architecture available. The 8051 is a very complete

Micro controller with a large amount of built in control store (ROM & EPROM) and RAM, enhanced I/O ports, and the ability to access external memory. The maximum clock frequency with an 8051 micro controller can execute instructions is 20MHZ. Micro controller is a true computer on chip. The design incorporates all of the features found in a microprocessor: CPU, ALU, PC, SP and registers. It also has the other features needed to, make complete computer: ROM, RAM, parallel I/O, serial I/O, counters and a clock circuit.

The 89S52 contains a non-volatile FLASH program memory that is parallel programmable. For devices that are serial programmable (In-System Programmable (ISP) and In-Application Programmable (IAP) with a boot loader)All three families are Single-Chip 8-bit Micro controllers manufactured in advanced CMOS process and are Derivatives of the 8051 micro controller family. All the devices have the same instruction set as the 8051.


1.Compatible with MCS-51® Products 2.8K Bytes of In-System Programmable (ISP) Flash Memory3.Endurance: 1000 Write/Erase Cycles 4. 4.0V to 5.5V Operating Range 5. Fully Static Operation: 0 Hz to 33 MHz 6. 256 x 8-bit Internal RAM

7. 32 Programmable I/O Lines 8. Three 16-bit Timer/Counters

9. Eight Interrupt Sources

Pin Diagram: The Pin diagram of the micro controller is shown in the following figure.

ULN 2003:

The current output from micro controller port is not sufficient to drive the relays which serve the purpose of the switch. To serve this purpose we use ULN2003 driver IC. The ULN2003 is a high voltage, high current Darlington drivers comprised of 7 NPN Darlington pairs.


The stepper motor is controlled using micro controller in our project. C language is used for programming and implemented in security system successfully. Hard ware is also implemented successfully. The inputs are given to the sensors and output is taken as the rotation of the stepper motor. Some sensors are taken and are placed circularly round a board and which ever sensor is obstructed stepper motor is rotated to that side and the rotation is observed successfully.


Future scope of project mainly deals with robotics which is vastly implemented now a days. Our project is related to embedded systems which is the future of the world. There are several applications of stepper motor to which our project can be implemented. Based on required application stepper motor can be considered and any member of general micro controller family may be taken. This can be further extended to robot movement, image scanning etc.