project report distance measurement system

40
A Project Report on EYE TRACKING INTERPRETATION SYSTEM Submitted by Name Seat No GAVHALE NAVLESH B120283824 GAVHANE DEVENDRA B120283825 KURKUTE SIDDHESHWAR B120283843 A Project report submitted as a partial fulfillment towards Project for term-II of Bachelor of Electronics and Telecommunication Engineering, 2015-16 Under the guidance of Mrs.S.R.Pawar Department of Electronics and Telecommunication Engineering MIT Academy of Engineering, Alandi (D), Pune 412 105 Savitribai Phule Pune University. 2015-2016

Upload: kurkute1994

Post on 21-Apr-2017

2.133 views

Category:

Engineering


363 download

TRANSCRIPT

Page 1: Project Report Distance measurement system

A Project Report on

EYE TRACKING INTERPRETATION SYSTEM

Submitted by

Name Seat No

GAVHALE NAVLESH B120283824

GAVHANE DEVENDRA B120283825

KURKUTE SIDDHESHWAR B120283843

A Project report submitted as a partial fulfillment towards Project for term-II of

Bachelor of Electronics and Telecommunication Engineering,

2015-16

Under the guidance of

Mrs.S.R.Pawar

Department of Electronics and Telecommunication Engineering

MIT Academy of Engineering, Alandi (D),

Pune 412 105

Savitribai Phule Pune University.

2015-2016

Page 2: Project Report Distance measurement system

CERTIFICATE

This is to certify that

Name Seat No

NAVLESH GAVHALE B120283824

DEVENDRA GAVHANE B120283825

SIDDHESHWAR KURKUTE B120283843

of

MIT Academy of Engineering, Alandi (D), Pune have submitted Project report on

EYE TRACKING INTERPRETATION SYSTEM as a partial fulfillment of term II for award

of degree of Bachelor of Electronics and Telecommunication Engineering, from Savitribai Phule

Pune University, Pune, during the academic year 2015-16.

Project Guide Head of Dept

Mrs.S.R.Pawar Dr.M.D.Goudar

External Examiner

Page 3: Project Report Distance measurement system

Acknowledgement

We take this opportunity to thank certain people without whom this endeavor would not have been

possible. We would also express our thanks to the head of Department of Electronics engineering

Dr.M.D.Goudar. We would like to express our sincere gratitude to our guide Mrs.S.R.Pawar

for constant encouragement, help and guidance without which this project would not have been

completed.

We would like to express our sincere gratitude towards Mr.S.A.Khandekar, Mr.P.R.Ubare,

Mr.G.R.Vyawhare, Mr.P.P.Kumbhar for their constant support and valuable advice throughout

the progress of the project. Last but not the least, We express our heartiest acknowledgement to

our parents, friends and colleagues who directly or indirectly helped us in completing the project.

Page 4: Project Report Distance measurement system

ABSTRACT

Distance measurement of an object in the path of a person, equipment, or a vehicle, stationary or

moving is used in a large number of applications such as robotic movement control, vehicle con-

trol, blind mans walking stick, medical applications, etc. Measurement using ultrasonic sensors is

one of the cheapest among various options. In this project distance measurement of an obstacle

by using ultrasonic sensor and a microcontroller is presented.

Page 5: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

INDEX

1 INTRODUCTION 1

1.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2 Necessity of project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 LITERATURE SURVEY 3

3 SYSTEM DESCRIPTION 5

3.1 Related work component selection . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.2 Ultrasonic Ranging Module HC - SR04 . . . . . . . . . . . . . . . . . . . . . . . 5

3.2.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.2.2 Electrical Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2.3 Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.3 ATmega32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.3.1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.3.2 GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.3 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4 LCD Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.1 Pin Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5 Costing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4 SOFTWARE DESCRIPTION 16

4.1 AVR Studio 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune i

Page 6: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

4.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4.1.2 Starting AVR Studio 4 and Creating a Project . . . . . . . . . . . . . . . . 16

4.1.3 Burning the code using Sinaprog Software . . . . . . . . . . . . . . . . . 19

5 METHODOLOGY 20

5.1 Block Diagram and Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.2 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

5.3.1 Ultrasonic Sensor Interface with Microcontroller . . . . . . . . . . . . . . 24

5.3.2 16X2 LCD Interface with MCU . . . . . . . . . . . . . . . . . . . . . . . 25

6 RESULT 27

7 APPLICATIONS 28

8 CONCLUSION AND FUTURE SCOPE 29

8.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

8.2 Future Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

9 REFERENCES 31

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune ii

Page 7: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

List of Figures

3.1 HC SR04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2 Electrical Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.3 Timing Diagram of HC SR04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.4 Atmega32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.5 Pin diagram of Atmega32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.6 Basic Operation of Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.7 16X2 LCD Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.8 LCD Pin Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.9 Pin Description of 16X2 LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.10 LCD Commands Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4.1 Welcome Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.2 Name the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.3 Choosing the microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4.4 Building the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.1 Block Diagram[9] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.2 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.3 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.4 Ultrasonic sensor interface with MCU . . . . . . . . . . . . . . . . . . . . . . . . 25

5.5 LCD interface with MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Puneiii

Page 8: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

List of Tables

3.1 Component Cost Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

9.1 Project Schedule Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune iv

Page 9: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 1

INTRODUCTION

Distance measurement of an object in front or by the side of a moving entity is required in a large

number of devices. These devices may be small or large and also quite simple or complicated.

Such distance measurement systems are available. These use various kinds of sensors and sys-

tems. Low cost and accuracy as well as speed is important in most of the applications.

In this project, we have implemented such a measurement system which uses ultrasonic sensor

unit and a ATmega32 microcontroller based system. This microcontroller is easily available at low

cost. A correlation is applied to minimize the error in the measured distance. Ultrasound sensors

are very versatile in distance measurement. They are also providing the cheapest solutions. Ultra-

sound waves are useful for both the air and underwater. Ultrasonic sensors are also quite fast for

most of the common applications. In simpler system a low cost version of 8- bit microcontroller

can also be used in the system to lower the cost.

The current methods of blockage detection are based on manual visual inspection and inspection

through CCD camera based equipments. In such systems first pictures of obstacle can be obtained

and then they are observed and analyzed. The main limitation of these systems are that they cannot

tell you the exact distance or location of the obstacle.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 1

Page 10: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

1.1 Problem Statement

As IR sensors distance measurement systems cannot work good in different light conditions and

also cannot work in water,hence build a low cost system to measure the distance which will work

under water and is not affected by varying light conditions.

1.2 Necessity of project

The main objective of this project is to Provide a useful system to measure the distance which will

be easy to configure and handle.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 2

Page 11: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 2

LITERATURE SURVEY

Obstacle detecting sensors are one of the most basic type of sensors that electronic hobbyists use.

There are several methods to make cheap obstacle sensors. These simple sensors are made using

a IR Rx/Tx pair or Normal LED and LDR pair(this design is most basic and is heavily affected

by environment lighting conditions). These sensor may be useful for simple requirement but they

have following drawbacks :

1. Cant say anything about the real distance of obstacle.

2. Give different result for different coloured obstacles.

3. Need calibration (like setting up a variable resistor).

To solve these problems initially IR Range Finder Modules(like one made by Sharp) were used but

they have small range.

1. Sharp GP2D12 Distance Measurement Sensor has a maximum range of 80cm

2. Sharp GP2D120 Distance Measurement Sensor has a maximum range of 30cm only.

To solve all these problem we can use an Ultrasonic Range Finder Module. An Ultrasonic Range

Finder Module uses ultrasonic waves (inaudible to humans) to measure distance. These module

consist of an Ultrasonic Transmitter (Tx) that emits the ultrasonic wave, the waves after striking

any obstacle bounces back and reach the Ultrasonic Receiver (Rx). By measuring the time it take

for the whole process to complete and using simple arithmetic we can measure the distance to the

obstacle. The Ultrasonic Range Finder Modules has a wide operating range of 1cm to 400cm with

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 3

Page 12: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

an accuracy of 1cm. These specifications makes it ideal for distance measurement application.

These can be used for:

1. Contact less measurement of liquid level in tanks (even 4m deep tank).

2. Radars for robot.

3. Obstacle sensing in Robotics.

4. Speed check in roads.

5. Handheld units that can be pointed on vehicles to measure their speed.

6. Fixed unit installed in check booths that can click pictures of over speeding vehicles.

The reason for using ultrasonic wave are

1. The speed of Ultra Sonic waves is 343m/s (Speed of Sound) which is not too fast for MCUs to

measure accurately. Compare this with speed of electromagnetic waves (like light or radio waves)

which is 30,00,00,000 m/s! So it takes only 20ns (nano second) to go and bounce back from an

obstacle which is 3m away! An AVR running at 16MIPS(maximum for most AVRs) takes 62ns to

execute a single instruction.

2. Ultrasonic waves travels more narrow, like a beam than normal sound wave. This property helps

the sensor detect the obstacles that are exactly in line with it only. The sensors can be rotated with

steppers or servo motors to get a ”image” of obstacle in the surrounding area (like a radar).

3. Finally the wave do not disturb any humans nearby.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 4

Page 13: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 3

SYSTEM DESCRIPTION

3.1 Related work component selection

1. Ultrasonic Sensor - HC-SR04

2. ATmega32

3. 16x2 LCD Display

3.2 Ultrasonic Ranging Module HC - SR04

3.2.1 Features

Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function.

The modules includes ultrasonic transmitters, receiver and control circuit. The basic principle of

work:

1.Using IO trigger for at least 10us high level signal

2.The module automatically sends eight 40 kHz and detect whether there is a pulse signal back.

3.IF the signal back, through high level , time of high output IO duration is the time from sending

ultrasonic to returning.

4.Test distance = (high level time velocity of sound (340M/S)/2

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 5

Page 14: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Figure 3.1: HC SR04

3.2.2 Electrical Parameters

Figure 3.2: Electrical Parameters

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 6

Page 15: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3.2.3 Timing Diagram

The Timing diagram is shown below. You only need to supply a short 10uS pulse to the trigger

input to start the ranging, and then the module will send out an 8 cycle burst of ultrasound at 40

kHz and raise its echo. The Echo is a distance object that is pulse width and the range in proportion

.You can calculate the range through the time interval between sending trigger signal and receiving

echo signal. Formula: uS / 58 = centimeters or uS / 148 =inch; or the range = high level time *

velocity (340M/S) / 2; It is advised to use over 60ms measurement cycle, in order to prevent trigger

signal to the echo signal.

Figure 3.3: Timing Diagram of HC SR04

3.3 ATmega32

The ATmega32 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC

architecture. By executing powerful instructions in a single clock cycle, the ATmega32 achieves

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 7

Page 16: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Figure 3.4: Atmega32

throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power con-

sumption versus processing speed.

3.3.1 Specifications

1. High-performance, Low-power AVR 8-bit Microcontroller

2. Advanced RISC Architecture

a) 131 Powerful Instructions Most Single-clock Cycle Execution

b) 32 x 8 General Purpose Working Registers

c) Fully Static Operation

d) Up to 16 MIPS Throughput at 16 MHz

e) On-chip 2-cycle Multiplier

3. Peripheral Features

a) Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes

b) One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode

c) Real Time Counter with Separate Oscillator

d) Four PWM Channels

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 8

Page 17: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

e) 8-channel, 10-bit ADC

f) Master/Slave SPI Serial Interface

g) Programmable Watchdog Timer with Separate On-chip Oscillator

h) On-chip Analog Comparator

4. Special Microcontroller Features

a) Power-on Reset and Programmable Brown-out Detection

b) Internal Calibrated RC Oscillator

c) External and Internal Interrupt Sources

f) Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended

Standby

3.3.2 GPIO

VCC:Digital supply voltage.

GND:Ground.

Port A (PA7..PA0): Port A serves as the analog inputs to the A/D Converter. Port A is also used

as an 8-bit bi-directional I/O port if the analog to digital converter is not used. The Port A output

buffers have symmetrical drive characteristics. When pins PA0 to PA7 are used as inputs, they

will source current if the internal pull-up resistors are activated. When a reset condition becomes

active, Port A pins are tri-stated even if the clock is not running.

Port B (PB7..PB0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors. The

Port B output buffers also have symmetrical drive characteristics with both high sink and source

capability. Port B pins which are externally pulled low will source current if the pull-up resistors

are activated. When a reset condition becomes active and even if the clock is not running, the Port

B pins becomes tri-stated.

Port C (PC7..PC0): Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (se-

lected for each bit). If the pull-up resistors are activated Port C output buffers also have symmetrical

drive characteristics with both high sink and source capability. Port C pins which are externally

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune 9

Page 18: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

pulled low will source current. When a reset condition becomes active the Port C pins are tri-

stated, even if the clock is not running. The pull-up resistors on pinsPC5 (TDI), PC3 (TMS) and

PC2(TCK) will be activated if the JTAG interface is enabled even if a reset occurs.

Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors. The

Port D output buffers also have symmetrical drive characteristics with both high sink and source

capability. As inputs, Port D pins which are externally pulled low will source current if the pull-up

resistors are activated. When a reset condition becomes active the Port D pins becomes tri-stated,

even if the clock is not running.

figure below shows the pin diagram of the ATmega32

Figure 3.5: Pin diagram of Atmega32

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune10

Page 19: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3.3.3 Timer

Timers are standard features of almost every microcontroller. So it is very important to learn their

use. Since an AVR microcontroller has very powerful and multifunctional timers, the topic of timer

is somewhat vast. Moreover there are many different timers on chip. So this section on timers will

be multipart. I will be giving basic introduction first.

What is a timer?

A timer in simplest term is a register. Timers generally have a resolution of 8 or 16 Bits. So a 8

bit timer is 8Bits wide so capable of holding value withing 0-255. But this register has a magical

property ! Its value increases/decreases automatically at a predefined rate (supplied by user). This

is the timer clock. And this operation does not need CPUs intervention.

Figure 3.6: Basic Operation of Timer

Since Timer works independently of CPU it can be used to measure time accurately. Timer upon

certain conditions take some action automatically or inform CPU. One of the basic condition is

the situation when timer OVERFLOWS i.e. its counted upto its maximum value (255 for 8 BIT

timers) and rolled back to 0. In this situation timer can issue an interrupt and you must write an

Interrupt Service Routine (ISR) to handle the event.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune11

Page 20: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3.4 LCD Display

LCD (Liquid Crystal Display) is an electronic display system. A 16x2 LCD display is a very basic

system and commonly used in various devices and circuits. LCDs are preferred over seven seg-

ments and other multi segment LEDs. The advantages of LCDs are as follows:

1. LCDs are economical.

2. They are easily programmable.

3. A number of characters can be displayed.

4. Very compact and light.

5. Low power consumption

Figure 3.7: 16X2 LCD Display

A 16x2 LCD means it can display 16 characters per line and 2 such lines are there. In this LCD

every character is displayed in 5x7 pixel matrix. LCD possesses two registers: Data and Command

registers. The command register stores the command instructions given to the LCD. A command

can be defined as an instruction given to LCD to do a predefined task. For example, initializing

the LCD, clearing the screen, controlling the cursor position, controlling the display etc. The data

register stores the data which is displayed on the LCD screen. The data is the ASCII value of the

character which is displayed on the LCD screen.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune12

Page 21: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3.4.1 Pin Diagram

Figure 3.8: LCD Pin Diagram

Pin Descriptions

Figure 3.9: Pin Description of 16X2 LCD

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune13

Page 22: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

PROGRAMMING OF LCD:

For programming the 16x2 LCD display there are three basic steps.

1. Initialization of LCD

2. Giving command for reading the given data

3. Giving command for writing data and displaying on the screen

LCD COMMANDS:

Figure 3.10: LCD Commands Description

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune14

Page 23: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3.5 Costing

Sr.No. Component Cost1) HC SR04 2002) ATmega 32 3003) 16X2 LCD Display 200

Table 3.1: Component Cost Table

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune15

Page 24: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 4

SOFTWARE DESCRIPTION

4.1 AVR Studio 4

4.1.1 Introduction

The following softwares were used for programming and feeding in ATmega32 microcontroller.

1. AVR Studio 4 : AVR Studio 4 is the development platform. AVR studio is required to write the

C-code and generate its HEX code.

2. Win AVR: It is used to compile the program.

3. Sinaprog 2.0 : It is used to burn the program and hex file is dumped into the microcontroller.

4.1.2 Starting AVR Studio 4 and Creating a Project

1. Open the AVR Studio.

2. Click on the New Project button.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune16

Page 25: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Figure 4.1: Welcome Window

3. Do the followings:

a) In the left side, select AVR GCC.

b) Choose the name for the project.

c) Choose the location where the files of the project will be saved.

d) Press the next button.

Figure 4.2: Name the project

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune17

Page 26: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

4. Choose AVR Simulator from left side and ATmega32 from the right side and press Finish

button.

Figure 4.3: Choosing the microcontroller

5. Write the program.

6. Save the program.

7. Select Build for compiling the program.

Figure 4.4: Building the program

8. Correct the errors.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune18

Page 27: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

4.1.3 Burning the code using Sinaprog Software

The hex file is generated with same name as program using WinAvr. This program is transferred

to flash memory of microcontroller. An USB ISB programmer can be used to burn the program.

Through the sinaprog software the program is burnt into microcontroller. The burner uses SPF port

of microcontroller to load the program.

Steps :

1. Hex file is generated.

2. Connect the ATmega32 development board and PC through burner.

3. Open sinaprog and select ATmega32.

4. Load the program and burn through sinaprog.

5. Output is shown.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune19

Page 28: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 5

METHODOLOGY

5.1 Block Diagram and Description

Block Diagram:

Figure 5.1: Block Diagram[9]

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune20

Page 29: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Description:

The block diagram mainly consist of six parts

1) Power Supply

2) Ultrasonic Sensor Unit

3) Microcontroller

4) 16X2 LCD Display

5) Object

1)Power Supply:It is a key block in the project which will be powering to the LCD,MCU and

Ultrasonic Sensor

2)Ultrasonic Sensor Unit: A good sensor according to the requirements.

3)Microcontroller: Here we are using Atmega 32 which is used for all the computations needed.

4)16X2 LCD Display:In order to display the distance measured this block is required.

5)Object:It is that thing whose distance is to be measured from the system.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune21

Page 30: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

5.2 Flowchart

The flowchart below show for obtaining the time taken before the distance will be calculate.

Figure 5.2: Flowchart

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune22

Page 31: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Figure 5.3: Flowchart

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune23

Page 32: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

5.3 Implementation

The technique of distance measurement using ultrasonic in air include continuous wave and pulse

echo technique. In the pulse echo method, a burst of pulses is sent through the transmission

medium and is reflected by an object kept at special distance. The time taken for the pulse to

propagate from transmitter to receiver is proportional to the distance of object. For contact less

measurement of distance, the device has to rely on the target to reflect the pulse back to itself.

The target needs to have a proper orientation that is it needs to be perpendicular to the direction of

propagation of the pulses. The amplitude of the received signal gets significantly attenuated and is

a function of nature of the medium and the distance between the transmitter and target. The pulse

echo or time-of-flight method of range measurement is subject to high levels of signal attenuation

when used in an air medium,thus limiting its distance range.

5.3.1 Ultrasonic Sensor Interface with Microcontroller

These modules are designed to be used for microcontroller based applications hence optimized for

it. The interface is a single pin called SIG (signal). The MCU is connected to the Ultrasonic Sensor

Module by a single i/o line. The steps required to read distance are :

1. Microcontroller make the i/o line output. (by using the DDRx Register in AVR )

2. The i/o line is made low (this may be the default state of i/o pin)

3. Wait for 10uS

4. Make the i/o line high.

5. Wait for 15uS

6. Make the i/o line low

7. Wait for 20uS

8. Now make it input (by using the DDRx Register in AVR)

9. Module will keep it low. Wait till it is low, as soon as it becomes high start the timer.

10. After that wait till it is high, as soon as it becomes low copy the timer value and stop the timer.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune24

Page 33: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

11. Finally we have the time required for the wave to go hit the obstacle and come back to the

module.

Figure 5.4: Ultrasonic sensor interface with MCU

If the pulse width is in microseconds, the distance can be calculated by the following formula :

Distance in cm = Pulse width/58

Distance in inches = Pulse width/148

5.3.2 16X2 LCD Interface with MCU

162 LCD can be interfaced with a microcontroller in 8 Bit or 4 Bit mode. These differs in how data

and commands are send to LCD. In 8 Bit mode character data (as 8 bit ASCII) and LCD command

are sent through the data lines D0 to D7. That is 8 bit data is send at a time and data strobe is given

through E of the LCD.But 4 Bit mode uses only 4 data lines D4 to D7. In this 8 bit data is divided

into two parts and are sent sequentially through the data lines. The idea of 4 bit communication

is introduced to save pins of microcontroller. 4 bit communication is bit slower than 8 bit but this

speed difference has no significance as LCDs are slow speed devices. Thus 4 bit mode data transfer

is most commonly used.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune25

Page 34: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Figure 5.5: LCD interface with MCU

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune26

Page 35: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 6

RESULT

The working model of the proposed AVR Atmega32 microcontroller based range finder using

ultrasonic module was successfully designed and implemented. The performance of the circuit

was analysed for different conditions. The circuit was able to measure distance up to 2.5m without

interfering in human activity. Circuit was tested for measurement of various distances in different

atmospheric conditions, accurately. It has a fast response. The ultrasonic module works fine. It

responds to the incoming echo accordingly. By using ATmega32 and HC-SR04 we were able to

reduce the cost and increase efficiency. This implementation has been a major component in the

circuits of major fast consuming electronic goods.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune27

Page 36: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 7

APPLICATIONS

1. Used to measure the obstacle distance.

2. This system used in automotive parking sensors and obstacle warning systems.

3. Used in terrain monitoring robots.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune28

Page 37: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 8

CONCLUSION AND FUTURE SCOPE

8.1 Conclusion

The objective of this project was to design and implement an Ultrasonic Distance Measurement

device. As described in this report a system is developed that can calculate the distance of the

tracked object. With respect to the requirements for an ultrasonic rangefinder the followings can

be concluded.

1. The system can calculate the distance of the obstruction with sufficient accuracy.

2. This device has the capability to interact with other peripheral if used as a secondary device.

3. This can also communicate with PC through its serial port.

4. This offers a low cost and efficient solution for non-contact type distance measurements.

8.2 Future Scope

The range can be considerably increased by using high power drive circuit.

1.Using temperature compensation, it can be used over wide temperature range.

2. The resolution of the measurement can be improved by incorporating phase shift method along

with time of flight method.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune29

Page 38: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

3. Can be used as parking assistance system in vehicles with high power ultrasonic transmitter.

4. The 40 kHz signal can be generated using microcontroller itself which will reduce hardware.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune30

Page 39: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

Chapter 9

REFERENCES

1. Spasov Peter, Microcontroller Technology the 68HC11 and 68HC12 Upper Saddle River, Pear-

son Prentice Hall, Fifth Edition, 2004.

2. Sinclair Ian R. and Dunton John, Practical Electronic Handbook, 6th Edition, 2007.

3. Horton Ivor, Beginning C, Wrox Press Ltd, Birmingham, U.K, 2nd Edition, 2002.

4. Brown Forrest John, Embedded Systems Programming in C and Assembly, Van Nostrand Rein-

hold, N.Y, Prentice-Hall, 2003.

5. Deshmukh V Ajay, Microcontrollers Theory and Applications,New Delhi, Tata McGraw-Hill

Publishing Co. Ltd, 2005.

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune31

Page 40: Project Report Distance measurement system

EYE TRACKING INTERPRETATION SYSTEM

• PROJECT SCHEDULE PLAN

Sr.No. Activity Plan(period) Execution1) Literature survey January Completed2) Coding and Software Development January-February Completed3) Main Board Development February Completed4) Implementation and Testing February-March Completed5) Final Demonstration March Completed6) Project Report April Completed

Table 9.1: Project Schedule Plan

Project Guide Project Co-ordinator Head of Dept

Mrs.P.S.Kasliwal Mr.S.A.Khandekar Dr.M.D.Goudar

Department of Electronics and Telecomm. Engineering, MIT Academy of Engineering, Pune32