The photodiode can be used to detect IR reflected from the object. However, IR produced by the ambient conditions also detected by the photodiode. This IR noise must be filtered to prevent false detections. Usually, the LED’s IR signal is modulated with a convenient frequency and then using that modulation to detect only IR to filter the IR noise. So, the photodiode will detect only IR reflected from the object. This method can be simplified by using the IR proximity sensor that has simple receiver and transmitter sections. Here is the schematic diagram of the IR proximity sensor :

Infrared IR Proximity Distance Sensor circuit schematic

The transmitter of this circuit consists of a 940nm IR LED (IR11-21C). To turn ON and OFF the IR LED, the a 10kHz oscillator frequency is used. we can control the detection and the level of transmitted power by varying the LED current. The transmit pulses of this transmitter have a small duty cycle (typically 10%), to save power.

The Op amp is biased at 2.5V because there no input IR signal present. The op amp output varies around 2.5V with a dynamic range of 5V because of a 10kHz IR signal incident. The output drives a simple diode detector. A DC signal proportional to its amplitude can be provided by a simple diode detector. Simple diode detector also rectifies the 10kHz signal. The output signal is an analog signal that is proportional to the distance of the object from the IR transmitter. We can fed the output signal to an ADC for further processing or use it directly. [Source: MAXIM Application Note]