automtic vehicle over speed monitoring and parking

92
ABS TRACT In recent times, number of accidents has been increasing mainly due to the over- speeding of the vehicles and the carelessness of the driver, an automation system is designed to control the vehicle speed and limit accidents and it is “Automatic over Speed Controlling System of a Vehicle and Automatic Parking”. In the areas where the speed is to be limited, an RF transmitter is placed and it transmits signals to the receiver which initiate the control operation and the microcontroller sends command to control the speed of the vehicle. When driver falls asleep or feels drowsy, the eye blink sensor senses the eye blinks and initiates the microcontroller and thus making the vehicle to come under control.

Upload: satish-kumar

Post on 22-Nov-2014

117 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Automtic Vehicle Over Speed Monitoring and Parking

ABSTRACT

In recent times, number of accidents has been increasing mainly due to the over-

speeding of the vehicles and the carelessness of the driver, an automation system is

designed to control the vehicle speed and limit accidents and it is “Automatic

over Speed Controlling System of a Vehicle and Automatic Parking”. In the

areas where the speed is to be limited, an RF transmitter is placed and it transmits

signals to the receiver which initiate the control operation and the microcontroller

sends command to control the speed of the vehicle. When driver falls asleep or

feels drowsy, the eye blink sensor senses the eye blinks and initiates the

microcontroller and thus making the vehicle to come under control.

Viii

Page 2: Automtic Vehicle Over Speed Monitoring and Parking

LIST OF ABBREVIATIONS

RF - Radio Frequency

FM - Frequency Modulation

AT - Atmel

TMOD - Timer mode

SCON - Serial Control Register

TCON - Timer Control

IE - Interrupt Enable Register

TX - Transmitter

INT - Interrupt

IP - Interrupt Priority

LCD - Liquid Crystal Display

LED - Light Emitting Diode

ROM - Read Only Memory

RAM - Random Access Memory

PCB - Printed Circuit Board

I/O - Input and Output

IC - Integrated circuits

XTAL - External Crystal Oscillator

GND – Ground ix

Page 3: Automtic Vehicle Over Speed Monitoring and Parking

LIST OF FIGURES

FIGURE TITLE PAGE NO NO 5.1 Pin diagram of AT89S52 Microcontroller 15 5.3 Architecture of AT89S52 Microcontroller 17

6.1 Transmitter Schematic 25 6.2 Basic Block Diagram of Power Supply 26

6.3 7805 voltage regulator IC 28 6.4 LM7805 Voltage Regulator 30

6.5 External Crystal Oscillator 31

7.1 Receiver Schematic 35

7.2 Liquid Crystal Display 37

7.3 RF Module 38

7.4 Antenna 433.92 MHz 39

8.1a Darlington Pair 40

8.1b Optocoupler 40 8.2 Unipolar Stepper Motor 41

9.1 Block diagram of Transmitter Module 43

9.2 Block diagram of Receiver 44

x CHAPTER 1

Page 4: Automtic Vehicle Over Speed Monitoring and Parking

INTRODUCTION

A Transmitter and Receiver module are used in this project to monitor and

control the vehicles over speed in particular areas like school zones, curves or

bends. Transmitter module has a Microcontroller, Encoder and RF Transmitter.

A Radio frequency signal is always transmitted by the RF Transmitter. The

Receiver module has microcontroller, decoder and RF Receiver. It is interfaced

with vehicle module. When the RF signal is received by the RF receiver, the

speed of the vehicle is decreased which is processed by the microcontroller.

The eye blink sensor is another added feature which is used for sensing the

driver’s consciousness; this sensor is used for sensing whether the user feels

asleep or drowsy. It senses the eye blink of the user and it makes a count. If the

count is less than twenty five, the signal is intimated to microcontroller and the

vehicle is parked automatically.

1

1.1 PROJECT MODULE

Page 5: Automtic Vehicle Over Speed Monitoring and Parking

The projects modules are divided in two major modules are

1. Hardware Module

2. Software Module

1.1.1 HARDWARE MODULE

The hard ware modules are divided into these categories

Transmitter Module Receiver Module Eye Blink Sensor Vehicle Module using Stepper Motor

Transmitter Module

In this, Radio Frequency signal is transmitted by the RF Transmitter when it is switched on. It is processed by 89s52 Microcontroller which is from the family of 8051 Microcontroller.

Receiver Module

In this, Radio Frequency signal is received by the RF Receiver. This receiver module is placed in the vehicle. When the RF signal is received, the speed of the vehicle is reduced which is done by 89s52 Microcontroller.

Eye Blink Sensor

Eye Blink Sensor is used in vehicle which senses the eye blinking count of a user. When the user falls asleep or feels drowsy, the eye blink sensor tracks the eye lids and initiates the microcontroller and the vehicle is stopped.

2

1.1.2 SOFTWARE MODULE

Page 6: Automtic Vehicle Over Speed Monitoring and Parking

Embedded “C” Keil µvision Software

HARDWARE COMPONENT:

Atmel 89s52 RF Receiver and Transmitter LCD for display Eye Blink Sensor Power Supply in RF Transmitter and Receiver

SOFTWARE COMPONENT:

Keil C

3

CHAPTER 2

Page 7: Automtic Vehicle Over Speed Monitoring and Parking

INTRODUCTION OF MICROCONTROLLER

The true computer on a chip is nothing but a microcontroller. The design incorporates all of the features found in a microprocessor CPU, ALU, PC, SP and registers. It also had added the other features needed to make a Complete computer

ROM, RAM, parallel I/O, serial I/O, Counters and a clock circuits.

Microprocessors are intended to be general-purpose digital computers whereas microcontrollers are intended to be special-purpose digital Controller.

Microprocessor contains a CPU, memory-addressing circuits and Interrupt handling circuits. Microcontrollers have these features as well as timers, parallel and serial I/O, and internal RAM and ROM.

Microcontroller models vary in data size from 4 to 32 bits. Four-bit units are produced in huge volumes for very simple applications, and 8-bit units are the most versatile. 16 and 32-bit units are used in high-speed control and signal processing applications.

Many models feature programmable pins that allow external memory to be added with the loss of I/O capability.

4

2.1 MICROCONTROLLERS VS MICROPROCESSORS

Page 8: Automtic Vehicle Over Speed Monitoring and Parking

A microcontroller has a CPU (a microprocessor) in addition to a fixedamount of RAM, ROM, I/O ports and timers all on a single chip. In otherwords, the processor, the RAM, ROM, I/O ports, and timers are all embeddedtogether on one chip. Therefore they are sometimes referred to as ‘system on achip’ or “Microcomputer”. The fixed amount of on chip ROM, RAM and anumber of I/O ports. In microcontrollers makes them ideal for manyapplications in which cost and space are critical.

5 CHAPTER 3

Page 9: Automtic Vehicle Over Speed Monitoring and Parking

EMBEDDED SYSTEMS

3.1 INTRODUCTION

An embedded system is a special purpose computer controlled electromechanical system in which the computer is completely encapsulated by the device it controls. An embedded system has specific requirements and performs pre-defined tasks, unlike a general purpose personal computer.

An embedded system is a computer-controlled system. The core of any embedded system is a microprocessor, programmed to perform a few tasks (often just one task). This is to be compared to other computer systems with general purples hardware and externally loaded software. Embedded systems are often designed for mass production.

Embedded systems are computer systems in the widest sense. They include all computers other than those specifically intended as general-purpose computers. Examples of embedded systems range from portable music players to real-time controls for systems like the space shuttle.

Most commercial embedded systems are designed to do some task at a low cost. Most, but not all have real-time system constraints that must be met. They may need to be very fast for some functions, but most other functions will probably not need speed. These systems meet their real-time constraints with a combination of special purpose hardware and software tailored to the system requirements.

6 It is difficult to characterize embedded systems by speed or cost, but for high

volume systems, cost usually dominates the system design. Often many parts

Page 10: Automtic Vehicle Over Speed Monitoring and Parking

of an embedded system need low performance compared to the primary mission of the system. This allows an embedded system to be intentionally simplified to lower costs compared to a general-purpose computer accomplishing the same task, by using a CPU that is just ‘good enough’ for these secondary functions.

For low-volume embedded systems, personal computers can often be used, by limiting the programs or by replacing the operating system with a real time operating system. In this case special purpose hardware may be replaced by one or more high performance CPUs. Still, some embedded systems may require high performance CPUs. The software written for many embedded systems, especially those without a disk drive is sometimes called firmware. Firmware is software that is embedded in hardware devices, e.g. in one or more ROM/Flash memory IC chips.

Programs on an embedded system often run with limited hardware resources often there is no disk drive, operating system, keyboard or screen, the software may not have anything remotely like a file system, or if one is present, a flash drive may replace rotating media. If a user interface is present, it may be a small keypad and liquid crystal display.

Embedded systems reside in machines that are expected to run continuously for years without errors. Therefore the software is usually developed and tested more carefully than software for personal computers. Many embedded systems avoid mechanical moving parts such as disk drives, switches or buttons because these are unreliable compared to solid-state parts such as flash memory.

7 In addition, the embedded system may be outside the reach of humans

(down an oil well borehole, launched into outer space, etc.,) so the

Page 11: Automtic Vehicle Over Speed Monitoring and Parking

embedded system must be able to restart itself even if catastrophic data corruption has taken place.

This is usually accomplished with a standard electronic part called a watchdog timer that resets the computer unless the software periodically resets the timer.

83.2 CHOOSING MICROCONTROLLER – WHY 8051?

Page 12: Automtic Vehicle Over Speed Monitoring and Parking

There are four major 8-bit microcontrollers. They are Motorola’s 68xx, Intel’s 805x, Zilog’s Z8, and PIC 16x from Microchip Technologies. Each of these has a unique instruction set and register set, therefore not compatible with each other. Programs written for one will not run on the others. There are also 16-bit and 32-bit microcontrollers made by various makers.

The first and foremost criterion is that it must meet the task at hand efficiently and cost effectively. Here we choose between 8/16/32 bit microcontrollers according to our need. Various other considerations are Speed, Power consumption, amount of on-chip RAM and ROM, no of I/O ports available, cost etc. The availability and ease of development are some other considerations.

Considering all these, one of the best choices before us was to select Atmel Corporation’s AT89s52 microcontroller, which was readily available in the market and cheaper in cost. The major manufacturers of 8051 are AMD, Atmel, Intel, Matra, OKI, Philips, Siemens, SMC, SSI etc.

9 CHAPTER 4

Page 13: Automtic Vehicle Over Speed Monitoring and Parking

THE 8051 MICROCONTROLLER

4.1 INTRODUCTION

8051 micro controller was introduced by Intel Corporation in the year 1981. It is an 8-bit microcontroller with Harvard Architecture manufactured by advanced CMOS processes. It has 128 bytes of on chip RAM, 4k bytes of on chip ROM, two 16 bit timers/counters, four 8-bit ports of which one is a serial port, etc. There are 6 interrupt sources.

Since this is an 8-bit micro controller, the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken down to 8 bit pieces. Though it has an addressing capability of 64 Kbytes, only 4k bytes have been provided on chip.

8051 is available in different memory types, such as UV-EPROM, FLASH, and NV-RAM. The UV-EPROM version of 8051 is the 8751. This chip has only 4K bytes of on chip UV-EPROM. To use this chip for development requires access to a PROM burner, as well as a UV-EPROM eraser to erase all the contents of UV-EPROM inside the 8751 chip before you can program it again.

Atmel Corporation’s AT89s52 is a low-power, high-performance CMOS 8-bit microcomputer with 4K 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 MCS-51 instruction set and pin out. The on-chip flash allows the program memory to be reprogrammed in-system or by a conventional on 10 volatile memory.

Page 14: Automtic Vehicle Over Speed Monitoring and Parking

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89s52 is a powerful microcomputer that provides a highly flexible and cost-effective solution to many embedded control applications.

Flash memory can be erased in seconds compared to 20 minutes needed for 8751. For this reason 89s52 is used in place of 8751 to eliminate the waiting time needed to erase the chip and thereby speed up the development time. The development system requires a ROM burner that supports flash memory.

The entire contents of ROM should be erased in order to program it again the PROM burner itself does this. The 89s52 Flash reliably stores memory contents even after 10,000 erase and program cycles. AT89s52 is a popular chip of this category from Atmel Corporation.

Another popular version of 8051 is DS5000 chip from Dallas Semiconductor. The on chip ROM is in the form of NV-RAM. The read/write capability of NV-RAM allows the program to be loaded into the on chip ROM while in the system. This can be done via a serial port of a PC.

Another advantage of NV-RAM is the ability to change the ROM contents one byte at a time. The entire ROM must be erased before programmed again in the case of UV-EPROM and flash memory.

11

Page 15: Automtic Vehicle Over Speed Monitoring and Parking

There are also OTP (One Time Programmable) versions of the 8051 available from different sources. Flash and NV-RAM versions are typically used for product development. When a product is designed and finalized, the OTP version of the 8051 is used for mass production since it is much cheaper in terms of price per unit.

There are two other members in the 8051 family of microcontrollers. They are the 8052 and the 8031.The 8052 has all the standard features of the 8051 in addition to an extra 128 bytes of RAM, an extra timer, extra 4K bytes of on chip ROM, and two more interrupt sources. Therefore all programs written for 8051 will run on 8052, but the reverse is not true.

8031 is often referred to as ROM-less 8051 since it has 0K bytes of on chip ROM. To use this chip we must add external ROM to it. The ROM containing the program attached to the 8031 can be as large as 64K bytes. For adding external ROM two ports are needed out of 4 ports, leaving only 2 ports for I/O operations. To solve this, external I/O ports like 8255 can be added to 8031.

12

4.2 FEATURES OF 8051 MICROCONTROLLER

8-bit CPU with registers A (the accumulator) and B.

Page 16: Automtic Vehicle Over Speed Monitoring and Parking

16-bit Program Counter (PC) and Data Pointer (DPTR).

16 bytes, which may be addressed at the bit level

80-bytes of general – purpose data memory.

32-I/O pins arranged as four 8- bit ports: P0-P3.

Two 16 – bit timer/counters: T0 and T1.

Full duplex serial data receiver/transmitter: SBUF

Control Registers: TCON, TMOD, SCON, PCON, IP and IE.

Oscillator and clock circuits.

4.3 RTX51/RTX Tiny

Another Operating System, from Keil Software, is called RTX. It concentrates on the very small applications like DCX. In addition to the RTX tiny version, which runs totally in on-chip RAM, there is an RTX51, which more closely resembles DCX, RTX tiny uses no more than 64 bytes of RAM depending on how many of the sixteen possible tasks you use. It has code of only about 800 bytes and has only six system calls. RTX51 is still modest sized, requires, tasks at one time, and includes message passing as well as timing, interrupts, task signaling, and memory pool management. RTX tiny is a “Subset”, supporting only timing, interrupts, and inter-task signaling, which is enough to build up virtually any application. Both systems will run tasks in round robin fashion, but the RTX51 is similar to DCX in providing priority levels for tasks. RTX51 time-slices equal-priority tasks whereas DCX let equal priority tasks run to a wait on a first-come first-serve basis.

13

CHAPTER 5

AT89S52 MICROCONTROLLER

Page 17: Automtic Vehicle Over Speed Monitoring and Parking

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 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 in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-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 interrupt or hardware reset.

145.1 PIN DIAGRAM OF AT89s52 MICROCONTROLLER

Page 18: Automtic Vehicle Over Speed Monitoring and Parking

Figure 5.1Pin diagram of AT89S52 Microcontroller

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.

15

5.2 FEATURES

Page 19: Automtic Vehicle Over Speed Monitoring and Parking

Compatible with MCS-51® Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz 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

165.3 AT89S52 ARCHITECTURE

The Microcontroller AT89S52’s architecture is shown below.

Page 20: Automtic Vehicle Over Speed Monitoring and Parking

Figure 5.3 Architecture of AT89S52 Microcontroller

175.3.1 Pin Description

VCC

Supply voltage.

Page 21: Automtic Vehicle Over Speed Monitoring and Parking

GND

Ground.

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins 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. In this mode, P0 has internal pull ups.

Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull ups are required during program verification.

Port 1

Port 1 is an 8-bit bidirectional 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. Port1 also receives the low-order address bytes during Flash programming and 18

verification.

Alternate Functions of Port pins

Page 22: Automtic Vehicle Over Speed Monitoring and Parking

P1.0 T2 (external count input to Timer/Counter 2), clock-out

P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control)

P1.5 MOSI (used for In-System Programming)

P1.6 MISO (used for In-System Programming)

P1.7 SCK (used for In-System Programming

Port 2

Port 2 is an 8-bit bidirectional 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.

19Port 3

Port 3 is an 8-bit bidirectional 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

Page 23: Automtic Vehicle Over Speed Monitoring and Parking

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 AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification.

Alternate Functions of Port pins

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 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. This pin drives High for 96 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

20ALE/PROG

Address Latch Enable (ALE) 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.

Page 24: Automtic Vehicle Over Speed Monitoring and Parking

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 purposes. Note, however, that one ALE pulse is skipped during each access to external data memory.

If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE disable bit has no effect if the microcontroller is in external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory.

When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH.

21

Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming.

XTAL1

Page 25: Automtic Vehicle Over Speed Monitoring and Parking

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier.

Special Function Registers

A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1.

Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.

User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0.

Timer 2 Registers:

Control and status bits are contained in registers T2CON (shown in Table 2) and T2MOD (shown in Table 3) for Timer 2. The register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.

22Interrupt Registers:

The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register.

Dual Data Pointer Registers:

Page 26: Automtic Vehicle Over Speed Monitoring and Parking

To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to t appropriate value before accessing the respective Data Pointer Register.

Power off Flag:

The Power off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to “1” during power up. It can be set and rest under software control and is not affected by reset.

Memory Organization

MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed.

Program Memory

If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory.

23Data Memory

The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.

Page 27: Automtic Vehicle Over Speed Monitoring and Parking

When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access of the SFR space.

For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data

Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.

24 CHAPTER 6 6. TRANSMITTER MODULE

At the core of the transmitter module is the AT89s52 microcontroller. Its basic purpose is to hold and continuously transmit the RF signal. The data transmission is enabled through the TXD pin. The schematic is shown in figure below.

Page 28: Automtic Vehicle Over Speed Monitoring and Parking

TRANSMITTER SCHEMATIC

Figure 6.1 Transmitter Schematic 25

6.1 COMPONENTS OF TRANSMITTER MODULE

AT89s52 MICROCONTROLLER

230/12 V STEP DOWN TRANSFORMER

BRIDGE RECTIFIER

Page 29: Automtic Vehicle Over Speed Monitoring and Parking

7805 IC VOLTAGE REGULATOR(12V/5V)

RF TRANSMITTER

EXTERNAL CRYSTAL OSCILLATOR

6.2 POWER SUPPLY

A power supply (sometimes known as a power supply unit or PSU)

is a device or system that supplies electrical or other types of energy

to an output load or group of loads. The term is most commonly

applied to electrical energy supplies, less often to mechanical ones,

and rarely to others.

Figure 6.2 Basic Block Diagram of Power Supply

26

As illustrated in the figure, the first section is the TRANSFORMER.

The transformer steps up or steps down the input line voltage and

isolates the power supply from the power line.

The RECTIFIER section converts the alternating current input signal

to a pulsating direct current.

Page 30: Automtic Vehicle Over Speed Monitoring and Parking

A FILTER section is used to convert pulsating dc to a purer, more

desirable form of dc voltage.

The final section, the REGULATOR, does just what the name

implies. It maintains the output of the power supply at a constant level

in spite of large changes in load current or input line voltages.

6.2.1 LM 7805 REGULATOR

Voltage Regulator (regulator), usually having three legs, converts varying input voltage and produces a constant regulated output voltage. They are available in a variety of outputs.

The most common part numbers start with the numbers 78 and finish with two digits indicating the output voltage. The number 78 represents positive voltage. The 7805 series of voltage regulators are designed for positive input.

Examples: 5V DC Regulator Name: LM7805 or MC7805

-5V DC Regulator Name: LM7905 or MC7905

6V DC Regulator Name: LM7806 or MC7806

-9V DC Regulator Name: LM7909 or MC7909

27 The LM7805 series typically has the ability to drive current up to 1A. For

application requirements up to 150mA, 78LXX can be used. As mentioned above, the component has three legs: Input leg which can hold up to 36VDC Common leg (GND) and an output leg with the regulator's voltage. For maximum voltage regulation, adding a capacitor in parallel between the common leg and the output is usually recommended. Typically a 0.1MF capacitor is used. This eliminates any high frequency AC voltage that could

Page 31: Automtic Vehicle Over Speed Monitoring and Parking

otherwise combine with the output voltage. See below circuit diagram which represents a typical use of a voltage regulator.

Figure 6.3 7805 voltage regulator IC

The transformer drops the 240 volts 'main' voltage to 8.5 volts. The diode 'bridge' rectifies the 8.5 volts AC from the output side of the power transformer into DC. The 2500μF capacitor helps to maintain a constant input into the regulator.

As a general guide this capacitor should be rated at a minimum of 1000μF for each amp of current drawn and at least TWICE the input voltage. The 0.1μF capacitor eliminates any high frequency pulses that could otherwise interfere with the operation of the regulator.

28 Voltage regulators are very robust. They can withstand over-current draw

due to short circuits and also over-heating. In both cases the regulator will shut down before damage occurs. The only way to destroy a regulator is to apply reverse voltage to its input.

Page 32: Automtic Vehicle Over Speed Monitoring and Parking

Reverse polarity destroys the regulator almost instantly. To avoid this possibility you should always use diode protection of the power supply. This is especially important when using nine volt battery supplies as it is common for people to 'test' the battery by connecting it one way and then the other.

All of the interfaces described on this site have protection diodes connected into the power supply circuit to prevent damage due to incorrect polarity. Generally a 1N4004, 1 amp power diode is connected in series with the power supply. If the supply is connected the wrong way around, the regulator will be protected from damage.

6.2.2 INPUT VOLTAGE

As a general rule the input voltage should be limited to 2 to 3 volts above the output voltage. The LM78XX series can handle up to 30 volts input, but the power difference between the input voltage/current ratio and output voltage/current ratio appears as heat. If the input voltage is unnecessarily high the regulator will get very hot.

It is possible to increase the output voltage of a Regulator circuit using apair of 'voltage-divider' resistors (R1 and R2 in the diagram below), or a zener diode. It is not possible to obtain a voltage lower than the stated rating. You could not use a 12 volt regulator to make a 5 volt power supply, but you could use a 5 volt regulator to make a 12 volt supply.

29

If R1 is replaced with a suitable variable resistor ("potentiometer") it is

possible to make a simple 'variable' power supply.

Page 33: Automtic Vehicle Over Speed Monitoring and Parking

Figure 6.4 LM7805 Voltage Regulator

Some regulators are designed to produce a regulated voltage as low as 1.7 volts, for example the LM317. This type of regulator is ideal to use in 'variable' power supplies able to provide 1 amp regulated DC at voltages ranging from 1.7 to around 40 volts.

The interfaces described on this site are based on either 5 volt, or 12 volt integrated circuits. They use either LM7805, or LM7812 regulators.

6.2.3 FEATURES OF 7805 IC

Complete specifications at 1A load

Output voltage tolerances of ±2% at T = 25°C

Load regulation of 0.3% of Vout

Internal thermal overload protection

Internal short-circuit current limit

Output transistor safe-area protection 30

6.3 EXTERNAL CRYSTAL OSCILLATOR

Page 34: Automtic Vehicle Over Speed Monitoring and Parking

Figure 6.5 External Crystal Oscillator

First power and ground are connected to the upper right and lower left pins respectively. Next, a crystal is connected to the XTAL pins to provide stimulus for the internal oscillator as shown in the figure 6.4. When using a crystal, a buffering capacitor of 10 to 40pf is connected from each pin to ground. The crystal frequency ranges from 3 to over 50 MHz However, the choice of frequency is often determined by outside connections. For example, serial communications requires rather unusual frequencies such as 11.059 MHz If an oscillator is used, XTAL1 is the input to the oscillator amplifier and the input to the internal clock. XTAL2 is the output from the inverting oscillator amplifier. An 11.059 MHz crystal will provide good performance and excellent communications.

Crystal oscillators are oscillators where the primary frequency determining element is a quartz crystal. Because of the inherent characteristics of the quartz crystal the crystal oscillator may be held to extreme accuracy of frequency stability. Temperature compensation may be applied to crystal oscillators to improve thermal stability of the crystal oscillator.

31 Crystal oscillator is an electronic circuit that uses the mechanical resonance

of a vibrating crystal of piezoelectric material to create an electrical signal

Page 35: Automtic Vehicle Over Speed Monitoring and Parking

with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters.

Using an amplifier and feedback, it is an especially accurate form of an electronic oscillator. The crystal used therein is sometimes called a "timing crystal". On schematic diagrams a crystal is labeled Y.

Almost any object made of an elastic material could be used like a crystal, with appropriate transducers, since all objects have natural resonant frequencies of vibration. For example, steel is very elastic and has a high speed of sound. It was often used in mechanical filters before quartz. The resonant frequency depends on size, shape, elasticity and the speed of sound in the material. High-frequency crystals are typically cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used in digital watches, are typically cut in the shape of a tuning fork. For applications not needing very precise timing, a low-cost ceramic resonator is often used in place of a quartz crystal. When a crystal of quartz is properly cut and mounted, it can be made to bend in an electric field, by applying a voltage to an electrode near or on the crystal. This property is known as piezoelectricity.

When the field is removed, the quartz will generate an electric field as it returns to its previous shape, and this can generate a voltage. The result is that a quartz crystal behaves like a circuit composed of an inductor, capacitor and resistor, with a precise resonant frequency.

Quartz has the further advantage that its size changes very little with temperature. Therefore, the resonant frequency of the plate, which depends on its size, will not change much, either. This means that a quartz clock, filter or oscillator will remain accurate. For critical applications the quartz oscillator is mounted in a temperature-controlled container, called a crystal oven, and can also be mounted on shock absorbers to prevent perturbation by external mechanical vibrations.

32 Quartz timing crystals are manufactured for frequencies from a few tens of

kilohertz to tens of megahertz. More than two billion (2×109) crystals are

Page 36: Automtic Vehicle Over Speed Monitoring and Parking

manufactured annually. Most are small devices for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

The variable resistor connected at LCD pin 3 (VD) and ground, controls the LCD display contrast. LCD's with extended temperature range (negative °C) can need a negative voltage at the VD pin (3), so the variable resistor need to be connected in a different way - the center tap goes to pin 3 (VD), one side to +5Vdc, while the other goes to a negative voltage around -3Vdc or more. To reduce power consume over this trim pot, you can try values higher than 10k ohms. I observed several LCD's that connecting VD to Ground is enough to result in a good display contrast.

6.4 TRANSMITTER WORKING

The 230 volts AC supply at the input terminals is rectified using a bridge rectifier to 12 volts DC. The rectified voltage is fed to the voltage regulator LM7805 whose function is to generate a regulated 5 volts DC output. The 5 volt DC output for the IC89S52, TX remote and to the Reset circuitry. The reset circuit consists of the switch, diode IN4007, and a RC circuit. The function of the diode in the reset circuitry is to allow the use of a PNP or an NPN microcontroller.

The Reset pin is initially at active low state and whenever a reset action is required to reset the microcontroller chip the reset switch set to active high and the 5 volts DC is applied at the pin 9 of the chip which resets the microcontroller. The crystal oscillator generates a frequency of 11.059 MHz through XTAL1 and XTAL2, which acts as the clock for the microcontroller.

33 The microcontroller is programmed to transmit the required data. When the

circuit is turned on, the microcontroller starts transmitting the data through

Page 37: Automtic Vehicle Over Speed Monitoring and Parking

the TXD pin which turns high and drives the base of the transistor thereby making it to conduct. As the transistor starts conducting the TX Remote is connected to the microcontroller through TXD and starts transmitting the data, at a frequency of 38 KHz continuously.

34 CHAPTER 7

Page 38: Automtic Vehicle Over Speed Monitoring and Parking

7. RECEIVER MODULE

The operation of receiver module is two-fold. It receives the data and displays the corresponding area in LCD display.

RECEIVER SCHEMATIC DIAGRAM

Figure 7.1 Receiver Schematic

357.1 COMPONENTS OF RECEIVER MODULE:

Page 39: Automtic Vehicle Over Speed Monitoring and Parking

AT89s52 MICROCONTROLLER

230/12 V STEP DOWN TRANSFORMER

BRIDGE RECTIFIER

7805 IC VOLTAGE REGULATOR (12/5V)

LCD DISPLAY

RF MODULE

EXTERNAL CRYSTAL OSCILATOR

7.2LIQUID CRYSTAL DISPLAY

The Liquid Crystal Display (LCD) was first developed at RCA around 1971. LCDs are optically passive displays (they do not produce light). As a result, LCDs require all most no power to operate. Many LCD calculators can operate from the power of a solar cell; others can operate for years from small button cell batteries. LCDs work from the ability of liquid crystals (LC) to rotate polarized light relative to a pair of crossed polarizers laminated to the outside of the display. There are two main types of LCD displays used for calculators today: Twisted nematic (TN) and super twisted Nematic (STN). TN displays twist polarized light to 90 degrees and have a limited viewing angle. STN displays were developed to twist polarized light between 180 to 260 degrees resulting in better contrast and a wider viewing angle.

A LCD consists of two plates of glass, sealed around the perimeter, with a layer of liquid crystal fluid between them. Transparent, conductive electrodes are deposited on the inner surfaces of the glass plates.

36 The electrodes define the segments, pixels, or special symbols of the display.

Next a thin polymer layer is applied on top of the electrodes. The polymer is etched with channels in order to align the twist orientation of the LC's helix

Page 40: Automtic Vehicle Over Speed Monitoring and Parking

shaped molecules. Finally, polarizing films are laminated to the outer surfaces of the glass plates at 90 degree angles. Normally, two polarizing films at 90 degrees should be dark, preventing any transmission of light but due to the ability of LC to rotate polarized light the display appears clear. When AC voltage is passed through the LC, the crystals within this field align so that the polarized light is not twisted. This allows the light to be blocked by the crossed polarizer’s thus making the activated segment or symbol to appear dark.

Figure 7.2 Liquid Crystal Display

7.2.1 LCD THEORY OF OPERATION

Many other types of LCD displays are being developed for the laptop and CRT replacement market including full color versions. These include double and triple twisted pneumatic (DSTN and TSTN) displays and the Active-matrix Thin-film Twisted Pneumatic and Metal-Insulated-Metal Twisted Pneumatic (TFT-TN and MIM-TN) displays. Unfortunately these advanced displays are too expensive for most of the calculator market. TN LCD’s almost completely dominate today’s calculator market due to their extremely low power requirements, thin size, and low cost.

377.3 RF MODULE

Page 41: Automtic Vehicle Over Speed Monitoring and Parking

In Receiver circuit, we are using RF receiver to receive the signal which is transmitted by the RF Transmitter in the frequency of 433.92MHZ.

Figure 7.3 RF Module

This is similar to a spiral that is not flattened. Start with a piece of wire that is 2 or 3 times longer than a whip and wind it into a coil. The number of turns on the coil will depend on wire size, coil diameter, and turn spacing. The coil will need to be cut to resonate, and can be fine tuned by spreading 38or compressing the length of the coil. If the coil is wound tightly enough, it may be shorter than one-tenth of a wavelength. This antenna tunes sharply,

Page 42: Automtic Vehicle Over Speed Monitoring and Parking

requiring care in tuning. The real part of the antenna impedance is less than 20 ohms, and depends on the size of the coil and its orientation to ground.

Figure 7.4 Antenna 433.92 MHz

For 433.9 MHz, we wound 14 turns of 22 gauge wire around a 0.25 inch (6 mm) form. When tuned, its length was just less than one inch. The proximity of this coil to ground makes a big difference in performance. When the coil runs near and parallel to ground, maximum gain is only -18 dBd. When the loose end of the coil was pulled away from ground, as shown in the alternate version drawing, gain increased to -5.5 dBd, and the null became deeper.

It can be easily de-tuned by nearby objects, including a hand, so it may not be good for hand-held use

39 CHAPTER 8

8. VEHICLE MODULE USING STEPPER MOTOR

Page 43: Automtic Vehicle Over Speed Monitoring and Parking

Stepper Motor is used to drive the vehicle in this vehicle module. Two stepper motors are used. Stepper motor 1 is used to control the left and right movement of vehicle and stepper motor 2 is used to control the front and back movement of vehicle. These two stepper motor s are driven by driver circuit which has optocoupler, darlington pair transistor.

Figure 8.1a Darlington Pair Figure 8.1b Optocoupler

The Drivers of the stepper motor 1 and stepper motor 2 are connected to microcontroller. As per the program in microcontroller the driver drives the stepper motor in high speed which can rotate the wheel of the vehicle module in 10 rpm. When the radio frequency signal is received then the

40driver drives the stepper motor in normal speed which can rotate the wheel of a vehicle module in 5 rpm. Therefore, the speed of the vehicle module is reduced when the RF Signal is received.

Page 44: Automtic Vehicle Over Speed Monitoring and Parking

8.1 UNIPOLAR STEPPER MOTOR

Figure 8.2 Unipolar Stepper Motor

The schematic diagram of uni polar stepper motor is shown above. In Vehicle module two uni polar stepper motors are used to run it. In front side of the module stepper motor 1 is fixed between two wheels to control the left and right direction of the vehicle module.

The stepper motor 2 is connected between the two back side wheels to control the front and down movement of the vehicle module.

ULN2003 is the IC used in unipolar stepper motor to process the signal from driver circuit which is connected to 89S52 microcontroller. First four pins of ULN2003 are interfaced to the driver circuit and the fifth pin is grounded.

41 This stepper motor works in 12v power supply and current is 1.5 to 2 amps.

It is 3kg torque stepper motor which can rotate in 27 rpm. It can pull the load up to 5kg to 6kg. In this vehicle module the gear ratio of stepper motor is 1:3.

Page 45: Automtic Vehicle Over Speed Monitoring and Parking

Two stepper motors are driven by two separate driver circuit. The driver circuit of stepper motor 1 is interfaced with microcontroller in port 0. The driver circuit of stepper motor 2 is interfaced in port 2 of microcontroller.

42 CHAPTER 9

9. BLOCK DIAGRAM

9.1 BLOCK DIAGRAM OF TRANSMITTER MODULE

Page 46: Automtic Vehicle Over Speed Monitoring and Parking

Figure 9.1 Block diagram of Transmitter Module

Description

The 230 volts AC supply at the input terminals is step downed to 12 volts AC by Step down transformer and it is rectified using a bridge rectifier to 12 volts DC. The rectified voltage is fed to the voltage regulator LM7805 whose function is to generate a regulated 5 volts DC output. The 5 volt DC output is for the 89S52 microcontroller, HT-12E and RF Transmitter.

When the transmitter module is connected to the supply, the microcontroller starts to process as per the program coded in it.

43 The Encoder is connected in the Port 2 of 89S52 microcontroller. The

signal is encoded in the encoder and it is transmitted by the RF Transmitter.

AT89S52

Micro controller

Power supply

Encoder RF Transmitter

Page 47: Automtic Vehicle Over Speed Monitoring and Parking

The RF Transmitter will be transmitting the RF Signal until it is disconnected from the power supply.

9.2 BLOCK DIAGRAM OF RECEIVER MODULE

Figure 9.2 Block diagram of Receiver

Description

The 230 volts AC supply at the input terminals is step downed to 12 volts AC by Step down transformer and it is rectified using a bridge rectifier to 12 volts DC. The rectified voltage is fed to the voltage 44regulator LM7805 whose function is to generate a regulated 5 volts DC output. The 5 volt DC output is for the 89S52 microcontroller, HT-12D, RF Receiver, LCD, and Eye Blink Sensor.

Power supply

AT89S52

Micro controller

LCD

Stepper driver

Stepper

Motor

RF Receiver Decoder

Eye Blink sensor

Page 48: Automtic Vehicle Over Speed Monitoring and Parking

For stepper drivers, separate 230V – 12V Step down transformer is used for power supply. Bridge circuit is used for rectification and filter is used to remove the AC ripples. By using voltage regulator LM7812, a constant 12V DC supply is taken as output. The current rating of the stepper motor is 1.2 to 2 amps, so separate power supply circuit is applied for stepper drivers.

The vehicle module starts to run when it is connected to power supply. The speed of the vehicle module is displayed in the LCD. The RF transmitter is placed in an area. When the vehicle module passes through that area, the RF receiver in the receiver module starts to receive the RF signal from RF transmitter.

When the RF signal is received, the signal is decoded using a decoder. The decoder is interfaced with microcontroller. As per the program, the microcontroller runs the delay program. The signal given to stepper driver is changed which can drive the stepper motor in less rpm. Therefore, the wheel of the vehicle rotates in slow speed and hence the speed of the vehicle module is reduced. The controlled speed is displayed in LCD.

45

9.3 Automatic Parking

Page 49: Automtic Vehicle Over Speed Monitoring and Parking

Eye blink sensor is used to sense the eye blinking count of user of the vehicle. Here we have used the model of eye blink sensor. This sensor is connected in the head of the user of vehicle.

When the user blinks his eyes, the eye blink sensor takes it as count. Actual use of the sensor is to make a count whenever the user blinks his eyes. The count of eye blink sensor is displayed in LCD.

Normally, a vehicle user will blink his eyes twenty five times per minute. So the eye blink sensor should make twenty five counts in every minute. If the user of the vehicle falls asleep or feels drowsy then the blinking count of his eyes will get decrease.

If the eye blink sensor makes a count below twenty five in a minute, immediately it is intimated to microcontroller. The microcontroller confirms that the user is drowsy and it changes the signal given to stepper driver.

The vehicle speed is reduced and the left indicator is switched on automatically. The vehicle module takes a left turn and it stops. The four indicators of all side are switched on automatically to indicate that the vehicle is parked in that area. Also it helps the user who comes after this vehicle to confirm that vehicle is parked and to pass that area safely without any accident.

46

CHAPTER 10

Page 50: Automtic Vehicle Over Speed Monitoring and Parking

APPENDICES

10. PROGRAM

10.1 LCD

#include<regx51.h>

#include<intrins.h>

void delay(unsigned int x);

sbit busy=P1^7;

sbit RS=P3^5;

sbit RW=P3^6;

sbit EN=P3^7;

void lcd_initial();

void command_initial(unsigned int a);

void data_initial(unsigned char b);

void check();

void write_lcd(unsigned char *s);

void lcd_conv(unsigned int v);

void lcd_conv(unsigned int v)

{

int a,x,y,z;

a=v%100;

47

x=v/100;

Page 51: Automtic Vehicle Over Speed Monitoring and Parking

y=a/10;

z=a%10;

data_initial(x+0x30);

data_initial(y+0x30);

data_initial(z+0x30);

}

void lcd_initial()

{

command_initial(0x38);

command_initial(0x0c);

command_initial(0x01);

command_initial(0x80);

command_initial(0xc0);

command_initial(0x05);

}

void command_initial(unsigned int a)

{

P1=a;

RS=0;

RW=0;

EN=1;

48

delay(1);

Page 52: Automtic Vehicle Over Speed Monitoring and Parking

EN=0;

check();

}

void data_initial(unsigned char b)

{

P1=b;

RS=1;

RW=0;

EN=1;

delay(1);

EN=0;

check();

}

void check()

{

busy=1;

RS=0;

RW=1;

EN=0;

delay(1);

EN=1;

49

while(busy==1);

Page 53: Automtic Vehicle Over Speed Monitoring and Parking

}

void write_lcd(unsigned char *s)

{

while(*s!='\0')

{

data_initial(*s);

s++;

_nop_();

}

}

10.2 RECEIVER

#include <REGX51.H>

#include<intrins.h>

void check();

void lcd_initial();

unsigned int str_count=500,veh_count=500,spd_cout=200;

void command_initial(unsigned int a);

void data_initial(unsigned char b);

void write_lcd(unsigned char *);

void stop(unsigned int y);

50

void forward();

Page 54: Automtic Vehicle Over Speed Monitoring and Parking

void forward1();

void slow();

void uturn();

void stright();

void speed();

void left();

sbit eye=P3^2;

sbit led1=P3^0;

sbit led2=P3^1;

bit timer_flag=0;

//void stop();

unsigned int eye_count=0,count_val=0,rpm=10,rpm_school=5;

void lcd_conv(unsigned int v);

void delay(unsigned int x)

{

int i;

for(i=0;i<=x;i++)

{

_nop_();

}

}

51

void eye_check()interrupt 0

Page 55: Automtic Vehicle Over Speed Monitoring and Parking

{

if(eye==0)

{

eye_count=eye_count+1;

delay(2500);

}while(eye==0);

}

void eye_time()interrupt 1

{

TL0=0x00;

TH0=0x00;

count_val=count_val+1;

if(count_val==220)

{

timer_flag=1;

TR0=0;

TL0=0x00;

count_val=0;

if(timer_flag==1)

{

if(eye_count<25)

52

{

Page 56: Automtic Vehicle Over Speed Monitoring and Parking

led1=0;

led2=1;

timer_flag=0;

command_initial(0x01);

command_initial(0x80);

timer_flag=0;

write_lcd("driver drowsy");

left();

eye_count=0;

count_val=0;

led1=0;

led2=0;

while(1);

}//while(eye_count<10);

if(eye_count>25)

{

eye_count=0;

count_val=0;

timer_flag=0;

command_initial(0x01);

command_initial(0x80);

53

write_lcd("driver normal");

Page 57: Automtic Vehicle Over Speed Monitoring and Parking

delay(10000);

delay(10000);

delay(10000);

timer_flag=0;

TR0=1;

}while(eye_count>10);

}

}

}

void main()

{

TMOD=0x01;

TL0=0x00;

TH0=0x00;

IE=0x83;

PX0=1;

PT0=1;

eye=1;

54

P0=0xff;

Page 58: Automtic Vehicle Over Speed Monitoring and Parking

led1=1;

led2=1;

lcd_initial();

command_initial(0x80);

write_lcd("vechile normal");

command_initial(0xC0);

write_lcd("speed:");

command_initial(0xC6);

lcd_conv(rpm);

command_initial(0xC9);

write_lcd("eye:");

command_initial(0xCd);

lcd_conv(eye_count);

count_val=0;

TR0=1;

while(1)

{

if(timer_flag==0)

{

do

{

55

forward();

Page 59: Automtic Vehicle Over Speed Monitoring and Parking

command_initial(0xCd);

lcd_conv(eye_count);

}while(P0==0xFF);

if(P0==0xf1)

{

command_initial(0x01);

command_initial(0x80);

write_lcd("school zone low");

command_initial(0xC0);

write_lcd("speed:");

command_initial(0xC6);

lcd_conv(rpm_school);

command_initial(0xC9);

write_lcd("eye:");

command_initial(0xCd);

lcd_conv(eye_count);

slow();

command_initial(0x01);

command_initial(0x80);

write_lcd("vechile over");

56

command_initial(0xC0);

Page 60: Automtic Vehicle Over Speed Monitoring and Parking

write_lcd("speed control");

forward();

}while(P0==0xf1);

}

}

}

10.3 VEHICLE

#include <REGX51.H>

#include<intrins.h>

sbit led1=P3^0;

sbit led2=P3^1;

void stop();

sbit buzzer=P3^3;

void delay(unsigned int x);

unsigned int count_spd=50,count=400,str_count=200,veh_count=200;

void stop(unsigned int y)

{

int j;

57

for(j=0;j<=y;j++)

Page 61: Automtic Vehicle Over Speed Monitoring and Parking

{

_nop_();

}

}

void forward()

{

P2=0x0a;

delay(300);

P2=0x09;

delay(300);

P2=0x05;

delay(300);

P2=0x06;

delay(300);

}

void left()

{

int val=200;

buzzer=1;

58

do

Page 62: Automtic Vehicle Over Speed Monitoring and Parking

{

led1=0;

P2=0xaa;

led1=1;

delay(650);

led1=1;

P2=0x99;

led1=0;

delay(650);

led1=1;

P2=0x55;

led1=0;

delay(650);

led1=1;

P2=0x66;

led1=0;

delay(650);

val--;

}while(val!=0);

P2=0x00;

buzzer=0;

59

delay(65000);delay(65000);

Page 63: Automtic Vehicle Over Speed Monitoring and Parking

P0=0x00;

}

void slow()

{

int count=500;

do

{

P2=0x0a;

stop(1200);

P2=0x09;

stop(1200);

P2=0x05;

stop(1200);

P2=0x06;

stop(1200);

count--;

}while(count!=0);

}

void uturn()

{

60

veh_count=200;

Page 64: Automtic Vehicle Over Speed Monitoring and Parking

do

{

P2=0x6a;

delay(450);

P2=0x59;

delay(450);

P2=0x95;

delay(450);

P2=0xa6;

delay(450);

veh_count--;

} while(veh_count!=0);

}

void stright()

{

str_count=200;

do

{

P2=0xaa;

delay(350);

P2=0x99;

61

delay(350);

Page 65: Automtic Vehicle Over Speed Monitoring and Parking

P2=0x55;

delay(350);

P2=0x66;

delay(350);

str_count--;

}while(str_count!=0);

forward();

}

void stop()

{

count_spd=50;

do

{

P2=0x00;

stop(500);

count_spd--;

}while(count_spd!=0);

}

62

10.4 CONCLUSION

Page 66: Automtic Vehicle Over Speed Monitoring and Parking

The method of over speed monitoring and controlling has been discussed in this project. It is believed that this method offers more security than other methods. This being a real time project can be implemented in risky areas to save more life from accidents. The technological advancement in the field of electrical and electronics has paved the path to this valuable project which plays a major role in saving the valuable lives of people. At the same time, this project can be enhanced in various such as wireless techniques which makes more sophisticated, reduces the accidents. The project can be applied in various areas because of its advantages namely man power is reduced, automatic control without user interface. It is simple and easy to implement. Many methods have been put forth but this has become an effective method.

63

10.5 REFERENCES

Page 67: Automtic Vehicle Over Speed Monitoring and Parking

• Yunseop (James) Kim, Robert G.Evans, and William M.Iversen “Remote Sensing and Control of an Irrigation System Using a Distributed Wireless Sensor Network” IEEE Transaction on Instrumentation and measurement, vol.57,no.7, july2008

• Everett E. Crisman, Anne Loomist, Robin Shaw, Zofia Laszewski “Using the eye wink control interface to control a powered wheelchair” Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 13, No. 4. 1991

• Kohji Mitsubayashi, Takuo Kon and Yuki Hashimoto “Optical bio-sniffer for ethanol vapor using an oxygen-sensitive optical fiber ” Biosensors and Bioelectronics, Volume 19, Issue 3, 30 November 2003, Pages 193-198

64