Tag Archives: linefollowing

Part 2:: Line following robot :: code guideline arduino using PID

Now on to finding the set point, place your bot on the dead center of the line. The position or the third column of the readings above will give you your ‘set point’. Note it down separately.
If you have time,verify the set point before your final run, more on this will come up in the tuning section.

Now we’ll build the complete PID algorithm. Continue reading

Line following PID concept

The algorithm is the one thing that determines the performance of a line following robot more than anything else. The most basic algorithm , is the one which uses only one sensor. The sensor is placed in a position that is a little off centered to one of the sides, say right. When the sensor detects no line the robot moves to the left and when the sensor detects the line the robot moves to the right. A robot with this algorithm would follow the line like shown in the picture below

Continue reading

Part 1:: Line following robot :: code guideline arduino using PID

The PID algorithm uses three constants, Kp, Ki and Kd to function. They are shorthand notations for proportionality, integral and differential constants respectively. These three constants have to be set by you after testing, and define how good your control works.
Now let’s look at how to develop a simple PID control algorithm.

Use the Arduino function analogRead() to retrieve sensor values. You’ll need an array to store these variables. Use Serial.print() to display these sensor values and observe them through the serial monitor in the Arduino IDE. If you’re using five sensors connected at analog pins 0-4, your code would look somewhat like this; Continue reading