30-01-2013, 11:12 AM
Line Following Robot
Line Following.docx (Size: 4.18 MB / Downloads: 30)
INTRODUCTION
The line following robot, operates as the name specifies. It is programmed to follow a black line on a white background and detect turns or deviations and modify the motors movements appropriately. It consists of two light sensors, comparators, microcontroller, motor driver and two motors. We have used phototransistor (LDR) as the sensor. The core of the robot is the AT89C51 microcontroller. Here it acts as a decision making device. It consists of two dc motors and driver IC to steer it. The differential steering system is used to turn the robot. In this system, each front wheel has a dedicated motor while the back wheel is free to rotate. To move in a straight line, both the motors are to be rotated at same speed. To manage a turn to left, left motor is programmed to move in reverse and right motor is programmed to move in forward direction at the same speed (rev/sec). Similarly to manage a turn to right, right motor and left motors are programmed to move in reverse and in forward respectively at same speed (rev/sec). The main operation of the line following robot is done in three simple steps.
Principle of Operation
We have used two sensors, one for left sensors and other for right sensors. We have used black line on a white surface as our path. These two sensors are placed in front of the robot facing the path. When the sensor gets above the white surface, it gets into saturation as white surface reflects almost all the light falling on it and gives low voltage to the operational amplifier (comparator). When the sensor is above the black surface, it remains cut-off as black surface absorbs almost all the light falling on it and gives high voltage to the operational amplifier (comparator). The output from the sensors is fed to the comparator. The comparator compares it with the fixed reference voltage and provides binary voltage suitable for microcontroller. The reference voltage can be set by using the pot. Here the microcontroller acts as the decision making device. The microcontroller is programmed such that when the sensor is above the white surface, it drives the motor in forward direction and when one of the sensors is above the black surface, it drives one of the motors in reverse direction. Since the current provided by the microcontroller is not sufficient to drive the motor we need a motor driver. The motor driver takes the input from the microcontroller and provides the sufficient current to drive the motor.
Block Diagram Description
Sensors
The sensors that we have used are the two phototransistors LDR. As the name indicates it detects light and works accordingly. So what happens in our project is that the LDR senses the light that is reflected or absorbed by the path. First both the sensors are on white surface so both the sensors are saturated. This gives low output to the inverting terminal of the comparator. Similarly when one of the sensor is in black surface say (left sensor) then the output is received by the comparator is high.
Comparator (LM324)
The main job of the comparator is to compare the output of the two sensors with the reference voltage that we can define just by setting the pot. The outputs of the sensors are connected to the inverting terminal of the comparator so when the comparator receives high output from the sensor it gives logic low signal to the microcontroller for further processing. Similarly when the sensor gives low output to the comparator it gives high output to the microcontroller. Then after receiving the signals the microcontroller does its processing according to the coding that we have done.
Microcontroller (AT89S52)
The microcontroller is the central decision making device. The P3.0 and P3.1 ports are used as inputs from the comparator and the ports P2.0, P2.1, P2.2, and P2.3 are the output ports. As mentioned earlier as the microcontroller gets the logic low and high signal from the comparator it computes the signal and sends appropriate signal to the motor driver to control the motor either to turn left or to turn right. So this is the only function that the microcontroller does in this project.
Motor Driver (L293D)
Motor driver is simply used to drive the motor according to the signal received from the microcontroller. As the current received from the microcontroller is not sufficient to drive the dc motors we have used the motor driver. The input supplies we provide are simply redirected to the motors through the driver with sufficient voltage and current for safe performance. As the name indicates it is a driver to drive the motors. This prevents the microcontroller from exerting excessive current which might damage the microcontroller.
Circuit Diagram and Description
Circuit Description
The figure 2.2 shows the automated circuit for our line follower robot. At the starting point both the LDRs are on white surface so the both receive the reflected light from the surface and goes into saturation. The collectors of the LDR are connected to the inverting terminal of the operational amplifier A2 and A1. The signal voltage from them is compared in the operational amplifier with a fixed reference voltage which is set using the 10K pot and 5.6K resistor. The fixed reference voltage is connected to the non inverting terminal of the comparator.
Say when left LDR is in black surface it remains off and high output is received through collector as black surface absorbs all the light from the white LED. As the inverting input of operational amplifier is higher than the reference voltage so amplifier output at pin 7 is zero.
Working
Figure 4 shows the path of line following robot. Where ‘L’ represents the left sensor and ‘R’ represents the right sensor. The points ‘A’, ‘B’, ‘C’ and ‘D’ represents the position of the robot.
At the start when the robot is at the point ‘A’, left sensor (T1) and right sensor (T2) are above the white surface and port3.0 and port3.1 of the microcontroller receives logic ‘1’. As a result the robot moves forward in straight direction.
At point ‘B’ a left turn is encountered. At this point the left sensor (T1) is above the black surface and right sensor (T2) is above the white surface. Then port3.0 and port3.1 of the microcontroller receive logic ‘0’ and logic ‘1’ respectively. As a result the left wheel is moved in reversed direction and the right wheel is moved in forward direction. Hence the robot turns to left.
At point ‘C’ a right turn is encountered. At this point the right sensor (T2) is above the black surface and left sensor (T1) is above the white surface. Then port3.0 and port3.1 of the microcontroller receive logic ‘1’ and logic ‘0’ respectively. As a result the right wheel is moved in reversed direction and the left wheel is moved in forward direction. Hence the robot turns to right.
At the point ‘D’, both the sensors T1 and T2 are above the white surface and port3.0 and port3.1 of the microcontroller receive logic ‘1’. As a result the robot moves forward in straight direction.