The robot requires means of detecting an obstacle (or another robot) without making physical contact. This allows the robot to decide whether to avoid or to confront and investigate the obstacle depending on its programming. This is one solution and the design of obstacle detection circuit. Here’s the figure of the circuit;
In this circuit, ultrasonic transducers were chosen for this because they are more reliable and have a greater range than IR sensors (effectiveness of IR sensors varies with ambient light level). The IC U1 is a 555 timer in astable configuration to oscillate at 40 KHz. Instead of using exact values for the two resistors that is placed between pin 6 and 7, a 10K ohm potentiometer (VR1) was used. This also allows for some fine tuning of the output frequency. The output (pin 3) is then attached to a 40 KHz ultrasonic transmitter (UTR1).
The receiving circuit is a dual LM358N (U2) op-amp. An ultrasonic receiver (UTR2) is connected to pin 3, the non-inverting input of U2a which is a non-inverting amplifier with a gain of 220. The output of U2a is put through a low pass filter via D1, C3 and R4 to produce a somewhat stable DC voltage. This DC voltage is fed into the non-inverting input of U2b configured as a non-inverting comparator. Sensitivity of U2b is controlled by VR2 to set the threshold trigger value. The output of U2b is connected through R5 to the base of a bipolar 2N2222 transistor (Q1) acting as an inverter with a LED (LED1) to indicate if an obstacle has been detected. Finally, the collector of Q1 goes to the Handy Board's digital port (Handy Board uses inverted logic levels, 0V is a logic 1 and +5V is a logic 0).