Line following robotic vehicle using PIC 16F877A
Line following robotic vehicle
It follow a black line automatically and it also turn it direction according to black line.In this article I have presented you an idea of Liner follower robot. How to make line follower robot using PIC micro controller.
CIRCUIT WORKING OF LINE FOLLOWER ROBOT:
Block diagram of line follower using pic micro controller is shown below. As I have clearly mentioned in block diagram. Two motors are used. One motor is attached with left Side of robot and another motor is attached with right Side of robot. Front wheel of Line follower robot is freely moving wheel. Motor driver IC is used to rotate both motors either clock wise or anti clock wise direction according to turning direction of Line follower robot. L293D motor driver IC is used as a motor driver IC PIC16F877A. Micro controller is used to give control signals to motor driver IC according to sensors output. IR Transmitter Receiver is used to sense black line. In case robot goes off from black line, respective sensor operate and micro controller sense its value and take control control actions by turn motors either clock wise or anti clock wise. Block diagram of line follower robot is shown below :
IR_Black & White Detector SEnsor
I have used 2 sensors in this project. But you can also use more than 2 sensors according to width of black line to get better results of line follower robot..Circuit diagram of single sensor is shown below.
CIRCUIT DIAGRAM OF LINE FOLLOWER ROBOT USING PIC16F877A
Circuit diagram of line follower robot is shown below. here IR sensor Detect the Black & White color And Send information to micro controller it process the data and decide the vehicle is on track or not if it goes out of track then controller motor movement to get back on track
CODING FOR LINE FOLLOWER ROBOT
Code given below is written in MPLAB IDE
// ***********************************************************
// Project: Line following robotic vehicle using PIC 16F877A
// Project: Line following robotic vehicle using PIC 16F877A
// Author: SMart embedded Friends smartembeddedfriend@gmail.com
// Module description:
// ***********************************************************
// ***********************************************************
#include <pic.h>
#define _XTAL_FREQ 4000000
#define IN1 RD0 //Define Motor Connection Pin
#define IN2 RD1
#define IN3 RD3
#define IN4 RD2
#define SR RC6 //right sensor
#define SL RC7 //left sensor
void data_process(); //Function To Process The IR Sensor Data
void delay(unsigned int delay_ms);
bit sl1=0,sr1=0;//Bit Use For Get Car On Track
void main(void)
{
TRISD = 0X00; //CONFIGURING PORT D AS OUTPUT
TRISC = 0XFF; //CONFIGURING PORT C AS INPUT
IN1=0;
IN2=0;
IN3=0;
IN4=0;
delay(100);
while(1)
{
data_process(); //Function To Process The IR Sensor Data
//And Control The Movement Of CAR
}
}
void data_process()
{
if(SR==0 && SL==0)
{
IN1=0;
IN2=1;
IN3=1;
IN4=0;
}
if(SR==0 && SL==1)
{
IN1=0;
IN2=0;
IN3=1;
IN4=0;
sl1=1;
sr1=0;
}
if(SR==1 && SL==0)
{
IN1=0;
IN2=1;
IN3=0;
IN4=0;
sl1=0;
sr1=1;
}
if(SR==1 && SL==1)
{
IN1=0;
IN2=0;
IN3=0;
IN4=0;
delay(1000);
if(sl1==1&&sr1==0)
{
while(SR==1)
{
IN1=0;
IN2=0;
IN3=1;
IN4=0;
}
}
else if(sl1==0 && sr1==1)
{
while(SL==1)
{
IN1=0;
IN2=1;
IN3=0;
IN4=0;
}
}
}
}
void delay(unsigned int delay_ms)
{
unsigned int count,i;
for(count = 0;count<delay_ms;count++)
{
for(i =0;i < 120;i++);
}
delay_ms--;
}
kindly share it with your friends....
To download circuit diagrams of this project click on following link :
No comments:
Post a Comment