Sensors play a major role in Automatic Control Systems.. IR sensors are the simplest among them.It has a transmitter and a receiver.Transmitter is a IR emitting diode and receiver is a photodiode.
A red filter is used in front of photodiode , to avoid the effect of unwanted light.
Resistance R1 is choosen such that current through diode is in the range of 15-20mA for better performance. Resistance R2 is choosen such that you get a voltage drop accross R2 which atleast varies by 0.5v form full receving to no receving condition. This o/p from photodiode is given to a comparator(eg-lm324), wherein we adjust the reference voltage to get the digital o/p.
[sensor in the pic is diffrent from the one explained here]
Better than this is the modulated IR sensor.. i,e the emitter does not emit continuous signal but in a discrete manner at a certain frequency. Receiver uses a demodulating circuit in order to detect the tone it is receving for which a bandpass filter along with a peak detector is used. This can also be done by using a single chip lm567 which is a tone decoder.