One of the traditional ‘disciplines’ in which robots are supposed to compete is the Line Follower Competition. Robots go along a predrawn black line (usually duct tape) on a white-ish surface (usually paper, cardboard or plastic). This discipline requires special sensors. Usually, these are made out of reflective optosensors (such as CNY70, LTH-209). This sensor contains a phototransistor and an infrared LED. These sensors are pointed at the surface on which the robot is sup-posed to show off its speed and agility. The LED emits infrared light on the surface and the phototransistor acts as a receiver. The black coloured line to follow reflects far less light than the white surface it is affixed on. The current that flows through a phototran-sistor depends on the intensity of the light detected. Therefore, more current will flow through the transistor when it is above a white surface. In this way, the sensor can also be used as a surface detector.
The minimal count of sensors necessary for making a line following robot is… two —one on the left side and one on the right. It is advisable to use at least three sensors –one left, one right and one in the middle as a failsafe precaution against the robot dropping off a table edge. In this drcuit, the voltage on the phototran-sistor is compared with a reference level set by P1. When IC2 is illuminated, the voltage on it drops. Comparator IC1A compares the voltage against the set reference. If the ref-erence voltage is higher than that on pho-totransistor, the comparator’s output is drops to (almost) zero. This occurs when there is a black line under the sensor. The output sig-nal from the comparator is then connected to either a microprocessor or any control logic that (hopefully) responds by adjusting the course of the robot . The circuits needs to be calibrated before use. The best method is to set the P1 pre-set to the centre of its travel. Next, place the sensor above the surface it is supposed to detect, where it is white. Note that the height of the sensor above the surface is important.
It doesn’t matter that much when using for instance a CNY70, but an LTH2O9 for example only works in a very small range of heights (around 3.8 mm). If the response from the output of the com-parator is good (i.e, pin 2 High) move the sensor above a line. If the result is again as expected (pin 2 Low) you’re done calibrat-ing the circuit. If not, repeat the process and adjust P1 until the correct calibration is achieved. The schematic for only one of four chan-nels that can be made with just one LM339 IC. The pull-up resistor at comparator pin 2 is used because the LM339 has open-col-lector outputs. R3 determines the current going to the IRLED. Many comparators can be used, the LM339N just happened to be available. The same may apply largely to the opto-sensor, but note that many different pinouts exist so check out that datasheet.