0% found this document useful (0 votes)
56 views

Vehicle Speed Monitor Report

This document describes a vehicle speed monitoring system using an 8051 microcontroller. The system uses two infrared sensors placed on opposite sides of the road to detect when a vehicle passes. It calculates the vehicle's speed by dividing the distance between the sensors by the time taken for the vehicle to pass between them. The microcontroller continuously monitors the infrared receivers and displays the calculated speed on a 16x2 LCD display. It also determines the direction of travel. The system is intended to accurately and instantly measure vehicle speeds without requiring human intervention.

Uploaded by

Zoheb mamoo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Vehicle Speed Monitor Report

This document describes a vehicle speed monitoring system using an 8051 microcontroller. The system uses two infrared sensors placed on opposite sides of the road to detect when a vehicle passes. It calculates the vehicle's speed by dividing the distance between the sensors by the time taken for the vehicle to pass between them. The microcontroller continuously monitors the infrared receivers and displays the calculated speed on a 16x2 LCD display. It also determines the direction of travel. The system is intended to accurately and instantly measure vehicle speeds without requiring human intervention.

Uploaded by

Zoheb mamoo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

1

VEHICLE SPEED MONITORING USING 8051

By

ARJUN RK 18BEC1120

J KIRON 18BEC1150

B VISWESHWARAN 18BEC1152

A project report submitted to


Dr. M JAGANNATH
SCHOOL OF ELECTRONICS ENGINEERING
in partial fulfilment of the requirements for the course of
ECE 3003 - MICROCONTROLLER AND ITS APPLICATIONS
in
B.Tech. ELECTRONICS AND COMMUNICATION
ENGINEERING

VELLORE INSTITUTE OF TECHNOLOGY, CHENNAI


Vandalur – Kelambakkam Road
Chennai – 600127
MARCH 2019
2

BONAFIDE CERTIFICATE

Certified that this project report entitled “Vehicle speed monitoring using
8051” is a bonafide work of ARJUN RK (18BEC1120), J KIRON
(18BEC1150) and B VISWESHWARAN (18BEC1152) who carried out the
Project work under my supervision and guidance for ECE3003:
Microcontrollers and its applications

Dr. M JAGANNATH

Associate Professor

School of Electronics Engineering (SENSE),

Vellore Institute of Technology, Chennai– 600 127.


3

ABSTRACT

 The speed monitor system comprises of two IR sensors


(transmitter and receiver pair) which will be built on the
opposite sides of the road. The system will display the speed
taken by the vehicle to cross from one end of the road where a
sensor is placed to another. The speed of the vehicle will be
calculated by dividing the distance between the IR sensors by
the time taken.

 When a car is moving on the road, the first IR sensor gets


triggered and after the vehicle crosses a specific distance the
second IR gets triggered. Using the time interval and the
specified distance, the speed can be calculated. It receives the
signals from the sensors, and this signal is operated under the
control of software which is stored in ROM. Microcontroller
AT89C51 continuously monitors the Infrared Receivers and
prints the speed on the 16 x 2 LCD. Depending on which sensor
gets triggered and the direction is determined too.
4

ACKNOWLEDGEMENT

We wish to express our sincere thanks and deep sense of gratitude to our project
guide, Dr. M Jagannath, Associate Professor, School of Electronics
Engineering, for her consistent encouragement and valuable guidance offered to
us in a pleasant manner throughout the course of the project work.

We are extremely grateful to, Dr. Sivasubramanian. A Dean of the School of


Electronics Engineering, Vellore Institute of Technology, Chennai, for
extending the facilities of the School towards our project and for her unstinting
support.

We express our thanks to our Head of the Department Dr. Vetrivelan. P for his
support throughout the course of this project. We also take this opportunity to
thank all the faculty of the School for their support and their wisdom imparted
to us throughout the course.

We thank our parents, family, and friends for bearing with us throughout the
course of our project and for the opportunity they provided us in undergoing
this course in such a prestigious institution.

ARJUN RK J KIRON
B VISWESHWARAN
5

TABLE OF CONTENTS

SERIAL NAME PAGE


NO. NO.
ABSTRACT 3
ACKNOWLEDGEMENT 4

1 INTRODUCTION 6

1.1 OBJECTIVES AND GOALS 6


1.2 BENEFITS 6
1.3 FEATURES 6

2 DESIGN 7-11
2.1 BLOCK DIAGRAM 7
2.2 CIRCUIT DIAGRAM 8
2.3 HARDWARE ANALYSIS 8-11

3 SOFTWARE IMPLEMENTATION 12-17

4 CONCLUSION AND FUTURE WORK 18


4.1 RESULT, CONCLUSION 18
AND INTERFERANCE
4.2 FUTURE WORK 18

REFERENCES 19
6

CHAPTER 1

INTRODUCTION

1.1 OBJECTIVES AND GOALS

Our goal is to design an 8051 driven circuit:

That measures and displays the speed of a vehicle accurately and instantly.

To display the direction in which the vehicle is moving.

1.2 BENEFITS

 Requires less power to operate and we get the speed instantly.


 Eliminates the requirement of a person to use a handheld speed device
 It can be used by traffic police as a speed monitor.

1.3 FEATURES

 16 X 2 LCD Display for user to see the final output


 IR sensors module to transmit and receive infrared rays
 Microcontroller used is AT89C51
 The efficient coding in the software tool called as uKeil Vision, and
Proteus for simulation purposes.
7

CHAPTER 2

DESIGN

2.1 BLOCK DIAGRAM

The three main features of the basic block diagram (given below) are

- IR Sensor
- LCD
- 8051Microcontroller

Each of the above units may consist of the sensory units, communication
modules, etc.

Figure 1: [ CITATION Blo \l 1033 ]


In Figure 1, the IR sensor is connected to a Micro-controller 8051. The Micro-controller is
powered by a 5V power supply. The IC is further connected to a voltage regulator. The
voltage regulator regulates the voltage from the Transformer (Can be replaced by a 9 Volt
Battery) into the sufficient voltage to be applied to the LCD.
8

2.2 CIRCUIT DIAGRAM

The circuit diagram of the system has been depicted in Figure 2. It was designed
using Proteus[1].

Figure 2: [ CITATION Cir \l 1033 ]

2.3 HARDWARE SPECIFICATIONS

2.3.1 IR SENSOR
An infrared (IR) sensor is an electronic device that measures and detects infrared radiation in
its surrounding environment. There are two types of IR sensors namely active and passive.
The sensor we use is an Active sensor. Active infrared sensors both emit and detect infrared
radiation. Active IR sensors have two parts: a light emitting diode (LED) and a receiver.
When an object comes close to the sensor, the infrared light from the LED reflects off of the
object and is detected by the receiver. Active IR sensors act as proximity sensors, and they
are commonly used in obstacle detection systems. The module detects a distance of 2 ~
10cm, detection angle 35 °. The pin configuration of the IR Sensor is depicted in Table 1.
9

Pin Configuration

Pin Name Description


Table 1 : Pin configuration of IR Sensor
VCC Power Supply Input

GND Power Supply Ground 2.3.2 IC 7805 | Voltage Regulator

OUT Active High Output Voltage regulators are very common in


electronic circuits. They provide a constant
output voltage for a varied input voltage. In
our case the 7805 IC is an iconic regulator IC that finds its application in most of the projects.
Our 7805 IC will provide a +5V output voltage.

The output current of this IC can go up to 1.5A. But the IC suffers from heavy heat loss
hence a Heat sink is recommended for projects that consume more current. For example, if
the input voltage is 12V and you are consuming 1A, then (12-5) * 1 = 7W. This 7 Watts will
be dissipated as heat.

7805 IC Features
Minimum Input Voltage is 7V
Maximum Input Voltage is 25V
Operating current (IQ) is 5mA
Internal Thermal Overload and Short circuit current limiting protection is available.

The pin configuration of IC7805 is shown in Table 2.


Pin Configuration

Pin Number Pin Name Description

1 Input (V+) Unregulated Input Voltage

2 Ground (Gnd) Connected to Ground

3 Output (Vo) Outputs Regulated +5V

Table 2 : Pin Configuration of IC 7805

2.3.3 LCD:
An LCD is an electronic display module which uses liquid crystal to produce a visible
image. The 16×2 LCD display is a very basic module commonly used in DIYs and
10

circuits. The 16×2 translates displays 16 characters per line in 2 such lines. In this
LCD each character is displayed in a 5×8 pixel matrix. The pin configuration of LCD
is mentioned in Table 3.

Features of 16×2 LCD module


 Operating Voltage is 4.7V to 5.3V
 Current consumption is 1mA without backlight
 Alphanumeric LCD display module, meaning can display alphabets and numbers
 Consists of two rows and each row can print 16 characters.
 Each character is built by a 5×8-pixel box
 Can work on both 8-bit and 4-bit mode
 It can also display any custom generated characters
 Available in Green and Blue Backlight

Pin Configuration

Pin
 Name
No.  Function

1 Ground (0V) Ground

2 Supply voltage; 5V (4.7V – 5.3V)  Vcc

Contrast adjustment; the best way is to use a variable resistor such as a

3 potentiometer. The output of the potentiometer is connected to this pin. Rotate the  Vo / VEE
potentiometer knob forward and backwards to adjust the LCD contrast.

RS (Register
4 Selects command register when low, and data register when high
Select )
5 Low to write to the register; High to read from the register Read/write
Sends data to data pins when a high to low pulse is given; Extra voltage push is
required to execute the instruction and EN(enable) signal is used for this purpose.
6 Enable
Usually, we make it en=0 and when we want to execute the instruction we make it
high en=1 for some milliseconds. After this we again make it ground that is, en=0.
7 8-bit data pins DB0
11

8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
Table 3: Pin configuration of LCD

2.3.4 8051 Microcontroller:

Figure 3: [ CITATION Pin \l 1033


]

Figure 3 shows the pin diagram of the 8051


microcontroller that plays a major role in
the system. The pin details are also
mentioned below.
Pins 1 to 8 − Port 1. It is internally pulled up,
bi-directional I/O port.
Pin 9 − RESET pin, which is used to reset
the microcontroller to its initial values.
Pins 10 to 17 − Port 3. This port serves some functions like interrupts, timer input,
control signals, serial communication signals etc.
Pins 18 & 19 − Used for interfacing an external crystal to get the system clock.
Pin 20 − This pin provides the power supply to the circuit.
Pins 21 to 28 − Port 2. It serves as I/O port.
Pin 29 − PSEN pin which stands for Program Store Enable. It is used to read a signal
from the external program memory.
Pin 30 − This is EA pin which stands for External Access input. It is used to
enable/disable the external memory interfacing.
12

Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used to
demultiplex the address-data signal of port.
Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower order
address and data bus signals are multiplexed using this port.
Pin 40 − This pin is used to provide power supply to the circuit [2].

CHAPTER 3
SOFTWARE IMPLEMENTATION

The software used is code compose studio. The concept of Timers and various
other features have been applied in the coding process [3].
Keil software was used to compile and run the code [4].

Program code

ASM CODE:

ORG 0000H

MOV DPTR, #MY_COM1


C1:
CLR A
MOVC A, @A+DPTR
JZ SEND_DATA_1
ACALL COMNWRT
13

ACALL DELAY
INC DPTR
SJMP C1

SEND_DATA_1:
MOV DPTR, #MSG_ON_RST_1
D1:
CLR A
MOVC A, @A+DPTR
JZ SEND_DATA_2
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D1

SEND_DATA_2:
MOV A, #0C0H
ACALL COMNWRT
ACALL DELAY
MOV DPTR, #MSG_ON_RST_2
D2:
CLR A
MOVC A, @A+DPTR
JZ SEND_DATA_3
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D2

SEND_DATA_3:
ACALL DELAY_1S

MOV A, #01H
ACALL COMNWRT
ACALL DELAY
MOV DPTR, #MSG_ON_RST_3
D3:
CLR A
MOVC A, @A+DPTR
JZ SEND_DATA_4
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D3

SEND_DATA_4:
MOV A, #0C0H
ACALL COMNWRT
ACALL DELAY
MOV DPTR, #MSG_ON_RST_4
D4:
CLR A
MOVC A, @A+DPTR
JZ DELAY_4S
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D4

DELAY_4S:
MOV R7, #45
HERE3:
ACALL DELAY
DJNZ R7, HERE3
14

MAIN:
ACALL DELAY_1S
ACALL CLR_SCREEN
MOV A, #0FH
ACALL COMNWRT
ACALL DELAY

CONTINUE:
MOV R0, #00H
MOV P2, #0FFH
MOV TMOD, #01H
MOV TL0, #00H
MOV TH0, #00H

READ:
JNB P2.4, SPEED_PLUS
JNB P2.5, SPEED_MINUS
SJMP READ

SPEED_PLUS:
SETB TR0
RS_2:
JB TF0, PLUS_P
REPEAT_P:
JB P2.5, RS_2
CLR TR0

SEND_SPEED:
MOV DPTR, #SPEED_WORD
D5:
CLR A
MOVC A, @A+DPTR
JZ NEXT_LINE_P
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D5

NEXT_LINE_P:
MOV A, #0C0H
ACALL COMNWRT
ACALL DELAY
MOV A, #0FH
ACALL COMNWRT
ACALL DELAY

ACALL TIME
ACALL DIST_FIX
ACALL SPEED_INIT
ACALL SPEED_CALC

SEND_SPEED_UNIT:
MOV DPTR, #SPEED_UNIT
D7:
CLR A
MOVC A, @A+DPTR
JZ MAIN
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D7

SPEED_MINUS:
SETB TR0
RS_1:
15

JB TF0, PLUS_N
REPEAT_N:
JB P2.4, RS_1
CLR TR0

SEND_OPP:
MOV DPTR, #OPP_LANE_WORD
D6:
CLR A
MOVC A, @A+DPTR
JZ NEXT_LINE_N
ACALL DATAWRT
ACALL DELAY
INC DPTR
SJMP D6

NEXT_LINE_N:
MOV A, #0C0H
ACALL COMNWRT
ACALL DELAY
MOV A, #0FH
ACALL COMNWRT
ACALL DELAY

ACALL TIME
ACALL DIST_FIX
ACALL SPEED_INIT
ACALL SPEED_CALC

SEND_SPEED_VALUE:
MOV A, 48H
ACALL SPEED_DISP
MOV A, #"."
ACALL DATAWRT
ACALL DELAY
MOV A, 49H
ACALL SPEED_DISP
SJMP SEND_SPEED_UNIT

PLUS_P:
INC R0
CLR TF0
SJMP REPEAT_P

PLUS_N:
INC R0
CLR TF0
SJMP REPEAT_N

DELAY_1S:
MOV R7, #13
HERE4:
ACALL DELAY
DJNZ R7, HERE4
RET

TIME:
MOV A, #20H
MOV B, R0
MUL AB
MOV 43H, A
MOV 42H, B
MOV A, TH0
ADDC A, #18H
MOV 43H, A
16

RET

SPEED:
DEC R0
MOV 44H, R0

MOV A, R0
MOV B, #5
DIV AB
MOV 48H, A
MOV 49H, B
MOV A, #02H
MUL AB

MOV 49H, A
MOV B, #18
MUL AB
MOV 51H, A
MOV 50H, B
MOV A, 48H
MOV B, #18
MUL AB
MOV 48H, A
MOV 49H, B
MOV A, 51H
MOV B, #10
DIV AB
MOV 50H, A
MOV 51H, B
MOV A, 48H
ADD A, 50H
MOV 48H, A
MOV A, 49H
ADD A, 51H
MOV 49H, A
ACALL ACT_SPEED
JMP SEND_SPEED_VALUE

SPEED_CALC:
MOV A, R0
MOV B, 43H
MUL AB
MOV 47H, A
MOV 46H, B
MOV A, R0
MOV B, 42H
MUL AB
ADDC A, 46H
MOV 46H, A
SJMP SPEED_CHK

SPEED_CHK:
MOV A, 40H
MOV B, 46H
CJNE A, B, CHK1
MOV A, 41H
MOV B, 47H
CJNE A, B, CHK2
SJMP SPEED
CHK1:
JC SPEED
INC R0
SJMP SPEED_CALC
CHK2:
JC SPEED
17

INC R0
SJMP SPEED_CALC

DIST_FIX:
MOV 40H, #27H
MOV 41H, #10H
RET

SPEED_INIT:
MOV R0, #01H
RET

ACT_SPEED:
MOV A, 48H
MOV B, #10
DIV AB
MOV 50H, A
MOV A, #10
MUL AB
MOV 51H, A
ADD A, 49H
MOV 51H, A
MOV A, 49H
MOV B, #10
MUL AB
MOV 49H, A
ADD A, 51H
MOV 49H, A
MOV A, 48H
ADD A, 50H
MOV 48H, A
RET

SPEED_DISP:
MOV B, #100
DIV AB
JZ LESS_100
ADD A, #48
ACALL DATAWRT
ACALL DELAY
LESS_100:
MOV A, B
MOV B, #10
DIV AB
ADD A, #48
ACALL DATAWRT
ACALL DELAY
MOV A, B
ADD A, #48
ACALL DATAWRT
ACALL DELAY
RET

COMNWRT:
MOV P0, A
CLR P2.6
SETB P2.7
ACALL DELAY
CLR P2.7
RET

DATAWRT:
MOV P0, A
SETB P2.6
SETB P2.7
18

ACALL DELAY
CLR P2.7
RET

DELAY:
MOV R3, #200
HERE2:
MOV R4, #200
HERE:
DJNZ R4, HERE
DJNZ R3, HERE2
RET

CLR_SCREEN:
MOV A, #01H
ACALL COMNWRT
ACALL DELAY
MOV A, #80H
ACALL COMNWRT
ACALL DELAY
RET
ORG 300H
MY_COM1: DB 38H, 0EH, 01H, 06H, 80H,0
MSG_ON_RST_1: DB " VEHICLE SPEED",0
MSG_ON_RST_2: DB " DETECTION ",0
MSG_ON_RST_3: DB " USING 8051 ",0
MSG_ON_RST_4: DB " MICROCONTROLLER ",0
OPP_LANE_WORD: DB " Opposite Lane ",0
SPEED_WORD: DB "Speed = ",0
SPEED_UNIT: DB " kmph ",0
END

Figure 4:[ CITATION Pro1 \l 1033 ]

CHAPTER 4
CONCLUSION AND FUTURE WORK

4.1 CONCLUSION
19

- We find the speed by which a vehicle passes and that is displayed on the
LCD. This information can be used to assess the speed of vehicles on a
road and ticket over speeding vehicles. The working snapshot of the
simulation has been shown in Figure 4.
- The speed obtained is more accurate provided the vehicle is closer to the
sensor.
- The system has a drawback that the speed will not be detected even if one
of the IR sensors is covered by an obstruction like animals, plastics, etc.
- The vehicle speed checker can be fixed by using better quality sensors.
Better calibration between the sensor and vehicle can be used to measure
the precise speed and Data from these positions can be averaged to get a
more accurate speed reading.

4.2 FUTURE WORK

1) The Infrared sensor can be used for mapping of the environment and
detect objects.
2) The sensor can be used for vehicles as parking sensors which can be
used for detecting walls and other vehicles.
3) The sensor can also be used as a radar of the environment to detect
movements and can also be placed in safe places of the pipelines to detect
any leaks in the pipeline.
4) Ships can use more accurate and bigger sensors to gain vision deep
inside the ocean. Enemy Submarines can also be detected using this
sensor.
5) It can also be used as a home theft alert system as the two sensors can
be used to detect a person entering the room and vice -versa.
20

5. REFERENCES
1. http://www.circuitstoday.com/proteus-software-introduction - Tutorial for using Proteus.
[ CITATION Pro2 \l 1033 ]

2. https://www.freebookcentre.net/electronics-ebooks-download/Microcontrollers-and-
Applications.html [ CITATION Mic \l 1033 ]
3. https://www.tutorialspoint.com/timers-of-8051 [ CITATION Tim \l 1033 ]

4. 8051 Microcontrollers, Hardware, Software, and Applications by D. M. Calcutt[ CITATION


DMC \l 1033 ]

You might also like