line following robot 2
TRANSCRIPT
![Page 1: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/1.jpg)
Presented by Rodrigue Tchamna
Kang dong-hoonPark jang sung
June 2010
![Page 2: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/2.jpg)
• 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 maneuvering the robot to stay on course, while constantly correcting wrong moves using feedback mechanism forms a simple yet effective closed loop system.
![Page 3: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/3.jpg)
APPLICATIONS OF A LINE FOLLOWER Automated cars running on roads with embedded magnets; guidance system for industrial robots moving on shop floor
deliver mail within an office building and deliver medications in a hospital.
Tour guides in museums and other similar applications.
following a line in a warehouse (to distribute goods)
the technology has been suggested for running buses and other mass transit systems, and may end up as part of autonomous cars navigating the freeway.Tour guides in museums and other similar applications.
![Page 4: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/4.jpg)
OBJECTIVES OF A LINE FOLLOWERFollow any complex black curves It should be capable of taking various degrees of
turnsThe robot must also be capable of following a line
even if it has breaks. The robot must be insensitive to environmental
factors such as lighting and noise.Stop and reverse if the line disappearsStop if an obstacle is presentSo the robot will also need its own illumination
source. The weapon here will is to use Infra Red (IR) light.
![Page 5: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/5.jpg)
THE BLOCK DIAGRAM
PIC 16F873Microcontroller
H - BridgeDC Motor Control
LeftMotor
Right Motor
Clock6 MHz Main Power
Supply
Motor Power Supply
HEX Inverter
Sensor Array
Analog Comparators
Threshold Voltage
![Page 6: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/6.jpg)
PIN CONFIGURATION OF THE MICROCONCONTROLLER
IN1 IN2 IN3 IN4 OPERATION
0 1 1 0 BOTH MOTORS FORWARD(MOVE FORWARD)
1 0 0 1 BOTH MOTORS BACKWARD(MOVE BACKWARD)
0 1 0 0 RIGHT MOTOR BACKWARDLEFT MOTOR FORWARD
(TURN RIGHT)
0 0 1 0 RIGHT MOTOR FORWARDLEFT MOTOR BACKWARD
(TURN LEFT)
1 1 1 1 FULL STOP
![Page 7: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/7.jpg)
CIRCUIT
The resistance of the sensor decreases when IR light falls on it. A good sensor will have near zero resistance in presence of light and a very large resistance in absence of light.
The potential at point ‘2’ is proportional toRsensor / (Rsensor + R1).
Again, a good sensor circuit should give maximum change in potential at point ‘2’ for no-light and bright-light conditions.
However, it would be nice if the signal that we get could be TTL (on or off, 0V, 5V). So to do this one need a comparator
Normally, all we need in order to track a black line on a white surface is Light Emitting Diode (Emitter) and Photo Diode (Receiver Sensor)
![Page 8: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/8.jpg)
ALGORITHM
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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 1 0 0 1 1 1left Right
CenterL=1 and R = 1 L=R so go straight forward
The two Center sensors that track the line
Assumption: The width of the track is at least the distance between 2 subsequent sensors
The algorithm tries to position the robot such that L1 and R1 both read 0 and the rest read 1.
LEDPhoto diode sensor
8 4 2 1 8 4 2 1
=0xE7
9 ,A, B, C, D, E, F10
11
12
13
14
15
![Page 9: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/9.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 0 0 1 1 1 1left Right
CenterL=2 and R = 0 L>R so turn left
The two Center sensors that track the line
LEDPhoto diode sensor
9 ,A, B, C, D, E, F10
11
12
13
14
15
=0xCF
8 4 2 1 8 4 2 1
=0x9F
![Page 10: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/10.jpg)
ALGORITHM
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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 1 0 0 1 1 1left Right
CenterL=1 and R = 1 L=R so go straight forward
The two Center sensors that track the line
Assumption: The width of the track is at least the distance between 2 subsequent sensors
The algorithm tries to position the robot such that L1 and R1 both read 0 and the rest read 1.
LEDPhoto diode sensor
![Page 11: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/11.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 0 0 1 1 1 1left Right
CenterL=2 and R = 0 L>R so turn left
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 12: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/12.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 0 0 1 1 1 1 1left Right
CenterL=3 and R = 0 L>R so turn left
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 13: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/13.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 1 1 0 0 0 1left Right
CenterL=0 and R = 3 R>L so turn Right
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 14: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/14.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 1 0 0 0 0 1left Right
CenterL=1 and R = 3 R>L so go straight forward
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 15: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/15.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 0 0 0 0 1 1 1left Right
CenterL=3 and R = 1; L>R so Go LEFTeft
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 16: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/16.jpg)
ALGORITHML= 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;
L4
L3
L2
L1
R1
R2
R3
R4
1 0 0 0 0 0 0 1left Right
CenterL=3 and R = 3 L=R so go straight forward
The two Center sensors that track the line
LEDPhoto diode sensor
![Page 17: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/17.jpg)
2. If all sensors read 1 go to step 3,else,If L>R Move LeftIf L<R Move RightIf L=R Move ForwardGoto step 4
3. Move Clockwise if line was last seen on Right Move Counter Clockwise if line was last seen on Left Repeat step 3 till line is found.
4. Goto step 1.
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;
![Page 18: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/18.jpg)
TRACE HEIGHT
8
![Page 19: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/19.jpg)
LEDPhoto diode sensor
0110 0111
RememberThe motor moves only when the LED’s light (white color) hits the black track and light is reflected back to the photo diode sensor
Starting point
FWD = Forward
L = Left
R= Right
Go FWD
![Page 20: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/20.jpg)
0000 1111 Go LEFTeft
![Page 21: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/21.jpg)
0110 0111 Go FWD
![Page 22: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/22.jpg)
1110 0000 Go RIGHT
![Page 23: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/23.jpg)
1110 0100 Go FWD
![Page 24: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/24.jpg)
1111 0001 Go RIGHT
![Page 25: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/25.jpg)
1110 0100 Go FWD
![Page 26: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/26.jpg)
1111 0000 Go RIGHT
![Page 27: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/27.jpg)
1110 0101 Go FWD
![Page 28: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/28.jpg)
1111 0110 Go RIGHT
![Page 29: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/29.jpg)
1110 0100 Go FWD
![Page 30: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/30.jpg)
1111 0110 Go RIGHT
![Page 31: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/31.jpg)
1110 0100 Go FWD
![Page 32: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/32.jpg)
1110 0100 Go LEFT
![Page 33: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/33.jpg)
1111 0100 Go FWD
![Page 34: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/34.jpg)
0110 0000 Go LEFT
![Page 35: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/35.jpg)
1011 0111 Go FWD
![Page 36: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/36.jpg)
0000 1111 Go LEFT
![Page 37: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/37.jpg)
0011 0111 Go FWD
![Page 38: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/38.jpg)
0100 1111 Go LEFT
![Page 39: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/39.jpg)
1010 0111 Go FWD
![Page 40: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/40.jpg)
0110 1111 Go LEFT
![Page 41: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/41.jpg)
0110 0111 Go FWD
![Page 42: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/42.jpg)
0110 1111 Go LEFT
![Page 43: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/43.jpg)
0110 0111 Go FWD
![Page 44: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/44.jpg)
0110 0011 Go LEFT
End point
![Page 45: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/45.jpg)
0110 0111 FwD0000 1111 Left1111 0100 Left1100 0100 FwD0110 0000 Left1011 0111 FwD0000 1111 Left0011 0111 FwD0100 1111 Left1010 0111 FwD0110 1111 Left0110 0111 FwD0110 1111 Left0110 0111 FwD0110 0011 Left
So Finally
0110 0111 FwD1110 0000 Right1110 0100 FwD1111 0001 Right1110 0100 FwD1111 0000 Right1110 0101 FwD1111 0110 Right1110 0100 FwD1111 0110 Right1110 0100 FwD
![Page 46: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/46.jpg)
FWD0110 0111 1110 0100 1110 0101 1100 0100 1011 01110011 0111 1010 0111
Left0000 1111 1111 0100 0110 00000100 1111 0110 1111 0110 0011
Right1110 0000 1111 0001 1111 0000 1111 0110
Left = 0x (0F, F4, 60, 4F, 6F, 63)
FWD= 0x (67, E4, E5, C4, B7, 37, A7)
After reduction,
Right= 0x (E0, F1, F0, F6)
![Page 47: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/47.jpg)
LIMITATIONS• The width of line to track depends on the disposition
and distance between the sensors array and cannot be changed by software.
• Thin curves are not tracked efficiently, and must be avoided.
![Page 48: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/48.jpg)
RESULT AND CONCLUSIONThe Robot could Follow any complex black curves, with various degrees of turnsThe robot was insensitive to environmental factors such as lighting and noise.It could Stop and reverse when line disappears
![Page 49: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/49.jpg)
THANK YOU FOR LISTENING
![Page 50: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/50.jpg)
EXTRACT OF CODE
![Page 51: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/51.jpg)
while (1){if(PIND!=0xff)
{rotpow=255;ldev=rdev=0;
if(PD3==0)rdev=1;if(PD2==0)rdev=2;if(PD1==0)rdev=3;if(PD0==0)rdev=4;
if(PD4==0)ldev=1;if(PD5==0)ldev=2;if(PD6==0)ldev=3;if(PD7==0)ldev=4;
L4
L3
L2
L1
R1
R2
R3
R4
1 1 1 0 1 1 1 1
PD0PD1PD2PD3PD4PD5PD6PD7
![Page 52: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/52.jpg)
if(rdev>ldev)move(R,0,Speed1);if(rdev<ldev)move(L,0,Speed2);if(rdev==ldev)move(FWD,0,speed_FWD);
}
}; //End While
} //End Main
![Page 53: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/53.jpg)
![Page 54: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/54.jpg)
CODE• //PORTB=0x39; stop• //PORTB=0x18; straight• //PORTB=0x10;Left• //PORTB=0x08; Right• // PORTB=0x21; Reverse
• #include <avr/io.h>• #include <avr/interrupt.h>• #include <util/delay.h>
![Page 55: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/55.jpg)
• #define FWD 0x18• #define REV 0x21• #define R 0x08• #define L 0x10• #define STOP 0x39
• #define CW 0x99• #define CCW 0x66
• #define SPEED0 255• #define SPEED1 0• #define SPEED2 0• #define SPEED3 0
![Page 56: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/56.jpg)
• #define MAX 3• #define HMAX 1
• void move (unsigned char dir,unsigned char delay,unsigned char power);
• unsigned int Speed1=1000, Speed2=1000 ,speed_FWD=2000;
• unsigned char i,rdev,ldev,ip,delay,dir,power,dirl,history[MAX],hcount=0,rotpow;
• int main(void)• {
![Page 57: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/57.jpg)
DDRB=0xff;//motor(PB4->ena_a / PB1->in1 / PB0->in2
PORTD=0xff;DDRD=0x00; // DDR = Data Direction
RegisterTCCR1A=0xA3;TCCR1B=0x02;//8 Busy
![Page 58: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/58.jpg)
while (1) { if(PIND!=0xff) { rotpow=255; ldev=rdev=0; if(PD3==0) rdev=1; if(PD2==0) rdev=2; if(PD1==0) rdev=3; if(PD0==0) rdev=4;
![Page 59: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/59.jpg)
if(PD4==0) ldev=1; if(PD5==0) ldev=2; if(PD6==0) ldev=3; if(PD7==0) ldev=4; if(rdev>ldev) move(R,0,Speed1); if(rdev<ldev) move(L,0,Speed2); if(rdev==ldev) move(FWD,0,speed_FWD); //_delay_ms(100); //sleep(10); }
else { for(i=0,dirl=0;i<MAX;i++) { if(history[i]==L) {dirl++;} }
if(rotpow<160) {rotpow=160;} if(rotpow<255) {rotpow++;} if(dirl>HMAX){move(CW,0,rotpow);} else{move(CCW,0,rotpow);} } OCR1A = Speed1; OCR1B = Speed2; }; //End While
} //End Main
![Page 60: Line Following rOBOT 2](https://reader031.vdocuments.mx/reader031/viewer/2022013102/547766f4b4af9f9e488b4579/html5/thumbnails/60.jpg)
• void move (unsigned char dir,unsigned char delay,unsigned char power) • {• PORTB=dir;• //Speed1=power;• //Speed2=power;• if(dir==L || dir==R) • {• hcount=(hcount+1)%MAX;• history[hcount]=dir;• }• //LSPEED=RSPEED=2000;//power• Speed1=Speed2=2000;• speed_FWD=2000;• //delay_ms(delay);• }