I hope most of you have read the
Bit Logic line follower algorithm. Next I will explore the PID method, which I have been reading alot lately on the Internet. I reckon, for most high school students understanding just the "theory" of PID will be enough to put you through college :p
Please note that the line follower robot is only using 1 light sensor, the left one. The robot has been built with 2 sensors for future test algorithm.
Anyway, if you would like a very detailed theory, calculations and formula for the PID method, please follow this
link.
If you have watched the video, you would realised that the robot tries to correct itself to stay in the middle, between the black and white areas, as shown in the image above. After a few oscillation, it would be moving along the grey area (between the white and black).
The graph above shows the Motor power output vs the readings from the Light sensor. As you can see, the robot will always try to keep within the
Grey area (dotted line B), which is the equilibrium. When the Left motor and Right motor, is travelling at the same speed, the robot is actually move straight.
When the Light sensor is above the
White area (dotted line A), you'll notice that the Right motor will stop, while the Left
motor is moving at full power, causing the robot to turn right, thus heading towards the Black line.
When the Light sensor is above the
Black area (dotted line C), the Left motor will stop, while the Right motor is moving at full power, causing the robot to turn left, thus heading towards the White area.
As you can see, since the graph is linear, the robot should automatically correct itself till it is moving along on its equilibrium (dotted line B), as you can see in the video attached above.