Upload
abhishek-das
View
225
Download
0
Embed Size (px)
Citation preview
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 1/13
SUMMER INTERNSHIP PROGRAM 2011
PROJECT REPORT
TITLE
2-Way Sound Sensitive Line Follower
Made under the supervision of
Mr. Tarique Aziz
Research Engineer
Robosapiens Technologies Pvt. Ltd
Made by
Abhishek Das
SIP/10/2096
June, 2011
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 2/13
2
Acknowledgements
I would like to thank Mr. Tarique Aziz for his help throughout the term of
this project. I am indebted to him, for his thoughtful supervision and clear
advice.
My family and friends have also made this an enjoyable task as a result of
both their personal support and the comments that only friends can make.
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 3/13
3
Table of Contents
Acknowledgements 2
Table of Contents 3
1. Introduction
1.1. Objectives
1.2. Project Overview
4
2. Components Used
2.1. DC Geared Motors
2.2. IR Sensors
2.2.1. IR LED
2.2.2. Photodiode
2.2.3. Operational Amplifier
2.3. Motor driver IC (L293D)
2.4. AVR Microcontroller (ATmega8)
5
3. Working 11
4. Algorithm 11
5. Source Code 12
6. References and Resources 13
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 4/13
4
1. INTRODUCTION
1.1. Objectives
Following were the main objectives of the project.
1. To develop a line following robot that follows a black path on white
background, unaffected by any stray sounds, and stops at the end.
2. To make the robot turn around and return back as a line follower
when a sound is produced.
1.2. Project Overview
Line follower is a machine that can follow a path. The path can be visible
like a black line on a white surface (or vice-versa) or it can be invisible
like a magnetic field. Sensing a line and manoeuvring the robot to stay
on course, while constantly correcting wrong moves using feedback
mechanism forms a simple yet effective closed loop system. As a
programmer you get an opportunity to ‘teach’ the robot how to follow
the line thus giving it a human-like property of responding to stimuli.
Practical applications of a line follower: Automated cars running on
roads with embedded magnets; guidance system for industrial robots
moving on shop floor etc.
The principle of the line follower is based on sensing the background
surface making use of IR sensor. Basically IR sensor takes input by
detecting the reflection of the IR rays from the surface and accordingly
gives its output to the motors.
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 5/13
5
2. COMPONENTS USED
2.1. DC Geared Motors
In our line follower DC geared motors are used.
• WHY DC MOTOR?
Easy to control
Require only two signals
To change the direction of rotation, just reverse the polarity
Speed can be controlled by the voltage
• USE OF GEARS
To provide enough torque
Increases the torque at the expense of speed
2.2.
IR Sensors
Sensors are basically electronic devices which are used to sense the
changes that occur in their surroundings. The change may be in colour,
temperature, moisture, sound, heat etc. They sense the change and work
accordingly. IR sensors consist of emitter and detector. Emitter emits
the IR rays and detector detects it.
The IR sensor basically consists of three components:
IR LED (emitter)
Photodiode (detector)
Operational Amplifier (LM358)
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 6/13
6
2.2.1. IR LED
IR LED is a light emitting diode which emits IR radiations. The basic
function of the emitter is to convert electricity into light. It works on
the principle of recombination of the electron-hole pair. As in the
conduction band of a diode, electrons are the majority carrier and in
the valence band, holes are majority carrier. So when an electron
from a conduction band recombines with a hole of valance band,
some amount of energy is released and this energy is in the form of
light. The amount of energy released depends upon the forbidden
energy gap. The IR Led has two legs, the leg which is longer is
positive and other leg is negative.
2.2.2. Photodiode
The photodiode is a p-n junction diode which is connected in reverse
bias. The basic function of the detector is to convert light into
electricity. As its name implies, it works effectively only when a
certain number of photons or certain amount of light falls on it. When
no light is falling on the photodiode it has infinite resistance and acts
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 7/13
7
as an open switch but as the light starts falling on the photodiode, the
resistance decreases and when full intensity of light is incident on the
photodiode then its resistance becomes zero and it starts acting like a
closed switch.
2.2.3. Operational Amplifier
It is a DC-coupled high gain amplifier with differential inputs and
single output. Typically the output of the op-amp is controlled by
either negative feedback or positive feedback. Due to the fact that it performs several operations like addition, subtraction, multiplication,
integration etc, it is named as operational amplifier. It has two inputs,
inverted (Pin 2) and non-inverted input (Pin3). The signal which is
applied to the inverted input gives output 180 degree out of phase
with input whereas in the non-inverted input gives output in phase
with that of input. Op-amp has a variety of uses in different
electronics devices. In the line follower it is used in the comparator
mode. The op-amp IC which is used here is LM358, which is an 8-pin
IC having two inbuilt op-amps. In the comparator mode, the
reference voltage is set at the inverted input pin and then it is
compared with the input at non inverted pin. As the voltages at two
input pins of op-amp is compared, as the voltage at Pin 3 exceeds the
reference voltage at Pin 2 the output of the comparator becomes high
(5 V) otherwise it becomes low (0 V). The reference voltage at Pin 2
is set with the help of variable resistor.
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 8/13
8
Internal block diagram of LM358 IC
Circuit diagram of IR sensor
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 9/13
9
2.3. Motor Driver IC (L293D)
L293D IC is a dual H-bridge motor driver IC. One H-bridge is capable of
driving a DC motor bidirectionally. L293D IC is a current enhancing IC.As the output from the sensor is not able to drive motors by itself so
L293D is used for this purpose. L293D is a 16 pin IC having two enable
pins which should always high to enable both the H-bridges.
Pin Diagram of L293D
2.4. AVR Microcontroller (ATmega8)
“Atmel's AVR® microcontrollers have a RISC core running single cycle
instructions and a well-defined I/O structure that limits the need for
external components. Internal oscillators, timers, UART, SPI, pull-up
resistors, pulse width modulation, ADC, analog comparator and watch-dog
timers are some of the features you will find in AVR devices. AVR
instructions are tuned to decrease the size of the program whether the
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 10/13
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 11/13
11
3. WORKING
The robot uses IR sensors to sense the line. The output of the sensors is an
analog signal which depends on the amount of light reflected back, this
analog signal is given to the comparator to produce 0s and 1s which are
then fed to the µC.
When a sensor is on the line it reads 0 because rays are not reflected back
and when it is off the line it reads 1 because reflected rays are incident on
the photodiode.
4. ALGORITHM
1. If both sensors read 1, go straight.
2. If left sensor reads 0 and right sensor reads 1, turn left.
3. If right sensor reads 0 and left sensor reads 1, turn right.
4. If both sensors read 0, stop and wait for sound.
5. If motors are not running and sound is detected, turn around.
6. Go to step 1
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 12/13
12
5. SOURCE CODE
#include <avr/io.h>
#include <util/delay.h>
void main ()
{
int left, right, sound;
DDRB = 0xff;
DDRC = 0x00;
while (1)
{
left = PINC & 0b0100000;
right = PINC & 0b0010000;
sound = PINC & 0b0000001;if (left==0b0100000 && right==0b0010000)
{
PORTB = 0b00001001;
_delay_ms(50);
}
if (left==0b0000000 && right==0b0010000)
{
PORTB = 0b00000101;
_delay_ms(50);
}
if (left==0b0100000 && right==0b0000000)
{
PORTB = 0b00001010;
_delay_ms(50);
}
if (left==0b0000000 && right==0b0000000)
{
PORTB = 0b00000000;
if (sound==0b0000001)
{
PORTB = 0b00001010;
_delay_ms(100000);
_delay_ms(100000);
_delay_ms(100000);
_delay_ms(100000);
_delay_ms(100000);
}
}
}
}
8/6/2019 2-Way Sound Sensitive Line Follower
http://slidepdf.com/reader/full/2-way-sound-sensitive-line-follower 13/13
13
6. REFERENCES AND RESOURCES
Books:
Robotics with AVR – Toshendra K. Sharma
Links:
Atmel Corp.
Makers of the AVR microcontroller
http://www.atmel.com
One of the best sites AVR sites
http://www.avrfreaks.net
WinAVR
An open source C compiler for AVR
http://sourceforge.net/projects/winavr
Robotics India
An Indian site devoted to robotics. Must see
http://www.roboticsindia.com/
Tools:
AVR Studio
Compiler:
WinAVR
Programmer:
AVR Loader v1.1 (GUI based on AVRDude)