Line Follower Robot
Line Follower Robot
Presented by:
SHAMAIL AHMAD
INTRODUCTION:
The line follower is a self operating robot that detects and follows a line that is drawn on the floor. The path consists of a black line on a white surface (or vice versa). The control system used must sense a line and maneuver the robot to stay on course, while constantly correcting the wrong moves using feedback mechanism, thus forming a simple yet effective closed loop System. The robot is designed to follow very tight curves. Practical applications of a line follower: Automated cars running on roads, guidance system for industrial robots moving on shop floor etc.
SAMPLE PATH:
The path is a black line on a white background with width of 2 cm (except at bends where a little variation may be present).
Robot
Track
BASIC REQUIREMENTS:
The robot has been built using the following components Microcontroller IC-AT 89C52 (24PI) Motor Driver IC-L 293DNE Quad OP-AMP IC- LM 324N Sensor-IR LED & IR PHOTODIODE Voltage Regulator- IC-L7805CV, UA7812C Power Supply-Ni-Cd battery ( 10x1.36V=13.6V) Motor-12V (2) Indicators-LEDs Crystal Osillator-11.0592MHz Musical IC UM-66 19L, Transistor BC 548, Buzzer Resistances, Capacitors, Diodes Varo Board, Switches, IC base, Connectors, Wires, etc. Chassis, Wheel, Free Wheel In addition we have used ARE-LAB microcontroller burner to burn the hex code to the microcontroller and KEIL u vision3 simulator software to generating the hex code from assembly language and Tina8 circuit simulator software to design and testing of circuit.
BASIC OPERATION:
It has infrared sensors on the bottom for detecting black tracking tape. Line position is captured with the help of these optical sensors ( IR LED & IR photodiode pair) mounted at the front end of the robot. when the sensor detect the black surface, output of the comparator, LM324 is low, while for white surface the output is high. It is sent as input to the microcontroller for accurate control and steering of motors. Microcontroller AT89C52 and motor driver L293D are used to drive the motors.
INPUT SYSTEM
PROCESSING SYSTEM
OUTPUT SYSTEM
S E N S O R
COMPARATOR
C O N T R O L L E R
D R I V E R
MOTOR
MOTOR
BLOCK DIAGRAM
IR LED
IR Photodide
Photo has a property that if IR light falls on it its electrical resistance decreases (from say 150k to 10k).For sensing the change in resistance we use voltage divider circuit. Thus we get the variation in voltage, which is sensed by the comparator IC LM324.The comparator then gives logical high or low according to input.
Comparator:
Comparator is a device which compare two input voltages and gives output as high or low. In a circuit diagram it is normally represented by a triangle having inverting (-ve input),non inverting(+ input) ,Vcc, Ground, output.
Properties of comparator:
Use of comparator in IR sensor The two inputs of comparator are use to compare the voltages of photodiode at dark or light condition .One input is from photodiode and other is generated by using potentiometer(preset). The second voltage is also called as reference voltage for that sensor.
Calculations:
Transmitter: V=1.2v, I=12mA, so R= (5-1.2)/12=316; Taken R=330 Receiver: V=2.5v, I=200uA, so R=(5-2.5)/200=12.5K: Taken R=10K Tested Value of IR photodiode: Vp(dark)=4.68v, Vp(light)=2.5v [measured] So the reference voltage Vref=Vp(dark)+Vp(light)/2=(4.67+2.5)/2=3.58v So, Rref=(5-3.58)/100uA=14.2K ; Taken Rref=20K (0-20K preset)
Arrangement of sensors
We have arranged sensors in a straight row pattern which is bolted under the front of the robot. It is used to locate the position of the line below the robot. We have used four sensor but we can use any number of sensors. If we have lesser number of sensors then the robot movement will not be smooth and it may face problems at sharp turns. If we use higher number of sensors robot movement will become smooth and reliable for sharp turn. Thus we must choose optimum number of sensors. The distance between sensors depends on 1. 2. 3. Number of sensors used Width of straight line. Distance between sensors cannot be constant (it depends on the logic).
PROCESSING SYSTEM:
Processing system acts as the Brain of the robot, which generates desired output for corresponding inputs. For that we use microcontrollers. We have used AT89C52-24PI microcontroller of Atmel in our robot. It is 8-bit microcontroller with 8K bytes flash.
Program Memory Size=8KB RAM Size=256B Voltage - Supply (Vcc/Vdd)=4 V ~ 6 V Output Current=15mA I/O=32 (4 ports) Clock speed=24 MHz( used 11.0592 MHz) Access time=24us
OUTPUT SYSTEM:
We have used the motor driver IC L293DNE to drive the two motors in both directions.
INR2 OUTR2
OUTL2 INL2
OUTR1 INR1
There are separate four drivers in this IC which can drive four separate motors in one direction or two motors in both the directions.
One channel can control one motor. Enable pin should be high for activating the corresponding channel. Input 1 corresponds to Output 1. If Enable pin low, the output will always be 0. If it is high output depends
on input.
L 293D
ENL
+5V
INL1 OUTL1
INR2
OUTR2
+ ML -
+ MR -
OUTL2 INL2
+12V
Supply voltage (Vss) is the Voltage at which we wish to drive the motor.
Generally we prefer 6V for dc motor and 6 to 12V for gear motor, depending upon the rating of the motor. Logical Supply Voltage will decide what value of input voltage should be considered as high or low .So if we set Logical Supply Voltage equal to +5V,then -0.3V to 1.5V will be considered as Input Low Voltage and 2.3 V to 5V will be considered as Input High Voltage. L293D has 2 Channels .One channel is used for one motor. Left Channel - Pin 1 to 8 Right Channel - Pin 9 to 16
ML MR MOVE
Forward
1 0 1 1 1 1
1 X 1 0 1 0
0 X 0 1 0 1
1 1 0 1 1 1
1 1 X 1 0 0
0 0 X 0 1 1
1 0 1 0 1 0
0 0 0 1 0 1
1 1 0 1 0 0
0 0 0 0 1 1
Left
Right Sharp_Left Sharp_Right Reverse
INPUT (SENSOR) TO OUTPUT (MOTOR) LOGIC: SENSOR STATE SEN1 SEN2 SEN3 0 0 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 SEN4 0 1 0 1 1 1 0 1 1 ROBOT MOVE FORWARD FORWARD LEFT LEFT RIGHT RIGHT SHARP LEFT SHARP RIGHT REVERSE
Robot on track:
By using the two motors we drive the robot in any direction.
TRACK
1 1
SENSORS
WHEEL
Motors:
We have used two 12V, 100mA DC gear motor to drive the robot. DC motors are most easy to control. One motor requires only two signals for its operations. If we want to change its direction just reverse the polarity of the power supply across it. We can vary the speed by varying the voltage across the motor. The gears used to increase the torque of the DC motor on the expense of it speed.
Mathematical interpretation:
The Rotational Power (Pr) of motor is given byPr= Torque(T) * Rotational Speed(w) Thus, T=Pr/w Since the Pr is constant for DC motors with constant input electrical power.So, T 1/w Thus to increase the value of torque we have to sacrifice speed.
7805 Output Voltage=+5V (4.8-5.2V) Output Current=Internally limited Input Voltage=+35V (maximum)
IN 4007
7812
+12V 7805
I/P
1k
+5V
LED
MUSIC:
We have used melody generator IC UM-66 to generate melody for 5 seconds
FEATURES
*64-Note Rom memory *1.5V ~ 4.5V power supply *60uA current required. *Dynamic speaker can be driven with external NPN transistor *Power on reset: melody begins from the first note
+5V
UM66 2 10K 1
3 BC548 1K
SOFTWARE:
Based on the above developed logic we have written the following program in assembly language. We have used notepad of windows OS to edit the program.
ENL EQU P3.0 ENR EQU P3.3 INL1 EQU P3.1 INL2 EQU P3.2 INR1 EQU P3.4 EQU P3.5 ORG 0000H SETB P1.1 CLR P1.2 SJMP MAIN ORG 0030H MAIN: CLR P1.0 CLR P1.1 HERE: JNB P1.1, HERE SETB P1.0 SETB P1.2 CLR P1.1 ACALL WAIT CLR P1.2 SJMP START ORG 0080H START: MOV P0,#0FFH MOV A,P0 ANL A,#0FH SUBB A,#00H JZ FORWARD MOV A,P0 ANL A,#0FH SUBB A,#01H JZ SHARP_LEFT MOV A,P0 ANL A,#0FH SUBB A,#03H JZ LEFT
MOV A,P0 ANL A,#0FH SUBB A,#08H JZ SHARP_RIGHT MOV A,P0 ANL A,#0FH SUBB A,#09H JZ FORWARD MOV A,P0 ANL A,#0FH SUBB A,#0BH JZ LEFT MOV A,P0 ANL A,#0FH SUBB A,#0CH JZ RIGHT MOV A,P0 ANL A,#0FH SUBB A,#0DH JZ RIGHT MOV A,P0 ANL A,#0FH SUBB A,#0FH JZ REVERSE LJMP START
FORWARD: ACALL DELAY SETB ENL SETB ENR SETB INL1 CLR INL2 SETB INR1 CLR INR2 LJMP START
RIGHT: ACALL DELAY CLR ENR SETB ENL SETB INL1 CLR INL2 LJMP START
LEFT: ACALL DELAY CLR ENL SETB ENR SETB INR1 CLR INR2 LJMP START
SHARP_RIGHT: ACALL DELAY SETB ENL SETB ENR SETB INL1 CLR INL2 CLR INR1 SETB INR2 LJMP START SHAPR_LEFT: ACALL DELAY SETB ENL SETB ENR CLR INL1 SETB INL2 SETB INR1 CLR INR2 REVERSE: ACALL DELAY SETB ENL SETB ENR SETB INL2 CLR INL1 SETB INR2 CLR INR1 LJMP START WAIT: MOV R7,#0FFH MOV R6,#0FFH MOV R5,#00FH LOOP5S: DJNZ R7,LOOP5S MOV R7,#0FFH DJNZ R6,LOOP5S MOV R6,#0FFH DJNZ R5,LOOP5S RET DELAY: MOV R3,#0FFH MOV R4,#006H LOOP: DJNZ R3,LOOP MOV R3,#0FFH DJNZ R4,LOOP RET
END
SIMULATION:
We have used the KEIL u vision3 simulator software for simulating and generating the hex code to load into the microcontroller.
BURNER
We have used the ARE-LAB Atmel microcontroller burner to burn the hex code into the microcontroller.
CONCLUSION:
The robot that we have designed are working properly. We have also calculated its speed. It is near about 8 Km/hr. It consumes around 4 watt of power.
APPLICATIONS:
1. It can be used in industries to carry raw materials and goods. 2. It can be used in those places where the life of a human being are in danger. 3. It can be automatic metro railways. 4. It can be used as an entertaining element (toy) by small child. 5. Since it the basic level of robot it will help us to develop an advanced stage of robot. Also it will help us to understand the basic concept of electronics and microcontroller.
FURTHER IMPROVEMENTS:
A number of improvements can be easily done by increasing the number of sensors. 1. 2. 3. 4. The movement will become more smooth. It will also be able to detect the obstacles that comes in its path. At sharp turn it will not face any problem. Even on thin track it will run smoothly.
REFERENCES:
1. The 8051 Microcontroller and Embedded systems book by MA MAZIDI, JG MAZIDI, RD MCKINLAY. Electronics for you magazine. 3.Websites:
4.Data sheets of various components like AT89C52, L293D, LM324,UM66, BC 548, IR LED ,IR PHOTODIODE, 7805, 7812 etc.