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.
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.
Page 3 of 35
Page 4 of 35
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.
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.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.
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)
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)
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
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.
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
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
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
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.
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
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
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
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
Page 25 of 35
Page 26 of 35
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
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
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; } } }
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
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