Here’s a design circuit for Line Following Robot sensor or surface scanner for robots is a
very simple, stamp-sized, short range (5-10mm) Infrared proximity detector
wired around a standard reflective opto-sensor CNY70(IC1). This is the figure
of the circuit;

Now slowly turn P1 to get
a good response from D1. After this, fine tune P1 to reduce false detection
caused by external light sources. Also ensure that the LED remains in off
condition when the sensor module is on the black area. Repeat the process until
the correct calibration is achieved. The red color LED (D1) is only a visual
indicator. You can add a suitable (5V) reed relay in parallel with D1-R4 wiring
after suitable alterations to brake/stop/redirect the robot. Similarly, the
High to low (H-L) transition at the collector of T2 can be used as a signal to
control the logic blocks of the robot. Resistor R1 determines the operating
current of the IRLED inside IC1. The sensing ability largely depends on the
reflective properties of the markings on the track and the strength of the
light output from IC1.