Here I give you description of my project “LDR Based Line follower Robot Car using PIC Microcontroller”. This project is very interesting and the concept implementing for making this project is also very interesting.
In this project “LDR Based Line follower Robot Car using PIC Microcontroller”, mainly three units are used.
Now to know the working principal of above mention units we have to clear some basic question which every time come in our mind.
How Robot Car follow the line?
How sensors sense the black or white line?
For getting this answer we have to know more about the Sensors used and the working principal of those sensors.
- Positive coefficient
- Negative coefficient
Positive coefficient LDR means when light fall on the LDR, Resistance of LDR is increased. And negative coefficient LDR means when light fall on the LDR, Resistance of LDR is decreased. Now we have to select LDR as per our need.
Now question how it differentiates the black and white line?
As we know the property of colers that white colour reflects all light fallen on it. But black colour absorbed most of all light fallen on it.
So if this sensor fallows the black line then if any change of colour the sensor generates output accordingly and farther we have to process this data and control the motors rotation accordingly.
Here I used PIC16F877A microcontroller which process the data feed from sensor and control the direction of rotation of motor to move the car. PIC16F877A is cheap in cost and readily available in market.
Here in this project “LDR Based Line follower Robot Car using PIC Microcontroller” , I used two different Motors for different wheels for controlling the movement and maintaining the direction. In bellow diagram described how the direction of rotation control accordingly sensors output.
In first two cases both motor are rotate same direction so the car move forward by straight line but in next two case sensor 2 touch the black line so the output of sensor 2 is changed and the motor 2 start rotating reverse direction but motor 1 rotate in earlier direction so car will move to left until the sensor 2 touch white line again.
In this way the Robot car follow the line and move forward. See the diagram of hardware arrangement in bellow
And bellow I just give you the circuit Diagram of that project “LDR Based Line follower Robot Car using PIC Microcontroller”
Here you find the complete C Code written in MiKroc pro for Pic.
// Author : Subham Dutta
// Date : 29-08-14
// Website : www.nbcafe.in
trisb = 0;
portb = 0;
if ( portc == 0b11000000)
portb = 0b01100101;
if ( portc == 0b10000000)
portb = 0b01100110;
}if ( portc == 0b01000000)
portb = 0b10100101;