Using IR signal strength to sense distance ?

dc42:
It would be better to use a coherent detector (and perhaps a coherent filter as well) so that the receiver only responds to signals at the modulation frequency. A coherent detector will also convert the signal to DC, making it easier to read from an analog input.

That would mean seeking the phase relationship between signals, wouldn't it ?

Do you have an example of code and circuit ?

Bear in mind that the signal will decrease with the square of the distance, which will limit the range. If you want to cover a range greater than about 10:1 then you will need to either switch the gain of the amplifier (increasing it at long distances), or adjust the current drive to the IR emitter (increasing it at long distances).

The distance would be very small (less than 5 cm and maybe even less).