LDR Based Line follower Robot Car using PIC Microcontroller

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.

  1. Sensors  ( made with LDR)
  2. Processor (PIC16F877A)
  3. Motors

LDR Based Line follower Robot Car using PIC Microcontroller

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.

  1. Positive coefficient
  2. 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 :

LDR Based Line follower Robot Car using PIC Microcontroller schematic

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.

 

 

Embedded C Code
// Name : LDR Based Line follower Robot Car using PIC Microcontroller

// Author : Subham Dutta
// Date : 29-08-14
// Website : www.nbcafe.in
void main() {
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

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter