PID Based Line Follower

PID

Hello,

Can somebody help me about PID?

I really do not know how to set up the the cicuit, connections (I might not understand about PID) to get the value for Kp and Kd. Can somebody give me a step by step on how to experimenting the PID? Please. I really need help.

Code modification

Hello sir, this robot is awesome.

im doing this robot to follow black line which the line can be bend on right side as well as left side.

Can you help me by giving the code for the above problem.

Thank you sir.

My e-mail : [email protected]

auto calibration code

//sag  = right
//sol = left

 

 for (int i = 0; i < 250; i++)
     {   if ( 0 <= i && i < 5   )  hafifsagadon();
         if ( 5 <= i && i  < 15   )  hafifsoladon(); 
         if ( 15 <= i && i < 25   )  hafifsagadon();
         if ( 25 <= i && i < 35   )  hafifsoladon(); 
        if ( 35 <= i && i < 45   )  hafifsagadon();
         if ( 45 <= i && i < 55   )  hafifsoladon(); 
         if ( 55 <= i && i < 60   )  hafifsagadon();
         if ( i >= 60  )  {digitalWrite(motorpower,LOW); delay(3);}
         qtrrc.calibrate(); 
       delay(4);
      } 
.
.
.
 

Void loop(){

}

void motorkontrol(int sagmotorpwm, int solmotorpwm){
  digitalWrite(motorpower, HIGH);

  if(sagmotorpwm<=0) {
      sagmotorpwm=abs(sagmotorpwm);
      digitalWrite(sagmotor1, LOW);
      digitalWrite(sagmotor2, HIGH);
      analogWrite(sagmotorpwmpin, sagmotorpwm);
    }
  else {
      digitalWrite(sagmotor1, HIGH);
      digitalWrite(sagmotor2, LOW);
      analogWrite(sagmotorpwmpin, sagmotorpwm);
  }

  if(solmotorpwm<=0) {
     solmotorpwm=abs(solmotorpwm); //
     digitalWrite(solmotor1, LOW);
     digitalWrite(solmotor2, HIGH);
     analogWrite(solmotorpwmpin, solmotorpwm);
    }

   else {
    digitalWrite(solmotor1, HIGH);
    digitalWrite(solmotor2, LOW);
    analogWrite(solmotorpwmpin, solmotorpwm);
   }
}

void frenle(){motorkontrol(0,0);}
void hafifsagadon(){motorkontrol(70,-70);}
void sertsagadon(){motorkontrol(0,250);}
void hafifsoladon(){motorkontrol(-70,70);}
void sertsoladon(){motorkontrol(250,0);}
void sagdan180don(){motorkontrol(-200,200);}
void soldan180don(){motorkontrol(200,-200);}
void geri(){motorkontrol(-200,-200);}

 

contradiction

Just one questions: do you are sure that line sensors that you used are not analog? In your picture we can see QTR-8RC which is connected to analog pins of Arduino board (accordingly to your diagram). All of us know the QTR-8RC is the digital module. Thanx!

questions

1. If the width of the line it is following would change(from thin lines to thick ones/vice versa), what changes should I undergo?

2. How much did you actually spend for the robot?($)

3. How many trials did you make before achieving your goal? (fast and accurate line follower robot)

4. Is it possible to make a shorter codings?

5.Are there any other alternatives in making this robot?

Any response would be very much appreciated.Thanks

your program is really helpful to me, but I had a question. Most mathematical formals of PID contains error as a function of time, but your formula for calculating motorSpeed does not have any time variable. So can you please clarify whether term related time is really needed.

i have made PID based Line follower project in high school. While working on project i have learned many other aspect that we had never studied in your lectures.

Sir am getting many errors in coading.
Like.
QTRSensorRC does name a type;did you mean ‘QTRSensors’?.
How can I solve this.

It says in the TB6612FNG datasheet that Vcc should typically be 3V (peak value 5.5V).

Also, could you not just run Vcc and VMOT off the arduino and cut out the need for batteries to power the motors?