The basic principle behind it is that, the reflecting properties of a black line are much more negligible as compared to a white surface, so using a sensor which simultaneously sends out an IR (Infra Red) beam as well as, absorbs the reflected beam from either a white surface or a black line using it's IR receivers.
When the sensor moves over a black line the reflection of the IR beam will be very less , as a result the IR receiver is exposed to the minimum amount of IR rays ,thus as the connection is taken from across this receiver , onto the micro controller , the system measures maximum amount of voltage, it will observe minimum amount of voltage when the sensor moves over a white surface. The sensor used :
So, by monitoring the voltage across this sensor, and by proper programming, we are able to make the robot follow the black line.
The devices used for this project are an ATMega 328 micro controller, a QTR 8A polulo reflectance sensor array, 2 continous rotation servo motors. The chassis of my robot is made from the material we use for switchboards, because of the extreme low range of sensitivity of the sensor (<0.5cm), I had to carefully fabricate 2 supporting legs for the sensor, so that it is in close proximity with respect to the ground. The chassis and the motors are attached as shown in the pic:
Another interesting feature of my robot is that it automatically stops , when it reaches a strip of horizontally placed black tape, the black line made here is just by using ordinary insulation tape.
This robot uses a unique algorithm preventing over compensation specially around the turns.The bare robot is shown in the video here, explaining the logic:
The motors are powered using 6V batteries (AA), and the servos are programmed and controlled via PWM (Pulse Width Modulated) signals, these are continuous rotation servos providing 360 degrees of freedom.
This robot has the capability to follow lines at any sorts of curves i.e., at any angles. The complete video demonstrating it's working is given below: