By, Priyank Patil Department of Information Technology K. J. Somaiya College of Engineering Mumbai, India
Line Follower
Contents
1. Summary 2. Introduction 2.1. What is a line follower? 2.2. Why build a line follower? 2.3. Background 2.4. Prerequisites 2.5. The AVR microcontroller 3. Overview Block Diagram and Architectural Overview 3.1. 3.2. The Algorithm 4. Implementation 4.1. Sensor Circuit Motor Interface and Control Circuit 4.2. 4.3. Source Code 5. Possible Improvements 6. References and Resources 6.1. Books and Links 6.2. Tools of the trade 6.3. Electronic shops 6.4. Parts and Prices
Page 2 of 17
Line Follower
Summary
The purpose of this document is to help you build a Line Following Robot. Starting with an overview of the system the document would cover implementation details like circuits and algorithms, followed by some suggestions on improving the design. The ‘Reference and Resources’ page has a list of relevant books, websites, electronic shops and commonly used parts & their prices.
Page 3 of 17
Line Follower
Introduction
What is a line follower? 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. Why build a line follower? Sensing a line and maneuvering 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. Prerequisites: Knowledge of basic digital and analog electronics. (A course on Digital Design and Electronic Devices & Circuits would be helpful) C Programming Sheer interest, an
References: and Resources‘). Availability of online resources and books is fast increasing. Here, 8051 > AVR = PIC Page 5 of 17 Line Follower Overview Block Diagram The robot uses IR sensors to sense the line, an array of 8 IR LEDs (Tx) and sensors (Rx), facing the ground has been used in this setup. 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 uC. L4 Left L3 L2 L1 R1 R2 Center Sensor Array R3 R4 Right Starting from the center, the sensors on the left are named L1, L2, L3, L4 and those on the right are named R1, R2, R3, R4. Let us assume that when a sensor is on the line it reads 0 and when it is off the line it reads 1 The uC decides the next move according to the algorithm given below which tries to position the robot such that L1 and R1 both read 0 and the rest read 1. L4 1 Left L1 R1 R2 R3 R4 0 0 1 1 1 Center Right Desired State L1=R1=0, and Rest=1 L3 1 L2 1 Page 6 of 17 Line Follower Algorithm: 1. L= leftmost sensor which reads 0; R= rightmost sensor which reads 0. If no sensor on Left (or Right) is 0 then L (or R) equals 0; Ex: L4 L3 L2 L1 R1 R2 R3 R4 1 0 0 1 1 1 1 1 Left Center Right Here L=3 R=0 L4 1 Left 2. If all sensors read 1 go to step 3, else, If L>R Move Left If Lldev) move(R,0,195+12*rdev); if(rdev