The circuit of this Infrared(IR) detector circuit is a simple light relay which triggers when infrared light is applied to phototransistor Q1. This device can be used in control systems. When infrared light is OFF, Q1 transistor and relay K1 are normally closed.
When IR diode is transmitting IR light phototransistor Q1 opens and thus relay K1 triggers because current starts flowing through Q2 transistor. Construction can easily be modified when circuit output is connected to microcontroller or other device. Sensitivity so the distance can be controlled by changing IR diode D1, using more sensitive phototransistor Q1 and adjusting R2 resistor.
Original source: http://cxem.net