Summary of LDR Based Line follower Robot Car using PIC Microcontroller
This project describes an LDR-based line follower robot car utilizing a PIC16F877A microcontroller. The system relies on three main units: LDR sensors to detect light reflection differences between black and white surfaces, the microcontroller to process sensor data, and two motors to control wheel movement. The logic dictates that when a sensor detects a black line (low resistance), the corresponding motor reverses direction while the other continues forward, allowing the car to steer back onto the path.
Parts used in LDR Based Line follower Robot Car using PIC Microcontroller:
- LDR Sensors
- PIC16F877A Microcontroller
- Two Motors
- Circuit Board/Chassis (implied for mounting)
- MiKroc Pro Software
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.
Project description:
In this project “LDR Based Line follower Robot Car using PIC Microcontroller”, mainly three units are used.
- Sensors ( made with LDR)
- Processor (PIC16F877A)
- Motors
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.
Sensors:
Here I used LDR for sensing the variation of light which is come reflect back from floor. As we know LDR ( Light Dependent Register) has basic two property.
- 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.
Processor :
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.
Motors :
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.
Here you find the complete C Code written in MiKroc pro for Pic.
// Author : Subham Dutta
// Date : 29-08-14
// Website : www.nbcafe.in
trisc =0b11000000;
portc=0;
trisb = 0;
portb = 0;
while (1)
{
if ( portc == 0b11000000)
{
portb = 0b01100101;
}
if ( portc == 0b10000000)
{
portb = 0b01100110;
}if ( portc == 0b01000000)
{
portb = 0b10100101;
}}
}
Source : LDR Based Line follower Robot Car using PIC Microcontroller
-
How does the robot car follow the line?
The car follows the line by processing data from sensors via the microcontroller to control motor rotation directions based on detected color changes. -
How do the sensors sense the black or white line?
Sensors use LDRs to detect light reflection; white reflects all light while black absorbs most light, causing resistance changes in the LDR. -
What is the working principle of the LDR used in this project?
LDRs have positive or negative coefficients where resistance increases or decreases respectively when light falls on them, depending on the selected type. -
Which microcontroller is used to process the sensor data?
The PIC16F877A microcontroller is used because it is cheap, readily available, and processes data to control motor direction. -
How are the motors controlled to change the car's direction?
If a sensor touches a black line, its output changes, causing one motor to rotate in reverse while the other continues forward to turn the car. -
What software was used to write the C code for this project?
The complete C code for this project was written using MiKroc pro for Pic. -
Why are two different motors used in this robot car?
Two different motors are used for different wheels to control movement and maintain direction effectively.


