Well, Here I am again. I will not write every formula and equation, I suppose you alrady know how to calculate a transistor to saturate or a RC filter.
The circuit is the following:
**broken link removed**
You can see the IR LED emitter, It will conduct a very high current for its nominal one of aprox 150mA. It must not be turned on continuously, you have to generate pulses from less than 5us from the MCU (maybe a delay with a few instructions or a counter, depending of the bus frequency, or you can use the timer). Because of something I will tell you later, the pulses frequency should not pass the 1KHz.
Then, those high luminance pulses will reach the phototransistor which has a buffer at its output. As LM358 is a slow opamp (low slew rate) the emitter frequency should not pass the 1KHz, even lower frequencies could be used but the emitter pulse lenght should be the same. The R1 resistor determines the sensibility. At the buffer output there's a capacitor which with the 100K resistor will filter the most part of ambient light detected by the sensor. Only the pulses will flow through it. Then, there's another 100K resistor with a 10nF ceramic capacitor and a diode pointing to the capacitor.
That part will make a kind of continuous signal from the received and already filtered IR light pulses. The closer the emitter is to the receiver/sensor the higher that DC voltage will be. Take into account that at a determined maximum distance those pulses will be so small that the output signal may be zero.
The last diode (at the output) performs a protection since the electrolitic capacitor could generate negative voltages when being discharged (when the device is turned off, for example).
I didn't simulate it, I am out of time, but if it doesn't work play with the values; the electrolitic capacitor should charge in aprox 2s at its 80% by the ambient light. The ceramic capacitor must charge fastly and discharge slowly (make charge time 10 or more times smaller than the discharge one), 1ms to charge and 50ms to discharge would be fine. Take into account that the diode will charge it inmediately (which is good). If you have to change a resistor value for that change the resistor of the ceramic capacitor, otherwise you will afect the DC filter.
Finally, your MCU should have a CCP module. If it does not, use an external comparator IC but I recommend to use the MCU internal one to save components and space. Measure the output DC at the maximum distance from the emitter to the sensor and program it to be a bit higher.
That's all, ask me again if you didn't understand anything.