Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INTRODUCTION
Now a days, in our daily life most of the accidents occur due to rash driving
on highways which may lead to the loss of many passengers and drivers have lost their lives
rash driving on highways, Therefore to overcome this problem, the following project
implements a speed checker to detect rash driving on highways.
The main object of this system to develop a highway speed checker device that detects rash
driving on highways and alerts the traffic authorities if the speed checker finds any vehicle
violating the speed limit on high ways.
In olden days for detecting rash driving on highways the police used to target vehicle by
using radar guns as the vehicle and it would record their speed. If a vehicle would exceeds
its speed, automatically information would reach to the nearby police station for controlling
the speed of the vehicle due to this system a lot of time would be wasted. But in our project,
the proposed system checks rash driving by calculating the speed of vehicle by using the
time taken to travel between the two set points placed on the road at a certain distance. A set
point distance consists of a couple of sensors comprising an IR Transmitter and IR Receiver.
Which are placed on the either side of the road. The speed limit is set by the police who use
the system depending on the traffic at each location.
The time taken by the vehicle to travel from one set point to the other is calculated by the
control circuit calculates the speed and displays the result on a 16*2-bit LCD display. If a
vehicle exceeds the limit between transmitter and receiver, then system sends a message to
the traffic authorities for further action.
1
CHAPTER 2
2.1 Introduction:
The aim of this project is to develop a device to detect rash driving on highways and
to alert the traffic authorities in case of any speed violation. Accidents due to rash driving on
highways are on the rise and people are losing their lives because of others mistakes.
LCD DISPLAY
RECTIFI
ER
IR
TRANS
MITTER
RFID
IR MICRO
RECEIV CONTRO
ER LLER
GSM
MODEM
Asm/C
Figure 2.1: Block diagram of speed checker to detect rash driving on highways
2
From the block diagram the components used in this project are Micro controller,
Transformer, Bridge rectifier, RFID (Radio frequency identity), Global System for Mobile
communication (GSM) module, LCD (Liquid Crystal Diode) Display, Infrared Transmitter,
Infrared Receiver and also KEIL micro vision-4 software for programming to micro
controller either C-program or Assembly program.
Figure 2.2: Circuit Diagram Of Speed Checker To Detect Rash Driving On Highways
Fig.2.2 shows that the detailed connections of all components, In this a step-down
3
transformer (230v/5v) output is connected as input of bridge rectifier. Then bridge rectifier
is converts the AC into DC and given it to the input of microcontroller circuit.
Controller circuit consists of IR sensors i.e, transmitter and receiver with a fixed
distance are consider as two set points to sense the vehicle moment from start to end. Then
the microcontroller calculating the speed of vehicle by using the time taken to travel
between the two set points placed on the road at that fixed distance. The speed limit is set by
the police who use the system depending on the traffic at each location. The controller sends
one signal to LCD to display the speed crosses or not and another to RFID and GSM. If the
vehicle crosses the speed limit then controller collect the data from RFID which is already
stored in it, and sends a message with that vehicle data to the traffic inspector mobile no
through GSM module for future action.
4
CHAPTER 3
HARDWARE REQUIREMENT
AT89s52 Microcontroller.
IR Sensors
LCD display
The Intel 8051 is Harvard architecture, single chip microcontroller (C) which was
developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and
early 1990s, but today it has largely been superseded by a vast range of enhanced devices
with 8051-compatible processor cores that are manufactured by more than 20 independent
manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products.
5
8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a
time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU.
8051 is available in different memory types such as UV-EPROM, Flash and NV-RAM.
The present project is implemented on Keil Uvision. In order to program the device,
Pro load tool has been used to burn
the program onto the
microcontroller.
6
Figure 3.1: Pin Diagram Of Microcontroller
Watchdog timer.
Power-off flag.
7
3.2.3 Description:
8
In addition, the AT89s52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode stops
the CPU while allowing the RAM, timer/counters, serial port and interrupt system to
continue functioning. The power-down mode saves the RAM contents but freezes the
oscillator disabling all other chip functions until the next hardware reset.
9
3.2.5 Pin description:
A. Vcc : Pin 40 provides supply voltage to the chip. The voltage source is +5V.
C. 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.
D. 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. Port 1 also receives the
low-order address bytes during Flash programming and verification.
Table 3.1: 8051 Microcontroller Port 1 Specifications
10
E. 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. The
port also receives the high-order address bits and some control signals during Flash
programming and verification.
F. Port 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 inputs. As inputs,
Port 3 pins that are externally being pulled low will source current (IIL) because of
the pull-ups. Port 3 receives some control signals for Flash programming and
verification.
Port 3 also serves the functions of various special features of the AT89S52, as
shown in the following table.
Table 3.2: 8051 Microcontroller Port 3 Specifications
11
G. 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 98 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.
H. ALE/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.
I. 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.
J. EA/VPP:
EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming.
12
K. XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
L. XTAL2:
M. Oscillator Connections:
XTAL1 and
XTAL2 are the input
and output,
respectively, of an inverting amplifier that can be configured for use as an
on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive
the device from an external clock source, XTAL2 should be left unconnected while
13
XTAL1 is driven. There are no requirements on the duty cycle of the external clock
signal, since the input to the internal clocking circuitry is through a divide-by-two
flip-flop, but minimum and maximum voltage high and low time specifications must
be observed.
A map of the on-chip memory area called the Special Function Register
(SFR) space is shown in the following table.
It should be noted 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 and T2MOD for
Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload register for
Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
P. Interrupt 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.
14
Table 3.4: T2CON Timer/Counter 2 Control Register
15
Table 3.5: Auxiliary Register
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 and 85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1
selects DP1. The user should ALWAYS initialize the DPS bit to the appropriate value
before accessing the respective Data Pointer Register.
16
Table 3.6: Auxilary Register I
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.
S. 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.
T. Program Memory:
U. Data 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.
17
3.3 Radio Frequency Identification (RFID):
RFID technology provides many benefits for organisations to use the system. RFID
provide an easy way in which data can be collected and assets tracked:
RFID technology provides a low cost form of data collection and asset management.
RFID technology is widely used and therefore the economies of scale can be utilised
to advantage.
RFID technology enables data collection in environments that are unsuitable for
workers as RFID tags can provide data in harsh environments.
RFID is able to provide many reads and write functions per second, although it is not
a very high data rate system, it is sufficient for most data monitoring applications.
Data on an RFID tag can be altered repeatedly.
RFID technology can be used with existing systems including bar codes and Wi-Fi
As a result, RFID technology is being used increasingly as organizations need
automatic methods of tracking assets and collecting data.
RFID technology can be used with existing systems including bar codes and Wi-Fi.
In this project we are using RFID to know the details of particular vehicle . Initially
the vehicle information is stored in RFID when a vehicle moves from IR transmitter
18
and receiver pair the speed is sensed and the information is send to controller unit
and RFID
When the speed exceeds the rated speed than RFID sends the information to GSM
modem.
Definition:
GSM, which stands for Global System for Mobile communications, reigns
(important) as the worlds most widely used cell phone technology. Cell phones use a cell
phone service carriers GSM network by searching for cell phone towers in the nearby area.
Global system for mobile communication (GSM) is a globally accepted standard for digital
cellular communication.
Need of GSM:
The GSM study group aimed to provide the followings through the GSM:
Improved spectrum efficiency.
International roaming.
Low-cost mobile sets and base stations (BS)
High-quality speech
Compatibility with Integrated Services Digital Network (ISDN) and other telephone
company services.
19
Support for new services.
Years Events
CEPT establishes a GSM group in order to develop the standards for a pan-
1982
European cellular mobile system.
Field tests are performed to test the different radio techniques proposed for the
1986
air interface.
Time Division Multiple Access (TDMA) is chosen as the access method (with
Frequency Division Multiple Access [FDMA]). The initial Memorandum of
1987
Understanding (MoU) is signed by telecommunication operators representing 12
countries.
1995 Phase 2 of the GSM specifications occurs. Coverage is extended to rural areas.
1997 July: 200 network in 109 countries operational, around 44 million subscribers
20
worldwide.
Modulation:
Modulation is a form of change process where we change the input information
into a suitable format for the transmission medium. We also changed the information by
demodulating the signal at the receiving end.
The GSM uses Gaussian Minimum Shift Keying (GMSK) modulation method.
Access Methods:
Because radio spectrum is a limited resource shared by all users, a method must
be devised to divide up the bandwidth among as many users as possible.
GSM chose a combination of TDMA/FDMA as its method. The FDMA part
involves the division by frequency of the total 25 MHz bandwidth into 124 carrier
frequencies of 200 kHz bandwidth.
One or more carrier frequencies are then assigned to each BS. Each of these
carrier frequencies is then divided in time, using a TDMA scheme, into eight time slots. One
time slot is used for transmission by the mobile and one for reception. They are separated in
time so that the mobile unit does not receive and transmit at the same time.
Transmission Rate:
The total symbol rate for GSM at 1 bit per symbol in GMSK produces 270.833 K
symbols/second. The gross transmission rate of the time slot is 22.8 Kbps.
GSM is a digital system with an over-the-air bit rate of 270 kbps.
21
Frequency Band:
The uplink frequency range specified for GSM is 933 - 960 MHz (basic 900
MHz band only). The downlink frequency band 890 - 915 MHz (basic 900 MHz band only).
Channel Spacing:
This indicates separation between adjacent carrier frequencies. In GSM, this is 200
kHz.
Speech Coding:
GSM uses linear predictive coding (LPC). The purpose of LPC is to reduce the
bit rate. The LPC provides parameters for a filter that mimics the vocal tract. The signal
passes through this filter, leaving behind a residual signal. Speech is encoded at 13 kbps.
Duplex Distance:
The duplex distance is 80 MHz. Duplex distance is the distance between the
uplink and downlink frequencies. A channel has two frequencies, 80 MHz apart.
Misc:
Frame duration: 4.615 ms
Duplex Technique: Frequency Division Duplexing (FDD) access mode previously
known as WCDMA.
Speech channels per RF channel: 8.
AT+CMGF=1 <ENTER>
22
If the modem responds with "OK" this mode is supported. Please note that using this mode it
is only possible to send simple text messages. It is not possible to send multipart, Unicode,
data and other types of messages.
AT+CMGF=1<ENTER>
In text mode there are some additional parameters that can be set.
Using the following command we can read the current values:
AT+CSMP?<ENTER>
The modem will response with a string like this:
AT+CMGS="+31638740161" <ENTER>
23
Replace the above phone number with your own cell phone number. The modem will
respond with.
You can now type the message text and send the message using the <CTRL>-<Z> key
combination.
AT+CSCS=?
This commands displays the code pages supported by the modem. The modem will respond
like this.
+CSCS: ("GSM","PCCP437","CUSTOM","HEX")
If this string contains "HEX" or "UCS2", Unicode seems to be supported.
To specify that you will use an HEX string to send the message, set the code page
to"HEX" or "UCS2" depending on the modem response In our example we will set the
modem to "HEX".
AT+CSCS="HEX" <ENTER>
Next, we have to specify the correct DCS (Data Coding Scheme) for Unicode messages,
which is 0x08. We can set this value by changing the fourth parameter of the AT+CSMP
command to '8'.
24
AT+CSMP=1, 167, 0, 8 <ENTER>
The modem is now ready to send messages as Unicode. Now is the time to send the
actual message.
AT+CMGS="+31638740161" <ENTER>
Replace the above phone number with your own cell phone number. The modem will
respond with.
The only thing you have to program by yourself, is a simple routine which converts the
Unicode string to a hexadecimal string like this.
Which is 'Hello' in Arabic will be converted like this:
"06450631062D06280627"
+CMGS: 63
The message will arrive on the mobile phone shortly.
3.5 IR Sensors:
25
Graded Output
High efficiency GaAIAs, 880 nm LPE process delivers twice the power of
Conventional GaAs 940 nm emitters
Infrared (IR) radiation is electromagnetic radiation whose wavelength is longer
than that of visible light (400-700 nm), but shorter than that of terahertz radiation (100 m -
1 mm) and microwaves (~30,000 m). Infrared radiation spans roughly three orders of
magnitude (750 nm and 100 m).
Direct sunlight has a luminous efficacy of about 93 lumens per watt of radiant
flux, which includes infrared (47% share of the spectrum), visible (46%), and ultra-violet
(only 6%) light. Bright sunlight provides luminance of approximately 100,000 candela per
square meter at the Earth's surface.
Overview
Infrared imaging is used extensively for both military and civilian purposes. Military
applications include target acquisition, surveillance, night vision, homing and tracking. Non-
military uses include thermal efficiency analysis, remote temperature sensing, short-ranged
wireless communication, spectroscopy, and weather forecasting.. Infrared astronomy uses
sensor-equipped telescopes to penetrate dusty regions of space, such as molecular clouds;
detect cool objects such as planets, and to view highly red-shifted objects from the early
days of the universe.
At the atomic level, infrared energy elicits vibration modes in a molecule through a change
in the dipole moment, making it a useful frequency range for study of these energy states for
molecules of the proper symmetry. Infrared spectroscopy examines absorption and
transmission of photons in the infrared energy range, based on their frequency and intensity.
27
Figure:3.7 Circuit Diagram Of Emitter And Photo Diode
Photo IR reflectance sensors contain a matched infrared transmitter and infrared receiver
pair. These devices work by measuring the amount of light that is reflected into the receiver.
Because the receiver also responds to ambient light, the device works best when well
shielded from ambient light, and when the distance between the sensor and the reflective
surface is small(less than 5mm). IR reflectance sensors are often used to detect white and
28
black surfaces. White surfaces generally reflect well, while black surfaces reflect poorly.
Fig.3.10 Schematic Diagram for a Single Pair of Infrared Transmitter and Receiver
29
Fig.3.11. Internal Diagram For A Single Pair Of Infrared Transmitter And Receiver
Theory of Sensor Circuit
30
= a/ (a+R1)-b/ (b+R1)
Description of operation of a typical circuit
If the emitter and detector (aka phototransistor) are not blocked, then the output on pin 2 of
31
the 74LS14 will be high (apx. 5 Volts). When they are blocked, then the output will be low
(apx. 0 Volts). The 74LS14 is a Schmitt triggered hex inverter.
A Schmitt trigger is a signal conditioner. It ensures that above a threshold value, we will
always get "clean" HIGH and LOW signals. Not Blocked Case: Pin 2 High Current from
Vcc flows through the detector. The current continues to flow through the base of Q2.
Current from Vcc also flows through R2, and Q2's Drain and Emitter to ground. As a result
of this current path, there will be no current flowing through Q1's base. The signal at U1's
pin 1 will be low, and so pin 2 will be high. Blocked Case: Pin 2 Low Current "stops" at the
detector. Q2's base is not turned on. The current is re-routed passing through R2 and into the
base of Q1. This allows current to flow from Q1's detector and exiting out Q1's emitter. Pin
1 is thus high and pin 2 will be low. To detect a line to be followed, we are using two or
more number of poto-reflectors. Its output current that proportional to reflection rate of the
floor is converted to voltage with a resister and tested it if the line is detected or not.
However the threshold voltage cannot be fixed to any level because optical current by
ambient light is added to the output current. Most photo-detecting modules are using
moderated light to avoid interference by the ambient light. The detected signal is filtered
with a band pass filter and disused signals are filtered out.
Therefore only the moderated signal from the light emitter can be detected.
Of course the detector must not be saturated by ambient light, this is effective when the
detector is working in linear region.
32
33
The line position is compared to the center value to be tracked; the position error is
processed with Proportional/Integral/Defense filters to generate steering command. The line
following robot tracks the line in PID control that the most popular algorithm for servo
control. The proportional term is the common process in the servo system. It is only a gain
amplifier without time dependent process. The differential term is applied in order to
improve the response to disturbance, and it also compensate phase lag at the controlled
object. The D term will be required in most case to stabilize tracking motion. The I term that
boosts DC gain is applied in order to remove left offset error, however, it often decrease
servo stability due to its phase lag. When any line sensing error has occurred for a time due
to getting out of line or end of line, the motors are stopped and the microcontroller enters
sleep state of zero power consumption. Typical Examples of infrared Transmitter and
Receiver installation.
3.5.2 IR Receiver
34
Features
35
It is an electronically-modulated optical device shaped into a thin, flat panel made up
of any number of color or monochrome pixels filled with liquid crystals and arrayed in front
of a light source (backlight) or reflector. It is often used in battery-powered electronic
devices because it requires very small amounts of electric power.
3.6.1 Features:
* Some more modules with same mechanic and same pin out
-Graphic 122X32
36
Liquid crystal display is very important device in embedded system. It offers high
flexibility to user as he can display the required data on it. But due to lack of proper
approach to LCD interfacing many of them fail. Many people consider LCD interfacing a
complex job but according to me LCD interfacing is very easy task, you just need to have a
logical approach. This page is to help the enthusiast who wants to interface LCD with
through understanding. Copy and Paste technique may not work when an embedded system
engineer wants to apply LCD interfacing in real world projects.
You will be knowing about the booster rockets on space shuttle. Without these
booster rockets the space shuttle would not launch in geosynchronous orbit. Similarly to
understand LCD interfacing you need to have booster rockets attached! To get it done right
you must have general idea how to approach any given LCD.This page will help you
develop logical approach towards LCD interfacing.
First thing to begin with is to know what LCD driver/controller is used in LCD.Yes,
your LCD is dumb it does not know to talk with your microcontroller. LCD driver is a link
between the microcontroller and LCD. You can refer the datasheet of LCD to know the LCD
driver for e.g. JHD 162A is name of LCD having driver HD44780U.You have to interface
the LCD according to the driver specification. To understand the algorithm of LCD
interfacing user must have datasheet of both LCD and LCD driver. Many people ignore the
datasheets and end up in troubles. If you want to interface LCD successfully you must have
datasheets.
37
Figure: 3.14. Circuit Connections Of LCD Display
Why people ignore datasheets? Most of us do not like to read 100 pages of datasheet.
But for accurate technical specification datasheets are must. I will show you a technique to
manipulate a datasheet within minutes.
First thing to find out in datasheet is the features viz. operating voltage, type of
interface, maximum speed for interface in MHz, size of display data RAM, number of
pixels, bits per pixel, number of row and columns. You must have the pin diagram of
LCD.Pin diagram of LCD driver can be omitted.
From datasheet of LCD driver find out whether hardware reset is required at startup,
what is the time of reset pulse, is it active low and which pins of LCD are to be toggled.
Major task in LCD interfacing is the initialization sequence. In LCD initialization you have
to send command bytes to LCD. Here you set the interface mode, display mode, address
counter increment direction, set contrast of LCD, horizontal or vertical addressing mode,
38
color format. This sequence is given in respective LCD driver datasheet. Studying the
function set of LCD lets you know the definition of command bytes. It varies from one LCD
to another. If you are able to initialize the LCD properly 90% of your job is done.
Next step after initialization is to send data bytes to required display data RAM
memory location. Firstly set the address location using address set command byte than send
data bytes using the DDRAM write command. To address specific location in display data
RAM one must have the knowledge of how the address counter is incremented.
The input to the circuit is applied from the regulated power supply. The a.c. input
i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a
rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a
pure dc voltage, the output voltage from the rectifier is fed to a filter to remove any a.c
components present even after rectification. Now, this voltage is given to a voltage regulator
to obtain a pure constant dc voltage.
230V D.C
AC Output
supply
50Hz
Transformer:
39
Usually, DC voltages are required to operate various electronic equipment and these
voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c
input available at the mains supply i.e., 230V is to be brought down to the required voltage
level. This is done by a transformer. Thus, a step down transformer is employed to decrease
the voltage to a required level.
Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating
D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge
rectifier is used because of its merits like good stability and full wave rectification.
Filter:
Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the mains
voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage
received at this point changes. Therefore a regulator is applied at the output stage.
Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage regulator is
an electrical regulator designed to automatically maintain a constant voltage level. In this
project, power supply of 5V and 12V are required. In order to obtain these voltage levels,
7805 and 7812 voltage regulators are to be used. The first number 78 represents positive
supply and the numbers 05, 12 represent the required output voltage levels.A variable
regulated power supply, also called a variable bench power supply, is one where you can
continuously adjust the output voltage to your requirements. Varying the output of the power
supply is the recommended way to test a project after having double checked parts
placement against circuit drawings and the parts placement guide.
This type of regulation is ideal for having a simple variable bench power supply.
Actually this is quite important because one of the first projects a hobbyist should undertake
is the construction of a variable regulated power supply. While a dedicated supply is quite
handy e.g. 5V or 12V, it's much handier to have a variable supply on hand, especially for
testing.
40
Most digital logic circuits and processors need a 5-volt power supply. To use these
parts we need to build a regulated 5-volt source. Usually you start with an unregulated
power supply ranging from 9 volts to 24 volts DC (A 12 volt power supply is included with
the Beginner Kit and the Microcontroller Beginner Kit.). To make a 5 volt power supply,
we use a LM7805 voltage regulator IC (Integrated Circuit). The IC is shown below.
CIRCUIT FEATURES:
Brief description of operation: Gives out well regulated +5V output, output current
capability of 100 mA
Circuit protection: Built-in overheating protection shuts down output when regulator IC
gets too hot
Availability of components: Easy to get, uses only very common basic components
41
Design testing: Based on datasheet example circuit, I have used this circuit successfully as
part of many electronics projects
Component costs: Few dollars for the electronics components + the input transformer cost.
BLOCK DIAGRAM:
42
This 5V dc acts as Vcc to the microcontroller. The excess voltage is dissipated as
heat via an Aluminum heat sink attached to the voltage regulator.
Bridge Rectifier:
For both positive and negative swings of the transformer, there is a Forward path
through the diode bridge. Both conduction paths cause Current to flow in the same direction
through the load resistor, accomplishing full-wave rectification. While one set of diodes is
forward biased, the other set is reverse biased and effectively eliminated from the circuit.
43
Figure: 3.18 Current In Bridge Rectifier For +Ve Half Cycle
44
CHAPTER 4
SOFTWARE REQUIREMENTS
Keil is also a cross compiler The process of development of the soft code on a
processor for a particular application and which can be implemented on the target processor
is known as Cross Development.
In our design the main heart of the hardware module is the micro controller which is
the programmable IC .The programming language used for developing the software to the
micro controller is Embedded C /Assembly. The KEIL cross compiler is used to edit,
compile and debug this program Micro Flash programmer is used for burning the developed
code on Keil in to the micro controller Chip.
When you use the Keil Software tools, the project development cycle is roughly the
same as it is for any other software development project.
45
1. Create a project, select the target chip from the device database, and configure the tool
settings.
Vision2 IDE:
Source files are created by the Vision2 IDE and are passed to the C51 Compiler or
A51 assembler. The compiler and assembler process source files and create relocatable
object files.
Vision2 Debugger
The Vision2 symbolic, source-level debugger is ideally suited for fast, reliable
program debugging. The debugger includes a high-speed simulator that let you simulate an
entire 8051 system including on-chip peripherals and external hardware. The attributes of
the chip you use are automatically configured when you select the device from the Device
Database.
The Vision2 Debugger provides several ways for you to test your programs on real target
hardware.
46
_ Install the MON51 Target Monitor on your target system and download your program
using the Monitor-51 interface built-in to the Vision2 Debugger.
_ Use the Advanced GDI interface to attach use the Vision2 Debugger front end with your
target system.
_ Integrated make facility for assembling, compiling, and linking your embedded
applications,
_ True integrated source-level Debugger with high-speed CPU and peripheral simulator,
_ Advanced GDI interface for software debugging in the target hardware and for connection
to Monitor-51,
The Keil C51 Cross Compiler is an ANSI C Compiler that was written specifically to
generate fast,
The C51 Compiler generates object code that matches the efficiency and speed of assembly
programming.
47
Using a high-level language like C has many advantages over assembly language
programming:
_ Knowledge of the processor instruction set is not required. Rudimentary knowledge of the
memory structure of the 8051 CPU is desirable (but not necessary).
_ Details like register allocation and addressing of the various memory types and data types
is managed by the compiler.
_ Programs get a formal structure (which is imposed by the C programming language) and
can be divided into separate functions. This contributes to source code reusability as well as
better overall application structure.
_ The ability to combine variable selection with specific operations improves program
readability.
_ Keywords and operational functions that more nearly resemble the human thought process
may be used.
_ The C run-time library contains many standard routines such as: formatted output, numeric
conversions, and floating-point arithmetic.
_ Existing program parts can be more easily included into new programs because of modular
program construction techniques.
_ The language C is a very portable language (based on the ANSI standard) that enjoys wide
popular support and is easily obtained for most systems. Existing program investments can
be quickly adapted to other processors as needed.
Even though the C51 Compiler is ANSI-compliant, some extensions were added to
support the facilities of the 8051 microprocessor. The C51 Compiler includes extensions for:
_ Data Types,
_ Memory Types,
_ Memory Models,
48
_ Pointers,
_ Reentrant Functions,
_ Interrupt Functions,
Code Optimizations
The C51 Compiler is an aggressive optimizing compiler that takes numerous steps to
ensure that the code generated and output to the object file is the most efficient (smallest
and/or fastest) code possible. The compiler analyzes the generated code to produce the most
efficient instruction sequences. This ensures that your C program runs as quickly and
effectively as possible in the least amount of code space.
The C51 Compiler provides nine different levels of optimizing. Each increasing level
includes the optimizations of levels below it. The following is a list of all optimizations
currently performed by the C51 Compiler.
General Optimizations
_ Jump Optimizing: Jumps are inverted or extended to the final target address when the
program efficiency is thereby increased.
_ Dead Code Elimination: Code that cannot be reached (dead code) is removed from the
program.
_ Register Variables: Automatic variables and function arguments are located in registers
whenever possible. No data memory space is reserved for these variables.
49
_ Global Common Sub expression Elimination: Identical sub expressions or address
calculations that occur multiple times in a function are recognized and calculated only once
whenever possible.
_ Common Tail Merging: Common instruction blocks are merged together using jump
instructions.
_ Re-use Common Entry Code: Common instruction sequences are moved in front of a
function to reduce code size.
_ Common Block Subroutines: Multiple instruction sequences are packed into subroutines.
Instructions are rearranged to maximize the block size.
8051-Specific Optimizations
_ Access Optimizing: Constants and variables are computed and included directly in
operations.
_ Extended Access Optimizing: The DPTR register is used as a register variable for
memory specific pointers to improve code density.
_ Data Overlaying: Function data and bit segments are OVERLAYABLE and are overlaid
with other data and bit segments by the BL51 linker.
_ Case/Switch Optimizing: Depending upon their number, sequence, and location, switch
and case statements may be optimized using a jump table or string of jumps.
_ NOAREGS: Absolute register access is not used. Program code is independent of the
register bank.
50
_ NOREGPARMS: Parameter passing is performed in local data segments rather than
dedicated registers. This is compatible with earlier versions of the C51 Compiler, the PL/M-
51 compiler, and the ASM-51 assembler.
Debugging:
The C51 Compiler uses the Intel Object Format (OMF51) for object files and
generates complete symbol information. Additionally, the compiler can include all the
necessary information such as; variable names, function names, line numbers, and so on to
allow detailed and thorough debugging and analysis with the Vision2 Debugger or any
Intel-compatible emulators.
You should check with your emulator vendor to determine if it is compatible with the
Intel OMF51 object module format and if it can accept Keil object modules.
The A51 Assembler is a macro assembler for the 8051 microcontroller family. It
translates symbolic assembler language mnemonics into executable machine code. The A51
Assembler allows you to define each instruction in an 8051 program and is used where
utmost speed, small code size, and exact hardware control is essential. The assemblers
macro facility saves development and maintenance time since common sequences need only
be developed once.
Source-Level Debugging
The A51 Assembler generates complete line number, symbol, and type information
in the object file created. This allows exact display of program variables in your debugger.
Line numbers are used for source-level debugging of your assembler programs with the
Vision2 Debugger or third-party emulator.
Functional Overview
51
The A51 Assembler translates an assembler source file into a relocatable object
module. It generates a listing file optionally with symbol table and cross reference. The A51
Assembler supports two different macro processors:
The Standard Macro Processor is the easier macro processor to use. It allows you
to define and use macros in your 8051 assembly programs. The standard macro syntax is
compatible with that used in many other assemblers.
The Macro Processing Language (MPL) is a string replacement facility that is fully
compatible with the Intel ASM51 macro processor. MPL has several predefined macro
processor functions that perform many useful operations like string manipulation or number
processing. Another powerful feature of the A51 Assembler macro processors is conditional
assembly depending on command line directives or assembler symbols. Conditional
assembly of sections of code can help you achieve the most compact code possible. It also
allows you to generate different applications from one assembly source file.
ASSEMBLY VS C:
With C the programmer need not know the architecture of the processor.
Conventional C programs needs complier to compile the program & run it.
52
The embedded C program needs a cross compiler to compile & generate HEX
code.
The C program is used for developing an application and not suitable for embedded
systems.
The embedded C is an extension of the conventional C. i.e Embedded C has all the
features of normal C, but has some extra added features which are not available in C.
C is not memory specific. i.e variables cannot be put in the desired memory
Compatibility
Optimization consideration
Development environment
53
Code Optimization.
If the number of local variables in a function is less, the compiler will be able to fit
them into registers. Hence, it will be avoiding frame pointer operations on local variables
that are kept on stack. This can result in considerable improvement due to two reasons.
All local variables are in registers so this improves performance over accessing them
from memory.
If no local variables need to be saved on the stack, the compiler will not incur the overhead
of setting up and restoring the frame pointer.
Do not declare all the local variables in the outermost function scope.
If the parameter was declared in the outermost scope, all function calls would have
incurred the overhead of object .
If the case labels are in a narrow range, the compiler does not generate a if-else-if cascade
for the switch statement.
Instead, it generates a jump table of case labels along with manipulating the value of the
switch to index the table.
This code generated is faster than if-else-if cascade code that is generated in cases where
the case labels are far apart.
Also, performance of a jump table based switch statement is independent of the number of
case entries in switch statement.
54
Reduce the number of parameters
Function calls with large number of parameters may be expensive due to large
number of parameter pushes on stack on each call. For the same reason, avoid passing
complete structures as parameters. Use pointers and references in such cases.
#include<reg52.h>
#define lcd_data P2
sbit lcd_rs=P2^0;
sbit lcd_en=P2^1;
55
delay(3);
}
void stringlcd(unsigned char ch,const unsigned char *chrt)
{
unsigned int ix=0;
if(ch==0x80) clcd(0x01);
clcd(ch);
for(ix=0;chrt[ix]!='\0';ix++)
{
if(ix == 16){clcd(0xc0);}
dlcd(chrt[ix]);
}
}
void initlcd()
{
clcd(0x02);
clcd(0x02);
clcd(0x28);
clcd(0x28);
clcd(0x0e);
clcd(0x06);
clcd(0x01);
clcd(0x80);
temp=temp2/1000;
dlcd(temp+0x30);
temp2=temp2%1000;
temp=temp2/100;
dlcd(temp+0x30);
temp2=temp2%100;
temp=temp2/10;
dlcd(temp+0x30);
temp2=temp2%10;
dlcd(temp2+0x30);
} */
void conv(unsigned int ch)
{
unsigned int temp=0,temp2=0;
temp2=ch;
56
temp=temp2/10000;
dlcd(temp+0x30);
temp2=temp2%10000;
temp=temp2/1000;
dlcd(temp+0x30);
temp2=temp2%1000;
temp=temp2/100;
dlcd(temp+0x30);
temp2=temp2%100;
temp=temp2/10;
dlcd(temp+0x30);
temp2=temp2%10;
dlcd(temp2+0x30);
}
#include"serial.h"
#include"gsm.h"
#include<string.h>
sbit s1 = P1^0;
sbit s2 = P1^1;
sbit s3 = P1^2;
sbit s4 = P1^3;
void main()
{
int speed=0;
initlcd();
stringlcd(0x80,"WELCOME");
serialinit();
gsminit();
delay(400);
57
while(1)
{
start:
stringlcd(0x80,"swipe card");
for(r=0;r<12;r++)
{
rfid_t[r] = rx();
}
rfid_t[12] = 0;
if(strcmp(rfid_t,rfid1) == 0){card = 1;}
if(strcmp(rfid_t,rfid2) == 0){card = 2;}
if(strcmp(rfid_t,rfid3) == 0){card = 3;}
if(strcmp(rfid_t,rfid4) == 0){card = 4;}
if(card == 1)
{
stringlcd(0x80,"CAR 1");
}
if(card == 2)
{
stringlcd(0x80,"CAR 2");
}
if(card == 3)
{
stringlcd(0x80,"CAR 3");
}
if(card == 4)
{
stringlcd(0x80,"CAR 4");
}
while(1)
{
if(s1 == 1)
{
while(s1 == 1);
while(s2 == 0)
{
speed++;
delay(10);
if(speed > 2500){card=0;goto start;}
}
speed = speed/5;
speed = 500 - speed;
stringlcd(0x80,"Speed:");conv(speed); delay(600);
if(speed > 300)
{
stringlcd(0x80,"Over Speed");
58
if(card == 1)
{
stringlcd(0xc0,"CAR 1");
sendmsg(mob1,"Over Speed
Car1");delay(600);
card=0;
}
if(card == 2)
{
stringlcd(0xc0,"CAR 2");
sendmsg(mob1,"Over Speed
Car2");delay(600);
card=0;
}
if(card == 3)
{
stringlcd(0xc0,"CAR 3");
sendmsg(mob1,"Over Speed
Car3");delay(600);
card=0;
}
if(card == 4)
{
stringlcd(0xc0,"CAR 4");
sendmsg(mob1,"Over Speed
Car4");delay(600);
card=0;
}
}
speed = 0;
break;
}
}
}
}
59
CHAPTER 5
OUTPUT OF THE PROJECT
60
Figure 5.2: Image Showing The Below Rated Speed Details
61
Figure 5.3: Image Showing The Over speed Vehicle DetailsCHAPTER 6
CONCLUSION
Since number of accidents on highways increases day by day so it is necessary to check
speed of the vehicles on highways so as to remove accident cases and to provide a safe
journey by controlling high speed of the vehicle. It also minimizes the difficulties of traffic
police department and make ease to control the rash driving on highways. The police can
perform their duties while sitting in control room and can provide their service with more
ease and accuracy. In this project we mainly concentrated on vehicle details which can be
possible by using RFID cards with very low cost and the information is send to traffic
authorities through GSM modem. This concept can be extended in future by integrating a
camera with the system which could capture the image of the number plate of the vehicle to
sends that to the traffic authorities.
CHAPTER 7
62
FUTURE SCOPE
o In previous works the over speeding vehicles are detected by using radar guns and
the extension to this radar guns is buzzer.
o In this project we used RFID cards to know the details of particular over speed
vehicle and also GSM to send the over speed vehicle details to the traffic authorities.
o The future scope to this project is installing a camera such that the image of the over
speed vehicle is recognized.
63
REFERENCES
1. Channabasavaiah M S, Shrinivas Mayya D, 2014.Automated Control System for
Emission Level and Rash Driving Detection in Vehicles. International Journal of
Electrical and Electronics Research Vol. 2, Issue 2, pp: (96-99).
2. Chris Thompson, Jules White,2013. Using Smartphones and Wireless Mobile
Sensor Networks to Detect Car Accidents and Provide Situational Awareness to
Emergency Responders.
3. Monika Jain, Praveen Kumar, 2015, Detection of Over Speeding Vehicles on
Highways. International Journal of Computer Science and Mobile Computing,
Vol.4 Issue.4, pg. (613-619).
4. Mr.Girish.Patwari,Mr.Chinmaya.Masali,2015. Relative Wireless Rash Driving
Detection System. International Journal of Emerging Technology in Computer
Science & Electronics (IJETCSE),Volume 14 Issue 2.
5. Peddi Anudeep, K. Hari Babu, 2014. Wireless Reporting System for Accident
Detection at Higher Speeds. Peddi Anudeep Int. Journal of Engineering
Research and Applications Vol. 4, Issue 9( Version 2), pp.17-20.
6. R. Manoj Kumar, Dr.R.Senthil, 2013. Effective Control Of Accidents Using
Routing And Tracking System With Integrated Network Of Sensors,
International Journal of Advancements in Research & Technology, Volume 2,
Issue4.
64