This circuit is intended to be fitted onto the front of the BOE-Bot mobile robot described in . Although there’s nothing to stop you using this circuit with any microcontroller, it has been designed for connecting to the Arduino Nano support board . This support board is a suitable size for fitting to this robot and can be connected to two servomotors driving the robot by way of connectors that have been provided for this purpose. The circuit shown here allows a mobile robot to detect information about its immediate surroundings by means of two microswitches (end-of-travel detectors), two photoresistors, and three infrared proximity detectors. All this will enable the microcontroller to steer the robot correctly by sending appropriate commands to the servomotors.
The interface circuit for the three infrared detectors is standard and has already been used in . Potentiometers P1, P2, and P3 let you adjust the current drive to the transmitting diodes, and hence the maximum distance at which the detector will be able to detect the presence of an obstacle. The 2.2 kΩ resistors protect the microcontroller against the accidental short-circuits that might occur if the microcontroller pin is configured as an output and generates a logic level different from that generated by the detector.
The microswitches make it possible to detect the presence of an obstacle on the route and thus avoid collisions. They force the microcontroller’s input pin low. The two photoresistors make it possible to follow a reflective track, so the robot can follow a path marked out on the ground. They are connected in such a way as to allow us to measure their resistances using just a single logic input/output: at the outset, the microcontroller pin is configured as an output and set high to discharge the capacitor. Then the pin is configured as an input, which puts it into high impedance. The capacitor charges via the photoresistor, so the pin goes from logic 1 to logic 0 after a time that is proportional to the time constant RC. Hence by measuring the time it takes the pin to go from 1 to 0, we can measure the value of the photoresistor, and thus the intensity of the light falling on it. An additional expansion board that includes a quick prototyping area make it easier to connect the Arduino Nano support board with additional circuits (electronic compass, real-time clock, maths co-processor, accelerometer used as an inclinometer, and so on).
On the web page for the article  you’ll find a few test ‘sketches’ along with the PCB design for the additional expansion board.
Internet links Basic Stamp Programming Course, Elektor, September–December 1999.  www.elektor.com/100396  Basic Buggy, Elektor, April 1999.  www.elektor.com/100395