Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PID Line Follower Robot, using PIC

Status
Not open for further replies.

metal

Full Member level 6
Joined
Dec 21, 2004
Messages
364
Helped
19
Reputation
38
Reaction score
6
Trophy points
1,298
Activity points
3,834
line follower robot

Hello

How can I use PID control algorithm to build a line following robot using three infra-red sensors placed on "Right - Middle - Left", and using PICBasic Pro.

I still can't find how to translate a PID control algorithm to control the robot, the robot has two rear motors to control movement and directions. I even can't find the algorithm it self.

I think PID control algorithm has to read the three sensors outputs "Low or High" and decide the feedback and movement direction the robot shall have.

From what I read, people who succeeded doing this, will keep it as secret for their own, but I still have some hope of finding people who can help. I have found some toopics, but unfortunatelly, they are all trash.

I want to use PID control algorithm, because of the stability issues it solves, and to enable the following of more complicated line shapes.

Kind day
 

line following robot

Go to this link

and download the attachment posted by me.
 

line following robot algorithm

No PID algo was used in the document recommended by feiutm9898. However, in my opinion, we do not need PID controller for line follower... ON-OFF control or Bang-Bang control will do...
 

pid line follower

Hello

I need what I asked for above, I know all these ways, I neeeeeed PID.
 

pid line following

You can use Hardware perform the PID
 

pid line following robot

I have the same question.. Could anybody show an example of PID algorithm for line follower, like metal wrote .. ?
 

line follower pid

Very good. PID controlled line follower run very nice and not move zigzag at all as bang bang control does.

I make many bang bang line follower but because of zigzag speed very slow and I cannot come first prize. Usually 2 of 3rd prize.

I try PID but tuning very difficult and my PIC program hard to do floating point.

1st prize winner always use PID but not tell details.

Didi tell me also use fan.
 

the logic is,, if u notice a change in line alignment then check ur speed if its too high make a sharp turn, if its too low then take a smooth turn

by the time u make a turn ur speed would have reduced withour your knowing, this is where ur feedback has to be manipulted and proccessed~

Also try to place the sensor as close as possible to the wheels!


Although this concept was made up by me, it can work~
 

here goes

float kp=2,kd=3,ki=4,prop=0,deriv=0,integ=0,control=0;
int difflast=0,diff=0,rate=0,pos=0;
int con=0;


con=porta&00000111;
switch(con)
{
case 100: pos=-2; break;
case 110: pos=-1; break;
case 10: pos=0; break;
case 11: pos=1; break;
case 1: pos=2; break;
case 0: pos=(pos>0)?(3):(-3);pos=(pos==0)?(0):(pos); break;
}
diff=pos;
rate=diff-difflast;
difflast=diff;
prop=kp*diff;
deriv=kd*rate;
integ+=ki*diff;

out<<"Last control ="<<control;
control=prop+deriv+integ;
out<<"New control ="<<control;

use control value
 
  • Like
Reactions: essi67

    essi67

    Points: 2
    Helpful Answer Positive Rating
HI
i'm a beginner and i should make a line follower with PID using PIC .
and thank you for your information but how i can use control value in PIC ?
 

what sensors are you using for detecting the line? it would be best if you could use some self-illuminating sensors.
A good line follower will not just read light and dark... you can have it correct itself before it is even a millimeter off of the line.
upon startup take a reading from the center. use this as a reference value.
then keep track of all three values from the sensors.

for integral just use a summing. Once you have a 'zero-crossing', meaning once you know you are back on the line, then just rezero your integral.
for proportional, that should be obvious...
for differential just take the difference from the last reading.

create a total for error and use this value as a feedback.

I would start off by using zero as a differential and try some proportional and intergral.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top