Advanced Vehicle Control System

70
CHAPTER 1 INTRODUCTION It is known that road accidents are increasing day by day. India has the record of registering the highest number of road accidents in the world. Of all the causes, exceeding the posted limit or driving too fast is one of the most important factors and drunken driving is also contributing to traffic crashes. According to statistics, over 1, 37,000 people were killed in road accidents in 2013 alone. Road accidents are the major cause of accidental death in India. 1.1 CAUSES AND PREVENTION OF ROAD ACCIDENTS 1 FIG 1.1 PERCENTAGE SHARE OF VARIOUS CAUSES OF ACCIDENTAL

description

Report on Advanced vehicle control system

Transcript of Advanced Vehicle Control System

CHAPTER 1INTRODUCTION It is known that road accidents are increasing day by day. India has the record of registering the highest number of road accidents in the world. Of all the causes, exceeding the posted limit or driving too fast is one of the most important factors and drunken driving is also contributing to traffic crashes. According to statistics, over 1, 37,000 people were killed in road accidents in 2013 alone. Road accidents are the major cause of accidental death in India.

FIG 1.1 PERCENTAGE SHARE OF VARIOUS CAUSES OF ACCIDENTAL DEATH1.1 CAUSES AND PREVENTION OF ROAD ACCIDENTSThe Majority of road crashes are caused by human error. Research has shown that driver error accounts for over 80% of all fatal and injury crashes. The main cause of death and injury on roads remain speeding, drink driving and non wearing of seat belts. Because most traffic accidents are the product of several factors, the probability of accidents can be reduced in a number of different ways. There is no doubt that the following activities have prevented the increases in accidents that would normally result from increases in traffic density. There are three main approaches to prevent accidents:1. Education and training of public about road safety2. Enforcement of traffic laws3. Engineering of vehicles and roadsRoad or traffic engineering comprise (a) the design of new roads which are inherently safe (separating opposing traffic flows, eliminating cross, traffic, and providing wide shoulders and traffic lanes and good visibility; (b) improving existing roads by realignment, improving vision, and resurfacing slippery surfaces; (c) regulating traffic movement by installing traffic signals, traffic islands, road markings and regulatory signs such as stop and give way signs; and (d)assisting the driver with warning and destination signs to avoid danger and confusion. But designing of future vehicles would be more advisable than road engineering. This method of designing future generation vehicles for avoiding accidents is explained in this project.1.2 STATISTICS OF ROAD ACCIDENTS IN INDIAIn India road accidents are the major cause of accidental deaths. The table mentioned below gives the data related to the total number of people died due road accidents from 2002 to 2011.The statistics clearly shows that the rate of accidents is predominantly increasing every year and it emphasizes the need to think in this regard of reducing the road accidents. The rate of accidents in different states of India is mentioned in table.

TABLE 1.1: RATE OF ACCIDENTS IN DIFFERENT STATES FROM 2003-20111.3 EXISTING TECHNIQUES FOR PREVENTION Actions are required to properly to monitor and regulate the vehicle speeds and stop drunken driving. Many systems have been developed to prevent these road accidents. One of them is Cruise control system (CC) that is capable of maintaining speed defined by the driver and its later evolution version Adaptive Cruise Control (ACC) that keeps the automobile at safer distance from the preceding vehicle. But these systems have no capability to detect the curved roads where the speeds of the automobiles have to be lowered to avoid the accidents. Later curve warning systems (CWS) have been developed to detect the curved roads by using Global Positioning System (GPS) and the digital maps obtained from the Geographical Information Systems (GIS) to assess threat levels for driver if approaching the curved road quickly. But these maps need to be updated regularly and are not useful if there are unexpected road diversions or extensions etc. Speed radars are installed at regular intervals along roads where, these radars monitor the speed of vehicles and capture information of over speeding vehicles by taking photographs. Thus in spite of the huge investments involved, the system is capable of only identifying the over speeding vehicle but unable to restrict the top speed of the vehicle. 1.4 ROAD ACCIDENT DEATH BY VARIOUS MODES OF TRANSPORT From surveys conducted by different government and nongovernmental organizations, the rate of accidents by different vehicles has been recorded. The accidents are mainly caused by four wheeler vehicles and this is mainly because of over speeding and drunken driving. The following pie chart represents the accidents caused by different modes of road transport.

FIG 1.2: ROAD ACCIDENT DEATH BY DIFFERENT TYPES OF VEHICLE

FIG 1.3: ROAD ACCIDENT DEATH BY VARIOUS MODES OF TRANSPORT

CHAPTER 2LITERATURE REVIEW

2.1 GENERAL

In this chapter we reviewed several papers regarding the speed control of vehicles. Generally most of the papers were based on the idea of intimating the driver about the violation of speed limit.

2.2 LITERATURE SURVEY

Agerholm N. ,Waagepetersen R.,Tradisauskas N.,Lahrmann H. said in their paper" Intelligent speed adaptation in company vehicles (2008)" about an intelligent speed adaptation project for company vehicles. The intelligent speed adaptation function in the project is both information and incentive, which means that the intelligent speed adaptation equipment gives a warning as well as penalty points if the driver is speeding. Each month the driver with the fewest points wins an award. The paper presents results concerning speed attitude on the first three of a planned 12 months test period. In all 26 vehicles and 51 drivers from six companies participate in the project. The key result is that speeding is reduced from 18.7% to 7.4% on urban roads with a speed limit of 50 km/h while it is reduced from 18.9% to 4.7% on rural roads with a speed limit of 80 km/h. Drawback: But, the problem is that even if the driver violates the speed limit after the hearing of beep sound, there is no provision for the speed control. So this system is useful only for identifying the speed violation and it does not provide speed control. So, this system is not an efficient technique for reducing the occurrence of accidents.

Gruyer D. ,Glaser, S.,Vanholme B., Monnier B. said in their paper "Simulation of automatic vehicle speed control by transponder equipped infrastructure(2009)" that a huge amount of research has been done to improve the safety of road environments and reduce the risk of unsafe traffic areas. Initially this research was mainly focused on the perception surrounding a vehicle (local perception with embedded sensors) and its potential reaction on hazardous situation. Since a few years, it has become clear that a local perception is not sufficient. Its extension is essential to minimize risk and maximize the security of the road traffic. To achieve such extension, additional works is required as well as implementation of a lot of devices often very expensive. Therefore, in early design stage, it becomes necessary to have a simulation environment dedicated to prototyping and evaluating these extended and enriched driving assistance systems. For such virtual platform it is mandatory to provide physic-driven road environments, virtual embedded sensors, embedded and virtual communicating devices and physic-base vehicle models. In this publication, we present the prototyping of a speed control application by using beacons put on the road side. The SiVIC simulation platform is used to generate the virtual world (the environment, sensors, beacons, and vehicle). The framework platform RTMaps is used for prototyping the automatic speed control algorithm. The seamless coupling of these platforms allows subsequently embedding the prototyped application directly on a real vehicle.In the paper "GPS enabled speed control embedded system speed limiting device with display and ECI-(2013)", it is said that, one of the ways to reduce vehicle crashes is to prevent excessive speeding in the roads and highways. The paper aims to outline the design of an embedded system that will automatically control the speed of a motor vehicle based on its location determined by a GPS device. The embedded system will make use of an AVR ATMega128 microcontroller connected to an EM-406A GPS receiver. The large amount of location input data justifies the use of an ATMega128 microcontroller which has 128KB of programmable flash memory as well as 4KB SRAM, and a 4KB EEPROM Memory. The output of the ATMega128 will be a DOGMI63W-A LCD module which will display information of the current and the set-point speed of the vehicle at the current position. A discrete indicator LED will flash at a pre-determined frequency when the speed of the vehicle has exceeded the recommended speed limit. Finally, the system will have outputs that will communicate with the Engine Control Unit (ECU) of the vehicle. For the limited scope of this project, the ECU is simulated as an external device with two inputs that will acknowledge pulse-trains of particular frequencies to limit the speed of a vehicle. The speed control system will be programmed using mixed language C and Assembly with the latter in use for some pre-written subroutines to drive the LCD module. The GPS module will transmit National Marine Electronics Association (NMEA) data strings to the microcontroller (MCU) using Serial Peripheral Interface (SPI). The MCU will use the location coordinates (latitude and longitude) and the speed from the NMEA RMC output string. The current speed is then compared against the recommended speed for the vehicles location. The memory locations in the ATMega128 can be used to store set-point speed values against a articular set of location co-ordinates. Apart from its implementation in human operated vehicles, the project can be used to control speed of autonomous cars and to implement the idea of a variable speed limit on roads introduced by the Department of Transportation.Drawback: The main disadvantage in this idea is, a GPS device should be used to identify the location. The operation of the GPSs module is based on the weather conditions. This GPS module also increases the cost of the system. So, this system has some drawbacks.Muzahid Hussain, Abhishek Tayal, Sarabjot Singh said in their paper "Position Matching Based Autonomous Speed Regulation System forVehicles (2014)" about creating an advisory/regulatory environment to limit the maximum running speed of the vehicle is presented. This paper deals with creating an onboard speed regulation module for vehicles which can monitor as well as control their instantaneous speed in comparison with the maximum permissible speed of that location. The location is obtained using position tracking technology of GPS and GSM system. The work discusses the unique position matching algorithm developed and design details of the proposed on-board module for limiting vehicles speed. The algorithm continuously compares the actual speed of the vehicle with its corresponding location based limitsObtained through the developed database and thus provides:a) An advisory signal to the driver about the need for a reduction in speed.b) An automatic restriction of the speed below the prescribed limits.The algorithm matches the position with the geographical zone alreadydefined in the database and compares the actual speed with the limit of the corresponding zone on an intermittent basis, depending on the execution time of the processing cycle. The algorithm developed tracks the vehicle position using data acquired from both GPS and GSM receivers which lead to increased efficiency, reduced complexity and processing time in contrast to the conventional methods.

Drawback: The main disadvantage in this idea is, a GPS device should be used to identify the location. The operation of the GPSs module is based on the weather conditions. This GPS module also increases the cost of the system.

CHAPTER-3 PROPOSED SYSTEM

3.1 GENERALMany accidents are at least partially caused because of rash driving. This can happen due to many reasons: poor judgment on the part of the driver, poor driving by the driver. An innovative concept is suggested by which the speed of the vehicle can be controlled automatically at a given limit for a particular limiting distance and practically by the developed concept system; the problems related to traffic as well as accidents will be controlled.

3.2 CONCEPT METHODOLOGYThe proposed system is a kind of speed control system based on colour strips on roads where the speed control limit is desired. In this developed system, the various colour strips are marked on roads and vehicles will have a colour detecting sensor located below the bumper on chassis of vehicle which will recognize the colour of colour strips marked on roads and accordingly maintain the vehicles speed in that particular limit. In this way, this system reduces the road accidents and gets driving comfort for the driver because of limited speed.

The different areas where the automatic speed control system recommended are

Mostly useful to avoid an accidents on turning area/sharp corners in government area (offices), defense / camp area or Residential area, school zones and villages that are located at the highways and beside the highways.

Sometimes on zigzag roads speed limit takes place. In such case, also this system plays an important role to avoid accidents.

On highway roads mostly this system is useful for safe driving and control the traffic problem. Its mostly 65km/hr in India, 80km/hr in the countries like U.S.A., Canada, and U.K.

An alcohol odour sensor is integrated with the ignition system of the vehicle. When a driver intends to start the vehicle, he/she will be insisted to blow on the sensor after using the key. The output of the sensor is also considered as a key to start the vehicle. Only if the air blown by the driver is free from alcohol the vehicle starts. This will avoid drunken driving and provide safety to both the driver and the pedestrians.

3.3 BLOCK DIAGRAM

The proposed project consists of two modules for its operation. They are i) Module to control the speed based on the colour strip sensedii) Module to detect drunken driving

3.3.1 Block diagram to control the speed based on the colour strip sensed

FIG 3.1: Block diagram to control the speedEXPLANATION OF BLOCK DIAGRAM:The various design components of this system are the colour strips which are painted on highway roads and a colour sensor located below the bumper on chassis which will recognize the colour on roads, the programmable MCU which process signals from various components and send the signal to control the throttle valve/fuel pump, speedometer and vehicle. The MCU unit is programmed in such a way that the vehicle speed is set for each colour. For each colour sensed by the sensor the speed of the vehicle is varied accordingly50

3.3.2 Block Diagram to detect Drunken Driving

FIG 3.2: Block Diagram to detect Drunken Driving

EXPLANATION OF BLOCK DIAGRAM:

The alcohol odour sensor integrated with the ignition system avoids the driver to drive the vehicle if drunk. An alcohol odour sensor is integrated with the ignition system of the vehicle. When a driver intends to start the vehicle, he/she will be insisted to blow on the sensor after using the key. The output of the sensor is also considered as a key to start the vehicle. Only if the air blown by the driver is free from alcohol the vehicle starts. This will avoid drunken driving and provide safety to both the driver and the pedestrians

3.4 OPERATIONAL METHODOLOGY

By using the colour strips painted on the road and colour detecting sensor, we control the ECU/MCU for controlling the flow of fuel to the engine. In this system, colour detecting sensor of specific intensity is used to activate/deactivate the system of speed control. Colour sensor is located below the bumper on chassis. Hall Effect sensors are located in the vehicles wheels for the high accuracy measurement of speed of the car. Sensor fusion is applied to the information received by these subsystems, and used to adjust the speed of the vehicle with a controller.

When the vehicle enters the speed limiting road whose speed limit is approximately 80km/hr /60km/ hr/75km/hr etc. respectively, the colour detecting sensor detect the colour of colour strips on the road to activate the system and send the signals to MCU. MCU control the position of throttle valve which result in controlling the speed of engine at given limit. When the system is activated then our vehicle is controlled at given speed or below that limiting speed and not exceed beyond that limit till crossing the next colour strips on the road. The driver will be asked to blow in alcohol odour sensor once he uses his car key. The sensor detects the percentage of alcohol in the air and intimates the controller about it. According to the programming of the controller the ignition system synchronized with the controller works. If the alcohol percentage is more than the mentioned amount then the ignition system will not start the car. This will definitely avoid drunk and driving.

FIG 3.3: OPERATIONAL METHODOLOGY3.5. FLOW CHART OF DESIGN ALGORITHM

FIG 3.4: FLOWCHARTCHAPTER-4HARDWARE REQUIREMENTS4.1 GENERALIn this chapter the various components used for the hardware implementation of the project is explained with their specification and the operating methodology is explained with their pin configurations. The major hardware contributing in the implementation includesi) Micro controllerii) Colour sensoriii) Alcohol odour sensor

4.2 Microcontroller Unit [MCU]

A microcontroller is an integrated chip that is often part of an embedded system. The microcontroller includes a CPU, RAM, ROM, I/O ports, and timers like a standard computer, but because they are designed to execute only a single specific task to control a single system, they are much smaller and simplified so that they can include all the functions required on a single chip. Microcontroller responds in accordance with the program that has been fed into it. In a microcontroller program you receive the inputs from a set of input pins that you specify and then process the input and produce your output on a set of output pins in form digital signal. Here we use PIC16F877A microcontroller in this hardware.

4.2.1 Why PIC16F877A ?This microcontroller is generally preferred because it has the following features.

High-Performance RISC CPU:

Only 35 single-word instructions to learn All single-cycle instructions except for program branches, which are two-cycle Operating speed: DC 20 MHz clock input DC 200 ns instruction cycle Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers

Peripheral Features:

Timer0: 8-bit timer/counter with 8-bit prescaler Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external crystal/clock Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler Synchronous Serial Port (SSP) with SPI (Master mode) and I2C (Master/Slave) Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection Parallel Slave Port (PSP) 8 bits wide with external RD, WR and CS controls (40/44-pin only) Brown-out detection circuitry for Brown-out Reset (BOR)

Analog Features:

10-bit, up to 8-channel Analog-to-Digital Converter (A/D) Brown-out Reset (BOR) Analog Comparator module with:- Two analog comparators- Programmable on-chip voltage reference (VREF) module- Programmable input multiplexing from device inputs and internal voltage reference- Comparator outputs are externally accessible

Special Microcontroller Features:

100,000 erase/write cycle Enhanced Flash program memory typical 1,000,000 erase/write cycle Data EEPROM memory typical Data EEPROM Retention > 40 years Self-reprogrammable under software control In-Circuit Serial Programming (ICSP) via two pins Single-supply 5V In-Circuit Serial Programming Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation Programmable code protection Power saving Sleep mode Selectable oscillator options In-Circuit Debug (ICD) via two pins

CMOS Technology:

Low-power, high-speed Flash/EEPROM technology Fully static design Wide operating voltage range (2.0V to 5.5V) Commercial and Industrial temperature ranges Low-power consumption The characteristics of the various PIC16F87XA microcontrollers

TABLE 4.1: CHARACTERISTICS OF THE VARIOUS PIC16F87XA MICROCONTROLLERS

4.2.2 PIC16F877A PIN Configuration:This microcontroller is a 40 PIN IC. This has 5 input ports. This device has fifteen interrupts and eight input channels. The parallel slave port is implemented in this device. The pin diagram of this device is given in the below figure.

FIG 4.1 : PIN CONFIGURATION OF PIC16F877A

TABLE 4.2: DESCRIPTION OF ALL PINS IN PIC16F877A MCThe operation of every pin in the microcontroller is explained

4.3 Colour SensorThey register the items by contrast, true colour or translucent index. True colour sensors are based on one of the colour models, most commonly the RGB model. A large percentage of the visible spectrum can be created using these three primary colours. Many colour sensors are able to detect more than one colour for multiple colour sorting applications. Depending on the sophistication of the sensor, it can be programmed to recognize only one colour, or multiple colour types or shades for sorting operations.

4.3.1 Selection of colour sensorThis color sensor identifies color and gives serial output of RBG value. It can identify 16.7 million color shades giving RGB value for the detected color. The detected color is identified as amount of three primary color values namely Red, Green & Blue with 8 bit accuracy for each primary color. Any color can be separated or combined into three primary colors Red, Green and Blue using the RBG values. RGB values are a type of UART interface for direct connection to any MCU or USB-TTL convertor.

4.3.2 Block diagram of colour sensorThe simplest colour sensor can be made using photo resistor known as LDR. In same condition (ambient light, temperature) objects with different colour makes different terminal resistance. Using comparators it is possible to detect colour, but when you use sensor in different condition resetting must be made again.The most popular colour sensors are integrated semiconductor sensors and generally represent LED that generates current according to detected light. With embedded wavelength filter it is possible to make sensor for every colour. Generally, block diagram of colour sensor is next circuit.

FIG 4.2: BLOCK DIAGRAM OF COLOUR SENSORSince output of LED detector is very small current it is necessary to convert current in voltage and amplify signal. Common circuit known astransimpedanceamplifier is used. Resistor is about few hundred Mega Ohms.Not all colour sensor has transimpedance amplifier an in that case user have to make processing. Colour sensor can have different type of outputs, but most popular are frequency and voltage outputs. There are 3 lines for every basic colour, red, green or blue. Very simple usage is to make comparator circuit for every channel and generate digital output.4.3.3 Operation of Colour Sensor

FIG 4.3: OPERATION OF COLOUR SENSOR

On this way it is possible to detect other colours than red, green and blue. Detection process is much better if there is a source of light that emit lights close to day light (white light). White LEDs are commonly used. In this case it should be known that white LED spectre is not ideal to white lights as it shown on picture4.4 Alcohol Odour SensorThis alcohol sensor is suitable for detecting alcohol concentration on your breath, just like your common breathalyzer. It has a high sensitivity and fast response time. Sensor provides an analog resistive output based on alcohol concentration. The drive circuit is very simple, all it needs is one resistor. A simple interface could be a 0-3.3V ADC. Here we use MQ3 alcohol gas sensor.4.4.1 Features of Alcohol Odour Sensor 5V DC or AC circuit Requires heater voltage Operation Temperature: -10 to 70 degrees C Heater consumption: less than 750mW4.4.2 OperationSensitive material of MQ-3gas sensor is SnO2, which with lower conductivity in clean air. When the target alcohol gas exist, the sensors conductivity gets higher along with the gas concentration rising. Users can convert the change of conductivity to correspond output signal of gas concentration through a simple circuit.MQ-3gas sensor has high sensitivity to alcohol gas and can resistant to the interference of gasoline, smoke and vapour. It is with low cost and suitable for various applications of detecting alcohol at different concentration.

4.4.3 TECHNICAL PARAMETERS

TABLE 4.3: TECHNICAL PARAMETERS OF ALCOHOL ODOUR SENSOR

FIG 4.4: MODEL VEHICLE IMAGE

CHAPTER-5SOFTWARE IMPLEMENTATION5.1 GENERALSimulation software is based on the process of modeling a real phenomenon with a set of mathematical formulas. It is, essentially, a program that allows the user to observe an operation through simulation without actually performing that operation. Here we use Proteus 8 Professional software to simulate our project. The hex file for our simulation is generated using the Keil u Vision 4 software.

5.2 KEIL SOFTWAREKeil is a cross compiler. Definition of cross compiler is acompilerthat runs on one computer but producesobject codefor a different type of computer. Cross compilers are used to generatesoftwarethat can run on computers with a new architecture or on special-purpose devices that cannot host their own compilers.Cross compilers are very popular for embedded development, where the target probably couldn't run a compiler. Keil is a German based Software development company. It provides several development tools likeIDE (Integrated Development environment)Project ManagerSimulatorDebuggerC Cross Compiler, Cross Assembler, Locator/LinkerKeil Software provides you with software development tools for the 8051 family of microcontrollers. With these tools, you can generate embedded applications for the multitude of 8051 derivatives. Keil provides following tools for 8051 development1.C51 Optimizing C Cross Compiler,2.A51 Macro Assembler,3.8051 Utilities (linker, object file converter, library manager),4.Source-Level Debugger/Simulator,5.Vision for Windows Integrated Development Environment.The Keil tool kit includes three main tools, assembler, compiler and linker. An assembleris used to assemble your 8051 assembly program. A compileris used to compile your C source code into an object file. A linkeris used to create an absolute object module suitable for your in-circuit emulator.5.2.1 Steps in Generating a Hex FileSTEP 1: First download and install v4.exe setup in the computer, this is the main executable of it. Then simply go on start menu, then search as "keil" without quotes, if you have installed it correctly, then you will find this on the top of results.

Once it is opened,our workspace will be something like this.

FIG 5.1: Keil uVision 4 Workspace Startup look

STEP 2: Now we have to create the Keil uVision project in order to proceed further. For that Click on "Project" & select "New uVision Project".

FIG 5.2: Keil uVision 4 Project Menu Option

STEP 3: Give a name to our project, the project name can be anything but, should not be starting with a digit.

FIG 5.3: Project Save Option in Keil uVision 4

Once named the project. Click on "Save".

STEP 4: Now a new window will open, which will tell us to select the device, so it will depend on your vendor, like nxp, atmel, Intel, who manufacture the 8051 IC, & you have purchased one of them. Select the exact configuration to get go, on the next step. To find the exact version of 8051 IC you are having, look deeply on your 8051 IC. Then match exact codes for vendors & version. For example if the vendor is Atmel & device is AT89C51. After selecting your device click on "OK"

FIG 5.4: Selecting a Vendor & Version/Type of 8051 IC

Now, one dialog box will appear stating,to copy 'STARTUP.A51' to project folder & add file to Project, Select Yes.

FIG 5.5: Dialog Box in Keil, to copy STATUP.A51 to project folder & add the file to the project

Step 5: Now after creating the project you need to create the source, which Keil will later on Compile (on your command). For that go to the "File" menu, and select "New".

FIG 5.6: Creating New File in Keil uVision 4

A text window will open, where we are going to write a code to compile & create the .hex file. Write down your code& save. For Assembly language file please save the file with ".asm" extension, if instead writing a code in C save it with a ".c" extension.

FIG5.7: Writing the source code to be compiled in KEIL uVISION 4

After finishing the code, save the file, for that go to the File menu and click on save or Save As. As this is the file creation step both will result in the same.

FIG 5.8: Saving a file in KEIL uVISION 4

Save the file as any name, you want, but don't forget to give the file an extension .asm or .c, depending on what you are writing.

FIG 5.9:Saving a file in KEIL uVISION

Now compile the code by selecting, Build the Target" option from "Project" menu. But before that, we need to go to the Project menu and select Options for Target 'Target 1'

FIG 5.10: Keil uVISION 4 Project Option

STEP 6: A dialog box will open. Select the Output menu & put a tick on Create HEX file option.NOTE: If you havent selected this option you will not be able to create .hex file to burn it into the 8051 development board.

FIG 5.11: Selecting Create HEX File Option

Now click on the "Project" Menu, & select "Build Target".

FIG 5.12: Building Target or Compiling code in KEIL uVISION 4

After a successful build your HEX file will be created & can be found in the project folder, where your source file is. It will be with the extension .hex & with the same name as the Project. Browse it through, & with software like "flash burner", load it to the Micro-controller, to work as desired.

5.2.2 Code for Generating Hex File

5.3 Proteus 8 Professional SoftwareProteus(PROcessor forTextEasy toUse) is a fully functional, procedural programming language created in 1998 by Simone Zanella. Proteus incorporates many functions derived from several other languages:C,BASIC,Assembly,and Clipper/dBase; it is especially versatile in dealing with strings, having hundreds of dedicated functions; this makes it one of the richest languages for text manipulation.Proteus owes its name to a Greek god of the sea (Proteus), who took care of Neptune's crowd and gave responses; he was renowned for being able to transform himself, assuming different shapes. Transforming data from one form to another is the main usage of this language.Proteus was initially created as a multiplatform (DOS,Windows,UNIX) system utility, to manipulate text and binary files and to createCGIscripts. The language was later focused on Windows, by adding hundreds of specialized functions for: network and serial communication, database interrogation, system service creation, console applications, keyboard emulation,ISAPIscripting (forIIS). Most of these additional functions are only available in the Windows flavour of the interpreter, even though aLinuxversion is still available.Proteus was designed to be practical (easy to use, efficient, complete), readable and consistent.Its strongest points are: powerful string manipulation; comprehensibility of Proteus scripts; Availability of advanced data structures:arrays,queues(single or double),stacks,bit maps,sets,AVL trees.The language can be extended by adding user functions written in Proteus orDLLscreated in C/C++.5.3.1 Features of ProteusAt first sight, Proteus may appear similar to Basic because of its straight syntax, but similarities are limited to the surface: Proteus has a fully functional, procedural approach; variables are untyped, do not need to be declared, can be local or public and can be passed by value or by reference; all the typical control structures are available (if-then-else; for-next; while-loop; repeat-until; switch-case); new functions can be defined and used as native functions.Data types supported by Proteus are only three: integer numbers, floating point numbers and strings. Access to advanced data structures (files, arrays, queues, stacks, AVL trees, sets and so on) takes place by usinghandles, i.e. integer numbers returned by item creation functions.Type declaration is unnecessary: variable type is determined by the function applied Proteus converts on the fly every variable when needed and holds previous data renderings, to avoid performance degradation caused by repeated conversions.There is no need to add parenthesis in expressions to determine the evaluation order, because the language is fully functional (there are no operators).Proteus includes hundreds of functions for: accessing file system; sorting data; manipulating dates and strings; interacting with the user (console functions) calculating logical and mathematical expressions.Proteus supports associative arrays (called sets) and AVL trees, which are very useful and powerful to quickly sort and lookup values.Two types ofregular expressionsare supported: extended (Unix like); Basic (Dos like, having just the wildcards "?" and "*").Both types of expressions can be used to parse and compare data.The functional approach and the extensive library of built-in functions allow to write very short but powerful scripts; to keep them comprehensible, medium-length keywords were adopted.The user, besides writing new high-level functions in Proteus, can add new functions in C/C++ by following the guidelines and using the templates available in the software development kit; the new functions can be invoked exactly the same way as the predefined ones, passing expressions by value or variables by reference.Proteus is an interpreted language: programs are loaded into memory, pre-compiled and run; since the number of built-in functions is large, execution speed is usually very good and often comparable to that of compiled programs.One of the most interesting features of Proteus is the possibility of running scripts asservicesorISAPIscripts.Running a Proteus script as a service, started as soon as the operating system has finished loading, gives many advantages: no user needs to login to start the script; a service can be run with different privileges so that it cannot be stopped by a user.This is very useful to protect critical processes in industrial environments (data collection, device monitoring), or to avoid that the operator inadvertently closes a utility (keyboard emulation).The ISAPI version of Proteus can be used to create scripts run through Internet Information Services and is equipped with specific functions to cooperate with the web server.For intellectual property protection Proteus provides: script encryption; digital signature of the scripts, by using the development key (which is unique); The option to enable or disable the execution of a script (or part of it) by using the key of the customer.Proteus is appreciated because it is relatively easy to write short, powerful and comprehensible scripts; the large number of built-in functions, together with the examples in the manual, keeps low the learning curve.The development environment includes asource code editorwith syntax highlighting and a context-sensitive guide. Proteus does not need to be installed: the interpreter is a single executable (below 400 Kb) that does not require additional DLLs to be run on recent Windows systems.5.3.2 Steps involved in Proteus simulationStep1:Create a new project. ClickNew Projectbutton.FIG 5.13: STEPS TO OPEN NEW PROJECT IN PROTEUS 8

Now give aNameto our project

Do not change anything, just follow the default options and click Next until you see Finish button.

Step 2:Draw the circuit diagram and now clickSchematic Capturebutton, you will be directed to schematic panel.FIG 5.14: SCHEMATIC CAPTURE BUTTON

Step 3:Add components to work space and ClickP buttonfollowed byComponent buttonunder Devices for picking components

FIG 5.15: STEPS TO PICK COMPONENTS IN PROTEUSStep 4: Choose your component by simply typing the name at Keyword box. After selecting item click OK.

The selected components will listed under Devices.

After placing the components of our circuit we get the below window. We have placed the PIC16F877A microcontroller, input terminal to the alcohol odour sensor, input probe to colour sensor, a DC Motor, Display for showing the voltage of the motor and a LCD display to show its operation. The control of the speed of the dc motor is represented using the voltage of the motor. Since, the speed of the motor is directly proportional to the voltage given. After placing all the components, the final circuit diagram is shown below.

FIG 5.16: FINAL IMAGE OF THE PROTEUS WINDOW WITH COMPONENTSStep 5:Set clock frequency to PIC MCU in Proteus and Double click on the PIC IC, theEdit component wizardwill open. Set the frequency as same that you did for generating .HEX file. (I compiled my embedded program with10MHz; hence I selected 10MHz here).

FIG 5.17: SETTING CLOCK FREQUENCY TO PIC MCU IN PROTEUSSTEP 6:Load .HEX file to the schematic diagram of PIC and after setting frequency clickbrowsebutton to load the.HEXfile.

FIG 5.18: STEPS TO DUMP THE HEX FILE TO MCUChoose your.HEXfile

Finally clickOK. Now everything is ready to go.Step 7:Lets run simulation and Click theRun Simulationbutton at bottom left corner and observe your PIC simulation.

FIG 5.19: STEPS TO RUN SIMULATIONResult: Here the simulation result is denoted using the speed of the motor. By varying the input value to the alcohol odour sensor we can check the operation of the module for detecting drunken driving and by varying the values of the input to the colour sensor we can check the module for automatic speed regulation by sensing colour strips sensed on road.CHAPTER-6CONCLUSION

This project presents architecture for automatic adaptation of the longitudinal speed control of a vehicle to the circumstances of the road which can help to decrease one of the major causes of fatalities: the excessive or inadequate vehicle speed and also decreases drunken driving which is also an important cause of fatality. Our approach is based on a combination of different sensor technologies: The proposed on-board architecture is portable and easily adaptable to any commercial car with minimal modifications. By this system, our approach is to control the speed of vehicle at limiting road area to avoid the accidents. The accidents and rash driving can be reduced up to 80 % and can save many lives and many valuable properties. In the empirical trials in our installations, the vehicles speed was successfully changed as a result of the detection of the signals, increasing the drivers safety. The technology developed can assist human drivers in difficult road circumstances. By using this system, it can be reduced the rash driving within cities, within the regions of school zones, villages that are located at the highways and beside the highways.

REFERENCES:

[1] W.H. Hucho (1998), Aerodynamics of Road Vehicles, ISBN 0-7680- 0029-7, Warrendale PA, Society of Automotive Engineers, , 142-145

[2] T.D. Gillespia(1992), Fundamentals of Vehicle Dynamics, ISBN 1- 556091-199-9, Warrendale PA, Society of Automotive Engineers

[3] D. Cole (1972), Elementary Vehicle Dynamics, course notes in Mechanical Engineering, The Univ. of Michigan, Michigan [4] The Traffic Institute (1990), Traffic Accident Reconstruction, Northwestern University, 62-140

[5] World Health Organization (1984). Road traffic accidents in developing countries. Technical Report Series No. 73. Geneva, WHO.

[6] Accident Control and Safety Measures in Mass Transit Operations in Nigeria. Ibadan University Press, Ibadan, pp. 257-262. [7] Court R. and King E. (1995).,'An Overview of the Anti-speeding Communications Strategy for 1995/1996',Proceedings of the National Road Safety Research & Enforcement Conference', Traffic Board of Western Australia, Western Australia

[8] Bernstein, D., Kornhauser, A. (1996). An introduction to map matching for personal navigation assistants. Technical report, New Jersey TIDE Center, Princeton University, USA.

[9] Greenfeld, J.S. (2002). Matching GPS observations to locations on a digital map. In Proceedings of the 81th Annual Meeting of the Transportation Research Board,Washington D.C.

[10] Kim, J.S., Lee, J.H., Kang, T.H., Lee, W.Y., and Y.G. Kim (1996). Node based map matching algorithm for can navigation system, Proceeding of the 29th ISATA Symposium, Florence, Vol. 10, pp 121-126.

[11] Scott, C.A., Drane, C.R. (1994). Increased accuracy of motor vehicle position estimation by utilizing map data, vehicle dynamics and other information sources. Proceedings of the Vehicle Navigation and Information Systems Conferences, pp. 585-590. [12] White, C.E., Bernstein, D., and A.L. Kornhauser (2000). Some map matching algorithms for personal navigation assistants. Transportation Research Part C 8, 91-108.