In principal they work pretty simply a fixed quantity of light is emited and the amount reflected indicates distance.
There are a number of gotcha's
The material doing the reflecting greatly affects the quantity of light returned (mirror/black body).
Ambient IR WILL affect a simple (non-pulsed) light source/receiver combination.
Electrical noise crossover between transmitter and receiver.
If I were you I'd look at experimenting with homemade ultrasonic sensors first. It is very unlikely you could produce a homemade IR sensor that approached the functionality of one of the commercial units for anything approaching the cost of a commercial IR sensor ($12 is very CHEAP for what you get).
If you still want to pursue, one Idea I would consider is to eliminate the measured range component and work on a discrete number of ranges (ie 2 or 3). This could be accomplished with 2 or 3 sensor circuits set to different levels of sensitivity. My gut tells me this might prove easier to get working (op-amp circuits are easy) and could also implement filtering. If you get this working you could increase the number of ranges by simply reproducing the circuit as many times as needed.
You could even use multiplexers to feed multiple sensor points into the single set of circuits to allow the op-amps to sense from multiple directions (one at a time)
Thanks for your reply! Still have a couple questions I need to put to rest if you don't mind. =)
I know the material doing the reflecting will greatly affect an IR-sensor but that is not very important to me, as I am just doing this to see how good I can make it compared to something that costs 10x more. Besides, wouldn't an ultrasound-sensor have at least a semblance of the same issues? Some materials are extremely reflective to sound, some mostly let it pass through and some are "dead", as in they absorb sound-vibrations..
And as to ambient light/IR affecting my sensor-readings.. won't I have a fair shot at negating this by, like I proposed, taking one reading with the sensors IR-source OFF (to get an ambient IR-light reading), then taking one with the sensors IR-light ON and subtracting the two? With Arduino, I am guessing I can do this quite a few times per second (and if needed average a few readings at a time), though nowhere near the KHz frequencys that commercial IR-proxys are modulated at.
As to your idea on how I could do it.. I want it to be as small, compact and cheap as possible while still beeing usable. Know the KISS-rule? Usually try my best to enforce it in my programming, and experimenting in general. Keep It Simple, Stupid! ;)
I will post my results once I get my Arduino (perhaps today =D ) and get into the fiddeling and gadgetéering. Until then, I appreciate your comments and thoughts on this. I mean, I probably have a lot to learn from the people here, even if I do have to fail misserably myself before I actually learn. ;)