Anda di halaman 1dari 35

CHAPTER 1 INTRODUCTION

1.1 INTRODUCTION TO THE PROJECT


This project is Advanced car parking system using AT89S52 microcontroller. Use of embedded technology makes this closed loop feedback control system efficient and reliable. Microcontroller allows dynamic and faster control. AT89S52 micro controller is the heart of the circuit as it controls all the functions.

The main aim of this project is to park a car in a selected area i.e. the area is checked in a selected region by looking at the count on the LCD, count is found by passing the car through the gates. Using this project, the arrival of the car can be identified in either direction. For this purpose, two IR transmitter and receiver pairs are used in this project.

One IR TX-RX pair is placed at one end of the gate. The second pair is placed at another end of the gate. In each pair, the TX and RX are arranged face to face across the path i.e., TX is situated at one side of the path and RX is placed at another side of the path since the RX should continuously get the signal from the transmitter.

Whenever any car is coming on the path, the IR signal will be disturbed due to the interruption of the car. Thus the microcontroller identifies the arrival of the car. After a small delay, the microcontroller opens the gate by rotating the stepper motor. While the car is leaving after a small delay, the microcontroller opens the gate by rotating the stepper motor at the exit end.

The microcontroller should know whether the car is arrived at the other end of the gate. For this purpose, the second IR pair is used. This IR pair identifies the car since the IR signal is interrupted when the car comes in between the TX and RX. The microcontroller will wait for the car to leave the IR pair and after leaving, the receiver again gets IR signal. Till this time the gate

Page 1 of 35

is closed. Now, after the car had left the path, the microcontroller will open the gate by rotating the stepper motor.

This project is more useful and there is no chance for accidents since time delays or length of the train is not calculated. Just the IR pairs will detect the arrival and departure of the train. The system also detects the fire occurrence in the train and the breakage of the railway track line.

1.2 OBJECTIVE OF THE PROJECT


The project intends to control the gate when the car is entering and leaving the parking area in order to park it in a particular lot available in that area. The project also has the task of placing the car perfectly in the lot by monitoring the status of the Ultra-Sonic sensor and avoiding the hitting of the car to any obstacle while parking. If any obstacle is present while reversing the car to park, the sensor detects it and the system immediately alerts the buzzer.

This project is a device that collects data from the Ultra-Sonic sensor and the IR sensors, codes the data into a format that can be understood by the controlling section. This system controls the gate by closing or opening it when the car is entering or leaving the parking area and also activates the buzzer if the Ultra-Sonic sensor detects any obstacle while parking.

The objective of the project is to develop a microcontroller based control and alert system. It consists of a sensor module, microcontroller, buzzer, ULN driver and the stepper motor.

1.3 BACKGROUND OF THE PROJECT


The software application and the hardware implementation help the microcontroller read the output values from the IR sensors and control the gate at the time of the entry and exit of the car into and from the parking area respectively. The system is totally designed using IR and embedded systems technology. The Controlling unit has an application program to allow the microcontroller read the sensor output and perform the specified task. The performance of the design is maintained by controlling unit. Page 2 of 35

CHAPTER 2 OVERVIEW OF THE TECHNOLOGIES USED

2.1 BLOCK DIAGRAM

Page 3 of 35

2.2 EMBEDDED SYSTEM 2.2.1 INTRODUCTION


An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below: Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

2.2.2 ADVANTAGES OF EMBEDDED SYSTEMS


1. They are designed to do a specific task and have real time performance constraints which must be met. 2. They allow the system hardware to be simplified so costs are reduced. 3. They are usually in the form of small computerized parts in larger devices which serve a general purpose. 4. The program instructions for embedded systems run with limited computer hardware resources, little memory and small or even non-existent keyboard or screen.

Page 4 of 35

2.2.3 EMBEDDED SYSTEMS DEVELOPMENT BOARD USING 8051


An embedded system can be defined many ways. The suitable definitions are a computing device that does a specific focused job or the combination of hardware and software to do a dedicated job. Nowadays embedded systems are becoming part of our daily lives, as such examples are washing machines, DVD players, ATM machines, mobile phones, refrigerators, coffee machines etc. Embedded systems are becoming so popular because of their salient features like quick response time, low power consumption, low cost, less complexity, user friendly and so on. And the Embedded systems have very limited resources, particularly the memory. Designing an embedded system is not an easy task because it should contain less resources and development time is very important in designing of every application. So to reduce this development time, we should have powerful tools like development boards. Microcontrollers play a vital role in most of low level and middle level embedded systems applications. This development board helps us to simulate most of the embedded system projects. We are choosing 8051 microcontroller as the heart of this development board because of its low cast and plenty of free tools in the market and more number of manufacturers. In this development board, we are including all the necessary sections to develop and simulate most of the projects. The sections are ISP which is used to dump the code onto microcontroller, the display units are 4 seven segment displays, 8 bicolor LEDS and 16x2 LCD. The external memory (24c04) and real time clock (with battery back up) works with I2C protocol, one 8 channel ADC. For stepper and dc motor driver, we have one driver IC (l293d), serial communication section to communicate with PC and sensors like light sensor, temperature(LM35), magnetic and TV remote receiver(TSOP 1738) .And 8 momentary switches to give the input conditions. One buzzer useful in alert based applications and two triacs with optocouplers to control the high voltage devices like fans and bulbs. Each section contains separate on/off switch and power indication led. We can switch in the respective sections according to our application.

Page 5 of 35

2.2.4 MICROCONTROLLERS:
Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The Intel 8051 is Harvard architecture, single chip microcontroller (C) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8051compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NV-RAM. The present project is implemented on Keil Uvision. In order to program the device, Proload tool has been used to burn the program onto the microcontroller

2.3 BENEFITS
y y y y Low cost Not component intensive Efficient and uncomplicated wiring Can be implemented in any car parking system

Page 6 of 35

CHAPTER 3

HARDWARE IMPLEMENTATION
3.1 AT89S52 3.1.1 A BREIF HISTORY OF MICROCONTROLLER
Microprocessors brought the concept of programmable devices and made many applications of intelligent equipment. Most applications, which do not need large amount of data and program memory, tended to be costly. The microprocessor system had to satisfy the data and program requirements so, sufficient RAM and ROM are used to satisfy most applications. The peripheral control equipment also had to be satisfied. Therefore, almost all-peripheral chips were used in the design. Because of these additional peripherals cost will be comparatively high. So peripheral devices like Timer/Counter, Parallel programmable port, Serial Communication Port, Interrupt controller and so on, which were most often used were integrated with the Microprocessor to present the Micro controller .RAM and ROM also were integrated in the same chip. The ROM size was anything from 256 bytes to 32Kb or more. RAM was optimized to minimum of 64 bytes to 256 bytes or more.

3.1.2 INTRODUCTION TO AT89S52


Coming to the question of why to use 89S52 of all the 8-bit Microcontroller available in the market the main answer would be because it has 8kB Flash and 256 bytes of data RAM32 I/O lines, three 16-bit timer/counters, a Eight-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power down Mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset. The Flash program memory supports both Page 7 of 35

parallel programming and in Serial In-System Programming (ISP). The 89S52 is also InApplication Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running

3.1.3 FEATURES OF AT89S52


y y y y y y y y y y y y y y y y y 8K Bytes of Re-programmable Flash Memory. RAM is 256 bytes. 4.0V to 5.5V Operating Range. Fully Static Operation: 0 Hz to 33 MHzs Three-level Program Memory Lock. 256 x 8-bit Internal RAM. 32 Programmable I/O Lines. Three 16-bit Timer/Counters. Eight Interrupt Sources. Full Duplex UART Serial Channel. Low-power Idle and Power-down Modes. Interrupt recovery from power down mode. Watchdog timer. Dual data pointer. Power-off flag. Fast programming time. Flexible ISP programming (byte and page mode).

3.1.4 DESCRIPTION
The AT89s52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable memory. The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on chip flash allows the program memory to be reprogrammed in system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU Page 8 of 35

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. In addition, the AT89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The power-down mode saves the RAM contents but freezes theoscillator disabling all other chip functions until the next hardware reset.

3.1.5 PIN DIAGRAM

Fig: Pin diagram Page 9 of 35

3.1.6 BLOCK DIAGRAM

Fig: Block diagram

Page 10 of 35

3.1.7 PIN DESCRIPTION VCC: Supply voltage. GND: Ground. PORT 0: Port 0 is an 8-bit open drain bi-directional I/O port, each pin can sink eight TTL
inputs. When 1s are written to port 0 these can be used as high- impedance inputs. Port 0 can also be configured to be the multiplexed low- order address/data bus during accesses to external program and data memory.

PORT 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during flash programming and verification. Port Pin P1.0 P1.1 Alternate Functions T2 (external count input to Timer/Counter 2), clock-out T2EX (Timer/Counter 2 capture/reload trigger and direction control)

Table 3.1: Alternate functions of Port1

PORT 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Page 11 of 35

PORT 3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification. Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory write strobe) RD (external data memory read strobe)

Table 3.2: Alternate functions of Port 3

RST: Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.

ALE/PROG: Address Latch Enable is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking Note, however, that one ALE pulse is skipped during each access to external data memory.

OSCILLATOR CONNECTIONS

C1, C2 = 30 pF 10 pF for Crystals = 40 pF 10 pF for Ceramic Resonators Page 12 of 35

EXTERNAL CLOCK DRIVE CONFIGURATION

XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier. XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divideby-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

3.2 POWER SUPPLY 3.2.1 INTRODUCTION


The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage. Page 13 of 35

Fig: Power supply Power supply is a reference to a source of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is called a power supply unit or PSU. The term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely to others

This power supply section is required to convert AC signal to DC signal and also to reduce the amplitude of the signal. The available voltage signal from the mains is 230V/50Hz which is an AC voltage, but the required is DC voltage (no frequency) with the amplitude of +5V and +12V for various applications.

In this section we have Transformer, Bridge rectifier, are connected serially and voltage regulators for +5V and +12V (7805 and 7812) via a capacitor (1000F) in parallel are connected parallel as shown in the circuit diagram below. Each voltage regulator output is again is connected to the capacitors of values (100F, 10F, 1 F, 0.1 F) are connected parallel through which the corresponding output (+5V or +12V) are taken into consideration.

Page 14 of 35

Fig: Power Supply Circuit diagram

3.2.2 TRANSFORMER
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled electrical conductors. A changing current in the first circuit (the primary) creates a changing magnetic field; in turn, this magnetic field induces a changing voltage in the second circuit (the secondary). By adding a load to the secondary circuit, one can make current flow in the transformer, thus transferring energy from one circuit to the other.The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP factor equal to the ratio of the number of turns of wire in their respective windings: The changing magnetic field across the windings induces an electromotive force (EMF) across each winding. Since the ideal windings have no impedance, they have no associated voltage drop, and so the voltages VP and VS measured at the terminals of the transformer, are equal to the corresponding EMFs. The primary EMF, acting as it does in opposition to the primary voltage, is sometimes termed the "back EMF". This is due to Lenz's law which states that the induction of EMF would always be such that it will oppose development of any such change in magnetic field. by a

3.2.3 RECTIFIER
Here we use a bridge rectifier. A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that provides the same polarity of output voltage for any Page 15 of 35

polarity of input voltage. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a center-tapped transformer design, but has two diode drops rather than one, thus exhibiting reduced efficiency over a center-tapped design for t he same out put volt age.

3.2.4 REGULATOR
A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. The 78xx (also sometimes known as LM78xx) series of devices is a family of self-contained fixed linear voltage regulator integrated circuits. The 78xx family is a very popular choice for many electronic circuits which require a regulated power supply, due to their ease of use and relative cheapness. When specifying individual ICs within this family, the xx is replaced with a two-digit number, which indicates the output voltage the particular device is designed to provide (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx line is positive voltage regulators, meaning that they are designed to produce a voltage that is positive relative to a common ground. There is a related line of 79xx devices which are complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to provide both positive and negative supply voltages in the same circuit, if necessary. These 78xx ICs devices typically support an input voltage which can be anywhere from a couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and can typically provide up to around 1 or 1.5 amps of current (though smaller or larger packages may have a lower or higher current rating).

Page 16 of 35

3.2.5 BASIC OPERATION:


When the input connected at the left corner of the diamond is positive with respect to the one connected at the right hand corner, current flows to the right along the upper colored path to the output, and returns to the input supply via the lower one. When the right hand corner is positive relative to the left hand corner, current flows along the upper colored path and returns to the supply via the lower colored path. In each case, the upper right output remains positive with respect to the lower right one. Since this is true whether the input is AC or DC, this circuit not only produces DC power when supplied with AC power: it also can provide what is sometimes called "reverse polarity protection". That is, it permits normal functioning when batteries are installed backwards or DC input-power supply wiring "has its wires crossed" (and protects the circuitry it powers against damage that might occur without this circuit in place). Page 17 of 35

OUTPUT SMOOTHING (USING CAPACITOR):


For many applications, especially with single phase AC where the full-wave bridge serves to convert an AC input into a DC output, the addition of a capacitor may be important because the bridge alone supplies an output voltage of fixed polarity but pulsating magnitude (see diagram above).

Fig: Bridge rectifier with shunt capacitor The function of this capacitor, known as a reservoir capacitor (aka smoothing capacitor) is to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge. One explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC component of the output, reducing the AC voltage across, and AC current through, the resistive load. In less technical terms, any drop in the output voltage and current of the bridge tends to be cancelled by loss of charge in the capacitor. Output can also be smoothed using a choke and second capacitor. The choke tends to keep the current (rather than the voltage) more constant. Due to the relatively high cost of an effective choke compared to a resistor and capacitor this is not employed in modern equipment.

Page 18 of 35

3.3 INFRARED 3.3.1 WHAT IS INFRARED?


Infrared is an energy radiation with a frequency below our eyes sensitivity, so we cannot see it. Even that we can not "see" sound frequencies, we know that it exist, we can listen them.

Even that we cannot see or hear infrared, we can feel it at our skin temperature sensors. When you approach your hand to fire or warm element, you will "feel" the heat, but you can't see it. You can see the fire because it emits other types of radiation, visible to your eyes, but it also emits lots of infrared that you can only feel in your skin.

3.3.2 INFRARED IN ELECTRONICS


Infra-Red is interesting, because it is easily generated and doesn't suffer electromagnetic interference, so it is nicely used to communication and control, but it is not perfect, some other light emissions could contains infrared as well, and that can interfere in this communication. The sun is an example, since it emits a wide spectrum or radiation. The adventure of using lots of infra-red in TV/VCR remote controls and other applications, brought infra-red diodes (emitter and receivers) at very low cost at the market. From now on you should think as infrared as just a "red" light. This light can means something to the receiver, the "on or off" radiation can transmit different meanings. Lots of things can generate infrared, anything that radiate heat do it, including out body, lamps, stove, oven, friction your hands together, even the hot water at the faucet. Page 19 of 35

To allow a good communication using infra-red, and avoid those "fake" signals, it is imperative to use a "key" that can tell the receiver what is the real data transmitted and what is fake. As an analogy, looking eye naked to the night sky you can see hundreds of stars, but you can spot easily a far away airplane just by its flashing strobe light. That strobe light is the "key", the "coding" element that alerts us. Similar to the airplane at the night sky, our TV room may have hundreds of tinny IR sources, our body, the lamps around, even the hot cup of tea. A way to avoid all those other sources, is generating a key, like the flashing airplane. So, remote controls use to pulsate its infrared in a certain frequency. The IR receiver module at the TV, VCR or stereo "tunes" to this certain frequency and ignores all other IR received. The best frequency for the job is between 30 and 60kHz, the most used is around 36kHz

3.3.3 IR GENERATION
To generate a 36kHz pulsating infrared is quite easy, more difficult is to receive and identify this frequency. This is why some companies produce infrared receives, that contains the filters, decoding circuits and the output shaper, that delivers a square wave, meaning the existence or not of the 36kHz incoming pulsating infrared. It means that those 3 dollars small units, have an output pin that goes high (+5V) when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not this radiation.

Page 20 of 35

A square wave of approximately 27uS (microseconds) injected at the base of a transistor, can drive an infrared LED to transmit this pulsating light wave. Upon its presence, the commercial receiver will switch its output to high level (+5V).If you can turn on and off this frequency at the transmitter, your receiver's output will indicate when the transmitter is on or off.

Those IR demodulators have inverted logic at its output, when a burst of IR is sensed it drives its output to low level, meaning logic level = 1. The TV, VCR, and Audio equipment manufacturers for long use infra-red at their remote controls. To avoid a Philips remote control to change channels in a Panasonic TV, they use different codification at the infrared, even that all of them use basically the same transmitted frequency, from 36 to 50kHz. So, all of them use a different combination of bits or how to code the transmitted data to avoid interference.

Page 21 of 35

3.3.4 IR SENSOR: IR TX:

TSAL6200 is a high efficiency infrared emitting diode in GaAlAs on GaAs technology, molded in clear, bluegrey tinted plastic packages. In comparison with the standard GaA1As on GaAs technology these emitters achieve more than 100 % radiant power improvement at a similar wavelength. The forward voltages at low current and at high pulse current roughly correspond to the low values of the standard technology. Therefore these emitters are ideally suitable as high performance replacements of standard emitters.

3.3.5 FEATURES
y y y y y y y y Extra high radiant power and radiant intensity High reliability Low forward voltage Suitable for high pulse current operation Standard T-1 ( 5 mm) package = 17

Angle of half intensity

Peak wavelength p = 940 nm Good spectral matching to Si photo detectors

3.3.6 APPLICATIONS
y y y y Infrared remote control units with high power requirements Free air transmission systems Infrared source for optical counters and card readers IR source for smoke detectors. Page 22 of 35

Most photo-detecting modules for industrial use are using modulated light to avoid interference by the ambient light. The detected signal is filtered with a band pass filter and disused signals are filtered out. Therefore, only the modulated signal from the light emitter can be detected. Of course, the detector must not be saturated by ambient light because it is effective when the detector is working in its linear region. In this project, pulsed light is used to cancel ambient light. This is suitable for arrayed sensors that are scanned in sequence to avoid interference from the next sensor. The microcontroller starts to scan the sensor status, sample the output voltage, turns on the LED and samples again the output voltage. The difference between the two samples is the optical current created by the LED, as the output voltage produced by the ambient light is canceled. The other sensors are also scanned the same way in sequence.

The IR TX and RX are placed adjacent to each other. The TX transmits the IR radiation continuously and these will pass away when there is no object interrupting the signal. The IR receiver does not receive the IR radiation in this case. When there is an obstacle or when someone interrupts the IR signal, the rays transmitted by the IR transmitter will get reflected back and these reflected rays will be received by the IR receiver. Thus, the IR receiver receives the signal now in this case. The microcontroller detects this change and does the necessary action Page 23 of 35

3.4 LIQUID CRYSTAL DISPLAY (LCD)


LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons: 1. The declining prices of LCDs. 2. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. 3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep displaying the data. 4. Ease of programming for characters and graphics. These components are specialized for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.

A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each. It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics. Page 24 of 35

3.5 ULTRA SONIC SENSORS


Ultrasonic sensors (also known as transceivers when they both send and receive) work on a principle similar to radar or sonar which evaluate attributes of a target by interpreting the echoes from radio or sound waves respectively. Ultrasonic sensors generate high frequency sound waves and evaluate the echo which is received back by the sensor. Sensors calculate the time interval between sending the signal and receiving the echo to determine the distance to an object. Ultrasonic sensors are used to detect the presence of targets and to measure the distance to targets in many automated factories and process plants. Sensors with an on or off digital output are available for detecting the presence of objects, and sensors with an analog output which varies proportionally to the sensor to target separation distance are commercially available. An ultrasonic sensor houses a transducer that emits high-frequency, inaudible acoustic waves in one direction when the transducer element vibrates. If the waves strike and bounce off an object, the transducer receives the echoed signal. The sensor then determines its distance from the object based on the length of time between the initial sound burst and the echo's return. Ultrasonic sensors require fairly accurate timing circuitry -- so acoustic sensors really require a processor of some sort to drive them. Ultrasonic sensors should be a first choice for detecting clear objects, liquids, dense materials of any surface type (rough, smooth, shiny) and irregular shaped objects. This makes them one of the most ideal choices for measuring the height of containers which could be of different shapes, sizes, color and material

Front-view of SRF05 Ultrasonic Sensor

Back View of SRF05 Ultrasonic Sensor

Page 25 of 35

CHAPTER-4 SOFTWARE DEVELOPMENT


4.1 INTRODUCTION:
This chapter briefly explains about the firmware implementation of the project. The required software tools are discussed in section 4.2. Section 4.3 shows the flow diagram of the project design. Section 4.4 presents the firmware implementation of the project design.

4.2 SOFTWARE TOOLS REQUIRED


Keil v3, Proload are the two software tools used to program microcontroller. The working of each software tool is explained below in detail.

4.2.1 PROGRAMMING MICROCONTROLLER


A compiler for a high level language helps to reduce production time. To program the AT89S52 microcontroller the Keil v3 is used. The programming is done strictly in the embedded C language. Keil v3 is a suite of executable, open source software development tools for the microcontrollers hosted on the Windows platform. The compilation of the C program converts it into machine language file (.hex). This is the only language the microcontroller will understand, because it contains the original program code converted into a hexadecimal format. During this step there are some warnings about eventual errors in the program. This is shown in Fig 4.1. If there are no errors and warnings then run the program, the system performs all the required tasks and behaves as expected the software developed. If not, the whole procedure will have to be repeated again. Fig 4.2 shows expected outputs for given inputs when run compiled program. One of the difficulties of programming microcontrollers is the limited amount of resources the programmer has to deal with. In personal computers resources such as RAM and processing speed are basically limitless when compared to microcontrollers. In contrast, the code on microcontrollers should be as low on resources as possible

Page 26 of 35

4.3 KEIL COMPILER:


Keil compiler is software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports C language code.

4.4 PROLOAD:
Proload is software which accepts only hex files. Once the machine code is converted into hex code, that hex code has to be dumped into the microcontroller and this is done by the Proload. Proload is a programmer which itself contains a microcontroller in it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the Keil compiler and dumps this hex file into the microcontroller which is to be programmed. As the Proload programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply, a source is required. Thus this is accomplished from the power supply board with an output of 12volts.

Page 27 of 35

CHAPTER 5 CODE IMPLEMENTATION


/* Write a Program to Implement Advanced Car Parking System*/ // Comments Section #include<reg51.h> // Hedar Files Section // #include"lcddisplay.h" #define ldata P1 // LCD Data Port sbit entry = P2^7; sbit exit = P1^6; sbit ultra=P2^4; sbit rs=P1^2; // sbit rw=P1^6; sbit en=P1^3; sbit stepper_a sbit stepper_b sbit stepper_c sbit stepper_d = = = = P2^0; P2^1; P2^2; P2^3;

unsigned char i,commands[]={0x28,0x0e,0x06,0x01,0x80,0}; unsigned int a=0,b=0;

void lcdcmd(unsigned char); void lcddata(unsigned char); void delay(unsigned int); void msgdisplay(unsigned char []); void conv(unsigned char temp_value); void main() { unsigned char count=10; entry=exit=1; for(i=0;commands[i]!=0;i++) { lcdcmd(commands[i]); } msgdisplay(" WELCOME "); delay(200); Page 28 of 35

lcdcmd(0x1); msgdisplay(" AUTOMATIC CAR "); lcdcmd(0xC0); msgdisplay("PARKING SYSTEM"); delay(1000);

start: delay(1000); lcdcmd(0x1); msgdisplay("AVLBLE SPACE FOR"); lcdcmd(0xC0); conv(count); msgdisplay(" VEHICLES"); while(1) { if((entry==1)&&(count)) { if(count==0) goto start; count=count-1; lcdcmd(0x01); msgdisplay("CAR ENTERING.. "); delay(1000); lcdcmd(0x01); msgdisplay("GATE OPENING "); for(i=0;i<15;i++) { stepper_a=1; stepper_b=0; stepper_c=0; stepper_d=0; delay(150); stepper_a=0; stepper_b=1; stepper_c=0; stepper_d=0; delay(150); Page 29 of 35

stepper_a=0; stepper_b=0; stepper_c=1; stepper_d=0; delay(150); stepper_a=0; stepper_b=0; stepper_c=0; stepper_d=1; delay(150); } delay(200); lcdcmd(0x01); msgdisplay("GATE CLOSING.."); for(i=0;i<15;i++) { stepper_a=1; stepper_b=0; stepper_c=0; stepper_d=0; delay(150); stepper_a=0; stepper_b=0; stepper_c=0; stepper_d=1; delay(150); stepper_a=0; stepper_b=0; stepper_c=1; stepper_d=0; delay(150); stepper_a=0; stepper_b=1; stepper_c=0; stepper_d=0; delay(150); } Page 30 of 35

delay(50); while(entry==1); goto start; } if((exit==1)&&(count<10)) { if(count==10) goto start; lcdcmd(0x01); msgdisplay("CAR EXIT.. "); delay(100); count=count+1; while(exit==1); goto start; } if(ultra==1) { buz=0; } } }

void msgdisplay(unsigned char b[]) { for(i=0;b[i]!='\0';i++) { lcddata(b[i]); } }

void lcdcmd(unsigned char value) { unsigned char n; Page 31 of 35

n=value; value=value&(0x0f0); ldata = value; rs =0; // rw =0; en =1; delay(30); en =0; value=n; value=value<<4; value=value &(0x0f0); ldata = value; rs =0; // rw =0; en =1; delay(30); en =0; } //**********************DEFINEATION OF LCD DATA IN FOUR BIT MODE **************************** void lcddata(unsigned char value) { unsigned char n; n=value; value=value&(0x0f0); ldata = value; rs =1; // rw =0; en =1; delay(30); en =0; value=n; value=value<<4; value=value &(0x0f0); ldata = value; rs =1; // rw =0; en =1; delay(30); en =0; } void delay(unsigned int value) Page 32 of 35

{ int x,y; for(x=0;x<value;x++) for(y=0;y<100;y++); } void conv(unsigned char temp_value) { unsigned char value,d1,d2,d3; temp_value = temp_value; value=temp_value/10; d3=temp_value%10; d1=value/10; d2=value%10; lcddata(d1+0x30); //delay1(); lcddata(d2+0x30); //delay1(); lcddata(d3+0x30); //delay1(); }

Page 33 of 35

CHAPTER 6 CONCLUSION
In this project, we have studied and implemented a complete working model using a Microcontroller. The programming and interfacing of microcontroller has been mastered during the implementation. This work includes the study ADVANCED CAR PARKING SYSTEM in detail. The implementation of Advanced car parking system using IR and Ultra sonic sensor is done successfully. The communication is properly done without any interference between different modules in the design. Design is done to meet all the specifications and requirements. Software tools like Keil Uvision Simulator, Proload to dump the source code into the microcontroller, Orcad Lite for the schematic diagram have been used to develop the software code before realizing the hardware. The performance of the system is more efficient. Reading the values from the IR sensors and controlling the gate with the help of stepper motor and also continuously read the fire sensor output and alert the buzzer immediately either if the fire sensor triggers or if the breakage of the railway track occurs is the main job carried out by the microcontroller. The mechanism is controlled by the microcontroller.It can be concluded that the design implemented in the present work provide portability, flexibility and the data transmission is also done with low power consumption.

Page 34 of 35

REFERENCES:
1. 2. 3. 4. 5. 6. 7. Http://www.hobbyengineering.com/rmapindex.html Http://www.ridgesoft.com/buildingbots.html Http://www.mstracey.btinternet.co.uk/interest.html Http://www.cpsindia.in Http://www.uniten.edu.my Www.wikipedia.com Www.8051projects.info

8. Http://en.wikipedia.org/wiki/Infrared 9. Http://www.windows.ucar.edu/tour/link=/physical_science/magnetism/em_infrared.html &edu=mid 10. Http://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.pdf 11. Http://microcontrollershop.com/product_info.php?Products_id=1078

TEXT BOOKS
1. Muhammad Ali Mazidi& Janice Gillispie Mazidi, The 8051 Microcontroller and Embedded Systems, 2nd Edition 2. Kenneth Ayala, 8051 Micro controller Architecture, Programming and Applications 3. Alkaklra & Sanjeev kumar kalkra, Architecture and Programming of 8051 Microcontroller.

Page 35 of 35

Anda mungkin juga menyukai