I have a circuit similar to the following:
In the circuit, the output from op-amp pin 6 goes low when a shadow falls or light is not present.
I am using this to find out if an obstacle is present or not and it can be done only this way, according to our constraints. The obstacle blocks the light and so the voltage from pin 6 goes low. These are moving obstacles with a certain width, so the light is blocked until the width passes and this width is constant. However we have smaller obstacles in the same line which we should ignore, based on the width.
In simpler terms, if the light is blocked (voltage is low) for only for 20 millseconds, then we have to ignore it. However if the light is blocked (voltage is low) for more than 40 milliseconds, then it is a valid obstacle. I have to do it only with hardware, not using functions similar to Arduino pulseIn() etc.