Presented by Rodrigue Tchamna Kang dong-hoon Park jang sung June 2010
Nov 28, 2014
Presented by Rodrigue Tchamna
Kang dong-hoonPark jang sung
June 2010
• 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.
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.
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.
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
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
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)
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
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
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
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
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
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
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
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
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
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;
TRACE HEIGHT
8
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
0000 1111 Go LEFTeft
0110 0111 Go FWD
1110 0000 Go RIGHT
1110 0100 Go FWD
1111 0001 Go RIGHT
1110 0100 Go FWD
1111 0000 Go RIGHT
1110 0101 Go FWD
1111 0110 Go RIGHT
1110 0100 Go FWD
1111 0110 Go RIGHT
1110 0100 Go FWD
1110 0100 Go LEFT
1111 0100 Go FWD
0110 0000 Go LEFT
1011 0111 Go FWD
0000 1111 Go LEFT
0011 0111 Go FWD
0100 1111 Go LEFT
1010 0111 Go FWD
0110 1111 Go LEFT
0110 0111 Go FWD
0110 1111 Go LEFT
0110 0111 Go FWD
0110 0011 Go LEFT
End point
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
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)
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.
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
THANK YOU FOR LISTENING
EXTRACT OF CODE
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
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
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>
• #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
• #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)• {
DDRB=0xff;//motor(PB4->ena_a / PB1->in1 / PB0->in2
PORTD=0xff;DDRD=0x00; // DDR = Data Direction
RegisterTCCR1A=0xA3;TCCR1B=0x02;//8 Busy
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; 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
• 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);• }