Upload
sameer-kapoor
View
216
Download
4
Tags:
Embed Size (px)
DESCRIPTION
ambulance
Citation preview
A
TRAINING REPORT
ON
(LINE FOLLOWER)
SUBMITTED IN PARTIAL FULFILLMENT
FOR THE AWARD OF THE DEGREE OF
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS & COMMUNICATION ENGINEERING
BY
AMAN BHARDWAJ
Roll no. 1810601
Batch: 2010-2014
DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING
HARYANA ENGINEERING COLLEGE,
JAGADHRI, HARYANA (INDIA)
(Kurukshetra University, Kurukshetra)
1
ACKNOWLEDGEMENT
This report conveys my heartiest thanks to the staff of Robosapiens Technologies Pvt.
Ltd. who have given me their full co-operation and devoted their valuable time, for
rendering me their needy services, guidelines during the course of imparting me practical
training and with those sincere and precious help I have been able to complete my
practical training successfully.
“No good work can be done alone”, as the saying goes is truly applicable. A friend,
philosopher and a guide always acts source of inspiration and motivation to accomplish
a given task.
Firstly, I wish to express my sincere gratitude to Dr. Kuldeep Singh (Principal), Sh. Harish
Mahendru (H.O.D.) for their kind co-operation.
My heartiest debts to my parents for their encouragement and understanding which has been a
timely factor in the completion of this project.
AMAN BHARDWAJ
1810601
2
LIST OF FIGURES PAGE NO
2.1 EMBEDDED SYSTEM 11
3.1 IR LED 16
3.2 Photodiode 17
3.3 Internal block diagram of LM358IC 18
3.4 Circuit diagram of IR sensor 19
3.5 Pin diagram of L293D 20
3.6 H-Bridge using transistors 21
3.7 PIN Out of ATMega8 25
3.8 Block diagram of Line Follower Robot 26
3
LIST OF CONTENT PAGE NO
CHAPTER -1 7-9
INTRODUCTION OF COMPANY
1.1 HISTORY
1.2 ORGANISATION STRUCTURE
1.3 FIELDS
CHAPTER – 2 10-11
INTRODUCTION TO EMBEDDED SYSTEM
2.1 INTRODUCTION
2.2 DEFINATION
2.3 USE
CHAPTER – 3 12-31
LINE FOLLOWER ROBOT
3.1 INTRODUCTION
3.2 OBJECTIVES OF THE STUDY-
3.3 PRINCIPLE OF OPEREATION
3.4 REQUIREMENT SPECIFICATION
3.4.1 DC GEAR MOTOR
3.4.2 WHY DC MOTOR
3.4.3 USE OF GEARS
3.4.4 IR SENSORS
3.4.4.1 IR LED
3.4.4.2 PHOTODIODE
3.4.4.3 OPERATIONAL AMPLIFIER:
3.5 MOTOR DRIVER IC (L293D)
3.5.1 H-BRIDGE MOTOR CONTROL
3.6 MICROCONTROLLER: AVR ATmega8
4
3.7 ATmega8
3.8 CODING AND DESIGN:
3.9 APPLICATIONS
3.10 LIMITATIONS
3.11 TESTING
CHAPTER – 4 32-33
CONCLUSION AND FUTURE SCOPE
REFERENCES
5
CHAPTER - 1
INTRODUCTION OF COMPANY
1.1 HISTORY
Robosapiens is India’s most leading company in robotics. The company was founded in
2003 with the goal of providing technologies to promote the widespread adoption of
robotics in education. Robosapiens offers a complete line of technology solutions to
brand name. Robosapiens solutions represent a low-risk and cost effective way for
manufacturers to deliver innovative products quickly. It is Recognized for its innovations,
and with a growing portfolio of industry-leading partners, Robosapiens meets the needs
of manufacturers by providing embedded software solutions that respect the system and
cost constraints required for mass-production. With strong connections to leading R & D
and educational institutions, as well as a leading role in several international research
projects, Robosapiens Robotics’ engineers are constantly growing the pool of solutions
available to clients. The company’s success in the high-growth consumer robotics market
has helped transform the company from an ambitious startup to an international leader in
its field.
1.2 ORGANISATION STRUCTURE
Founded in 2003 by robotics experts Mr. Pradeep Sharma, Mr. Toshendra Sharma and
their research team & development effortsprior to opening the doors at Robosapiens.
6
Their early work focused on creating the technologies for producing modular and
autonomous robots. Robosapiens founders concentrated on building a team of qualified
roboticists, engineers, and mechatricians, creating the current product line-up and
embedded robotic technologies, and filing the necessary patents to pursue. Robosapiens
basically works on Robotics & embedded system and it gives various workshops in
different colleges. The basic objective of the organization is to generate a need for
robotics education among engineering Students and schools in India and become a
name synonymous with robotics education and related events in the country by
providing the most comprehensive and fulfilling services and by creating an
ambience of creativity and an approach towards seeking logical solutions to everyday
problems. Robosapiens India is a Unit of Robosapiens Technologies Pvt. Ltd.
Robosapiens India is India’s leading provider of end to end training and education
solutions, covering Robotics Education and allied fields & Research & Development. We
are among eminent Robotics Education providers pan India. We are ranked among top
training institutions / education centers and graded among India's most trusted service
brands.
We provide Workshops, Trainings Certifications, DIY Kits to engineering colleges and
schools all across India via a good delivery network. We are also pioneer and affluent in
(DSM) designing, supplying and maintenance of Robotics Lab equipments with high
quality services. We organized India’s Biggest Robotics Championships in Institutions
like IIT-Bombay, IIT-Delhi, IIT-Guwahati, IIT-Roorkee etc. We are the only one in India
having done an outreach organizer of Technothlon’09 IIT-Guwahati.Recently, we are
providing training/workshops in collaborations with Technex’11 IT- BHU. We are the
official partner of IT-BHU’2011 and organizing workshops and training programs all
across India. ‘Let Education Evolve’, The company’s Robotics Development programs
help youths to achieve real-world skills to compete better in today’s scenario.
1.3 FIELDS
7
The following are the vacancies & the respective qualifications:
Technical Associate:Excellent Communication SkillsDiploma/BE/B.Tech in ElectronicsBSc/MSc in Electronics
Business Development Executive:Excellent Communication Skills MBA
Research Engineer – Comp Science:BE/B.Tech/M.Tech/MSc in ElectronicsExp. of software development in VB/MATLAB/JAVA/DBMS/.NET
Research Engineer - Electronics:BE/B.Tech/M.Tech/MSc in ElectronicsExp. of Embedded Systems based Projects
Research Engineer – Mechanical:BE/B.Tech in Mechanical Engg Exp. in CAD Drawing and/or 3D modeling softwares Prior Exp. of Robotics based Projets
8
CHAPTER – 2
INTRODUCTION TO EMBEDDED SYSTEM
2.1 INTRODUCTION
An embedded system is a computer system designed for specific control functions within
a larger system, often with real-time computing constraints. It is embedded as part of a
complete device often including hardware and mechanical parts. By contrast, a general-
purpose computer, such as a personal computer (PC), is designed to be flexible and to
meet a wide range of end-user needs. Embedded systems control many devices in
common use today.
Embedded systems contain processing cores that are either microcontrollers or digital signal processors (DSP).The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure.
2.2 DEFINATION
9
An embedded system is some combination of computer hardware and software, either fixed in capability or programmable, that is specifically designed for a particular function. Industrial machines, automobiles, medical equipment, cameras, household appliances, airplanes, vending machines and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that are programmable are provided with programming interfaces, and embedded systems programming is a specialized occupation.
Certain operating systems or language platforms are tailored for the embedded market, such as Embedded, Java and Windows XP Embedded. However, some low-end consumer products use very inexpensive microprocessors and limited storage, with the application and operating system both part of a single program. The program is written permanently into the system's memory in this case, rather than being loaded into RAM (random access memory) like programs on a personal computer
2.3 USE
Embedded systems range from no user interface at all — dedicated only to one task — to complex graphical user interfaces that resemble modern computer desktop operating systems. Simple embedded devices use buttons, LEDs, graphic or character LCDs(for example popular HD44780 LCD) with a simple menu system.
More sophisticated devices which use a graphical screen with touch sensing or screen-edge buttons provide flexibility while minimizing space used: the meaning of the buttons can change with the screen, and selection involves the natural behavior of pointing at what's desired. Handheld systems often have a screen with a "joystick button" for a pointing device.
Some systems provide user interface remotely with the help of a serial (e.g. RS-232, USB, I²C, etc.) or network (e.g. Ethernet) connection. This approach gives several advantages: extends the capabilities of embedded system, avoids the cost of a display, simplifies BSP, allows us to build rich user interface on the PC. A good example of this is the combination of an embedded web server running on an embedded device (such as an IP camera) or a network routers. The user interface is displayed in a web browser on a PC connected to the device, therefore needing no bespoke software to be installed.
10
Fig 2.1 Embedded System
CHEPTER – 3
LINE FOLLOWER ROBOT
3.1 INTRODUCTION
What is a line follower?
Line follower is a machine that can follow a path. The path can be visible like a blackline on a white surface (or vice-versa) or it can be invisible like a magnetic field.
Why build a line follower?
Sensing a line and maneuvering the robot to stay on course, while constantly correctingwrong moves using feedback mechanism forms a simple yet effective closed loopsystem. As a programmer you get an opportunity to ‘teach’ the robot how to follow theline thus giving it a human-like property of responding to stimuli.Practical applications of a line follower : Automated cars running on roads withembedded magnets; guidance system for industrial robots moving on shop floor etc.Prerequisites:Knowledge of basic digital and analog electronics.(A course on Digital Design and Electronic Devices & Circuits would be helpful)C ProgrammingSheer interest, an innovative brain and perseverance!Background:I started with building a parallel port based robot which could be controlledmanually by a keyboard. On the robot side was an arrangement of relays connected toparallel port pins via opto-couplers.
11
The next version was a true computer controlled line follower. It had sensorsconnected to the status pins of the parallel port. A program running on the computerpolled the status register of the parallel port hundreds of times every second and sentcontrol signals accordingly through the data pins.The drawbacks of using a personal computer were soon clear –It’s difficult to control speed of motorsAs cable length increases signal strength decreases and latency increases.A long multi core cable for parallel data transfer is expensive.The robot is not portable if you use a desktop PC.The obvious next step was to build an onboard control circuit; the options – ahardwired logic circuit or a uC. Since I had no knowledge of uC at that time, Iimplemented a hardwired logic circuit using multiplexers. It basically mapped input fromfour sensors to four outputs for the motor driver according to a truth table. Though itworked fine, it could show no intelligence – like coming back on line after losing it, ordoing something special when say the line ended. To get around this problem and addsome cool features, using a microcontroller was the best option.
The AVR Microcontroller:
“Atmel's AVR® microcontrollers have a RISC core running single cycleinstructions and a well-defined I/O structure that limits the need for externalcomponents. Internal oscillators, timers, UART, SPI, pull-up resistors, pulsewidth modulation, ADC, analog comparator and watch-dog timers are some ofthe features you will find in AVR devices.AVR instructions are tuned to decrease the size of the program whether the codeis written in C or Assembly. With on-chip in-system programmable Flash andEEPROM, the AVR is a perfect choice in order to optimize cost and get product tothe market quickly.”
Apart form this almost all AVRs support In System Programming (ISP) i.e. youcan reprogram it without removing it from the circuit. This comes very handywhen prototyping a design or upgrading a built-up system. Also the programmerused for ISP is easier to build compared to the parallel programmer required formany old uCs. Most AVR chips also support Boot Loaders which take the ideaof In System Programming to a new level. Features like I2C bus interface makeadding external devices a cakewalk. While most popular uCs require at least a fewexternal components like crystal, caps and pull-up resistors, with AVR thenumber can be as low as zero!Cost: AVR = PIC > 8051 (by 8051 I mean the 8051 family)Availability: AVR = PIC <8051Speed: AVR > PIC > 8051Built-in Peripherals: This one is difficult to answer since all uC families offercomparable features in their different chips. For a just comparison, I would rathersay that for a given price AVR = PIC > 8051.Tools and Resources: 8051 has been around from many years now, consequently
12
there are more tools available for working with it. Being a part of manyengineering courses, there is a huge communitiy of people that can help you outwith 8051; same with books and online resources. In spite of being new the AVRhas a neat tool chain (See ‘References and Resources‘). Availability of onlineresources and books is fast increasing.Here, 8051 > AVR = PIC.
3.2 OBJECTIVES OF THE STUDY-
1. The robot must be capable of following a line.
2. It should be capable of taking various degrees of turns
3. It must be prepared of a situation that it runs into a territory which has no line tofollow.
(Barren land syndrome)
4. The robot must also be capable of following a line even if it has breaks.
5. The robot must be insensitive to environmental factors such as lighting and noise.
6. It must allow calibration of the line’s darkness threshold.
7. The robot must be reliable.
8. Scalability must be a primary concern in the design.
9. The color of the line must not be a factor as long as it is darker than the surroundings.
3.3 PRINCIPLE OF OPEREATION
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
13
from the surface and accordingly gives its output to the motors. The output of the sensors
are not directly fed to the motors instead a L293D IC is used in between the sensors
output and motors input. The sensors output is given to the input pin of L293D and the
output pin of IC is connected to the motors. The L293D IC is having two H-bridges
which is capable to rotate motor in bidirectional.
3.4 REQUIREMENT SPECIFICATION
3.4.1 DC GEAR MOTOR:
In our line follower dc gear motors are used.
3.4.2 WHY DC MOTOR?
Easy to control
Require only two signals
For change the direction of rotation just reverse the polarity
Speed can be controlled by the voltage
3.4.3 USE OF GEARS
To provide enough torque.
Increases the torque on the expense of speed.
3.4.4 IR SENSORS:
Sensors are basically electronic devices which are used to sense the changes that occur in
their surroundings. The change may be in color, temperature, moisture, sound, heat etc.
They sense the change and work accordingly. In IR sensor there is emitter and detector.
Emitter emits the IR rays and detector detects it.
The IR sensor basically consists of three components:
IR LED (emitter)14
Photodiode (detector)
Op-Amp
3.4.4.1 IR LED:
Fig. 3.1 IR LED
IR LED is a light emitting diode which emits the 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 is depends
upon the forbidden energy gap. The IR Led has two legs, the leg which is longer is
positive and other leg is negative.15
3.4.4.2 PHOTODIODE:
Fig 3.2 Photodiode
The photodiode is a p-n junction diode which is connected in reverse bias direction. The
basic function of the detector is to convert light into electricity. As its name implies that it
works effectively only when the certain number of photon or certain amount of light falls
on it. When there is no fall of light on the photodiode it has an infinite resistance and act
as a open switch but as the light starts falling on the photodiode, the resistance become
low and when the full intensity of light fall in the photodiode then its resistance becomes
zero and it starts act like a closed switch.
Basically two type of photodiodes:
PIN type – P stand for p-type semiconductor.
I stand for intrinsic semiconductor.
N stand for n-type semiconductor.
Avalanche type
16
3.4.4.3 OPERATIONAL AMPLIFIER:
Op-Amp stands for 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.
Types of Op-amp:
1) General purpose op-amp.
2) Special purpose op-amp.
Fig 3.3 Internal block diagram of LM358IC
17
Fig 3.4 Circuit diagram of IR sensor
Working:
We know that the white surface reflects all the radiations falls on it whereas the black
color absorbs them. When the supply is given to IR sensor, LED starts emitting light
radiations. If the surface is of white color then it reflects all the radiations. As these
radiations starts falling on the photodiode which is connected in reverse bias, the
resistance of the photodiode starts decreasing rapidly and the voltage drop across the
diode also decreases. The voltage at Pin 3 starts increases, as it reaches just beyond the
voltage of Pin 2 the comparator gives high output. In case of the black surface, LED
emits light but it is not reflected by the surface, so the photodiode detects nothing and its
resistance remains infinite. Hence the comparator gives low output.
White surface – Comparator output is high.
Black surface – Comparator output is low.
Sensitivity of IR sensor:
The sensitivity of sensor means that how much effectively the sensor senses the change
that is occurring in its surrounding. The sensitivity of the IR sensor is controlled by
reference voltage at pin 2 using variable resistor.
Large value of reference voltage – less sensitive.
18
Small value of reference voltage – more sensitive.
3.5 MOTOR DRIVER IC (L293D)
L293D IC is a dual H-bridge motor driver IC. One H-bridge is capable to drive a dc
motor in bidirectional. L293D IC is a current enhancing IC as the output from the sensor
is not able to drive motors itself so L293D is used for this purpose. L293D is a 16 pin IC
having two enables pins which should always be remain high to enable both the H-
bridges. L293B is another IC of L293 series having two main differences with L293D.
Difference between L293D and L293B:
1. L293D can run a motor up to 600 mA whereas L293B can run up to 1 A.
2. L293D has protection diode whereas L293B doesn’t have any such protection diode.
Need to add the protection diode manually.
NOT gates are usually used as buffers in the H-bridge to strengthen the signal and also
used as repeaters.
Fig 3.5 Pin diagram of L293D
19
3.5.1 H-BRIDGE MOTOR CONTROL
DC motors are generally bi-directional motors. That is, their direction of rotation can be
changed by just reversing the polarity. But once the motors are fixed, control becomes
tricky. This is done using the H-Bridge. The figure is given below.
A B C D ACTION
1 0 0 1 CLOCKWISE
0 1 1 0 COUNTER-CLOCKWISE
0/1 0/1 1/0 1/0 BRAKE
ANY OTHER STATE FORBIDDEN
Fig 3.6 H-Bridge using transistors
20
3.6 MICROCONTROLLER: AVR ATmega8
What is AVR Microcontroller?
“Atmel's AVR® microcontrollers have a RISC core running single cycleinstructions and a well-defined I/O structure that limits the need for externalcomponents. Internal oscillators, timers, UART, SPI, pull-up resistors, pulsewidth modulation, ADC, analog comparator and watch-dog timers are some ofthe features you will find in AVR devices.AVR instructions are tuned to decrease the size of the program whether the codeis written in C or Assembly. With on-chip in-system programmable Flash andEEPROM, the AVR is a perfect choice in order to optimize cost and get product tothe market quickly.”
Apart from this almost all AVRs support In System Programming (ISP) i.e. youcan reprogram it without removing it from the circuit. This comes very handywhen prototyping a design or upgrading a built-up system. Also the programmerused for ISP is easier to build compared to the parallel programmer required formany old uCs. Most AVR chips also support Boot Loaders which take the ideaof In System Programming to a new level. Features like I2C bus interface makeadding external devices a cakewalk. While most popular uCs require at least a fewexternal components like crystal, caps and pull-up resistors, with AVR thenumber can be as low as zero!
Cost: AVR = PIC > 8051 (by 8051 I mean the 8051 family)
Availability: AVR = PIC <8051
Speed: AVR > PIC > 8051
Built-in Peripherals: This one is difficult to answer since all uC families offercomparable features in their different chips. For a just comparison, I would rathersay that for a given price AVR = PIC > 8051.
Tools and Resources: 8051 has been around from many years now, consequentlythere are more tools available for working with it. Being a part of manyengineering courses, there is a huge community of people that can help you outwith 8051; same with books and online resources. In spite of being new the AVRhas a neat tool chain (See ‘References and Resources‘). Availability of onlineresources and books is fast increasing.
Here, 8051 > AVR = PIC
21
3.7 ATmega8
"ATmega8 is 8-bit microcontroller with 8K bytes In-System programmable Flash"
Advanced RISC Architecture
190 Powerful instructions- Most Single-check Cycle Execution
32x8 General Purpose Working Registers
Up to 16 MIPS throughput at 16 MHz
High Endurance Non-volatile Memory segments
8K bytes of In-system Self- programmable flash program memory
512 Bytes EEPROM
1K byte internal SRAM
Data retention: 20 years at 85 degree C/100 years at 25 degree C
Peripheral features
Two 8-bit timer/counter with separate prescaler, one compare mode
one 16-bit timer/counter with separate prescaler, compare mode, and capture
mode
Real time counter with separate oscillator
Three PWM channels
8-channel ADC in TQFP and QFN/MLF package, eight channels 10-bit accuracy
6-channel ADC in PDIP package. Six channels 10-bit accuracy
Byte-oriented Two wire serial Interface
Programmable Serial USART
Master/slave SPI serial interface
Programmable watchdog timer with separate on-chip oscillator
On-chip Analog comparator
Special Microcontroller Features
Power-on reset and programmable brown out detection
Internal calibrated RC oscillator
External and Internal interrupt sources
22
Five sleep modes: Idle, ADC noise reduction, Power-save, power-down, and
standby.
I/0 and Packages
23 programmable I/O lines
28-lead PDIP,32-lead TQFP, and 32-pad QFN-MLF
Operating Voltages
2.7-5.5v (ATmega8L)
4.5-5.5v (ATmega8)
23
3.8 CODING AND DESIGN:
#define F_CPU 1000000UL // define cpu frequency for delay function
#include <avr/io.h> // includes input/output header file
#include <util/delay.h> // includes delay header file
//#include"lcd.h" //uncomment it if using LCD Display
//#include"lcd.c" //uncomment it if using LCD Display
/* Program for Line follower by Robosapiens India using Atmega8 microcontroller*/
//
*********************************************************************
*********
/* Connection of 3 PIN Sensor PORTs with atmega 8 in Mobi-botricks Kit by
Robosapiens India
PC4 Port is connected with PIN27 of Atmega 8
PC5 Port is connected with PIN28 of Atmega 8
PC3 Port is connected with PIN26 of Atmega 8(DTMF D3 is also sent to this
pin)
PC2 Port is connected with PIN25 of Atmega 8(DTMF D2 is also sent to this
pin)
PC1 Port is connected with PIN24 of Atmega 8(DTMF D1 is also sent to this
pin)
PC0 Port is connected with PIN23 of Atmega 8(DTMF D0 is also sent to this
pin)
PC6 Port is connected with PIN 1(Reset Pin) of Atmega 8
*********************************************************************
**********
26
Connection of L293D IC withatmega 8 in Mobi-botricks Kit by Robosapiens
India
Pin 2(A1) of L293D is Connected with PB2(Pin 16 of Atmega8)
Pin 7(B1) of L293D is Connected with PB3(MOSI)(Pin 17 of Atmega8)
**A1 and B1 are the input pins of Left side H-Bridge of L293D which is driving
the Left Motor
Pin 15 (A2) of L293D is Connected with PB0(Pin 14of Atmega8)
Pin 10 (B2) of L293D is Connected with PB1(Pin 15 of Atmega8)
Pin 1(EN1) and pin 9(EN2) is connected Via motor enable switch.
When we switch on Enable Switch Both EN1 and EN2 are given
5 Volt supply to enable both H-Bridges of L293D
Pin 3 and pin6 of L293D is Connected with Left Motor Connector
Pin 14 and Pin 11 of L293D is connected with Right Motor Connector */
//connect the left sensors on CN3 and right one on CN2
int main(void)
{
DDRB=0b11111111; //PORTB as output Port connected to motors
DDRC=0b0000000; //PORTC Input port connected to Sensors
//lcd_init(LCD_DISP_ON); //uncomment it if using LCD Display
//lcd_puts("Line Follower\n"); //uncomment it if using LCD Display
//lcd_puts("By Robosapiens"); //uncomment it if using LCD Display
intleft_sensor=0, right_sensor=0;
while(1) // infinite loop
{
left_sensor=PINC&0b0010000; // mask PC4 bit of Port C
right_sensor=PINC&0b0100000;// mask PC5 bit of Port C27
if((left_sensor==0b0000000) & (right_sensor==0b0000000)) //if both sensors
"off"
{
PORTB=0b00000000; // stop
}
if((left_sensor==0b0010000) & (right_sensor==0b0100000)) //if both sensors "on"
{
PORTB=0b00001001; // move straight
}
if((left_sensor==0b0000000)&(right_sensor==0b0100000))
{
PORTB=0b00000001; // turn left
}
if((left_sensor==0b0010000)&(right_sensor==0b0000000))
{
PORTB=0b00001000; // turn right
}
28
3.9 APPLICATIONS
• Industrial automated equipment carriers
• Entertainment and small household applications.
• Automated cars.
• Tour guides in museums and other similar applications.
• Second wave robotic reconnaissance operations
3.10 LIMITATIONS
• Choice of line is made in the hardware abstraction and cannot be changed by software.
• Calibration is difficult, and it is not easy to set a perfect value.
• The steering mechanism is not easily implemented in hugevehicles and impossible for
non-electric vehicles (petrolpowered).
• Few curves are not made efficiently, and must be avoided.
• Lack of a four wheel drive, makes it not suitable for a roughterrain.
• Use of IR even though solves a lot of problems pertaining to interference, makes it hard
to debug a faulty sensor.
• Lack of speed control makes the robot unstable at times.
3.11 TESTING
Assumption:
The motors are connected in such a way that both motors will pull the robot forward if
both the sensors are "ON".
In the above arrangement consider the cases
29
Case1: Both sensors are on white surface (i.e. both are giving output as 'high'). In this
case robot will move forward
Case2: Left sensor is on white and right one is on black. In this case robot will take right
turn simply because right motor will stop rotating as both its inputs C and D are low.
Case3: Left sensor is on black and right sensor in on white. In this case our robot will
take left turn as left motor is off because both the inputs A and B are low.
Case4: Both the sensors are on black (i.e. there is a cross or divergence). In this case both
the motors will stop; ultimately the robot will stop at this point.
All the four cases that we have discussed above are the only possible conditions for a line
follower.
30
CHAPTER - 4
CONCLUSION AND FUTURE SCOPE
The Line following robot was finally completed. A lot of effort was put into thedesign,
implementation and days of toil in front of the computer, writing and debuggingthe code.
The robot was finally running with a few glitches here and there which weresorted in the
later revisions of the firmware. The line following robot still has a few shortcomingsbut
achieves most of the objectives.
The robot can be further enhanced to let the user decide whether it is a dark line on a
white background or a white line on a dark background. The robot can also be
programmed to decide what kind of line it is, instead of a user interface. The motor
control could be modified to steer a convectional vehicle, and not require a differential
steering system. The robot could be modified to be a four wheel drive. Extra sensors
could be attached to allow the robot to detect obstacles, and if possible bypass it and get
back to the line. In other words, it must be capable predicting the line beyond the
obstacle. Speed control could also be incorporated. Position and distance sensing devices
could also be built in which can transmit information to a mother station, which would be
useful in tracking a lost carrier.
31