I currently use three IR sensors bought from eBay on my robot. The sensors are the same with this product: http://www.dfrobot.com/wiki/index.php?title=Adjustable_Infrared_Sensor_Switch_(SKU:SEN0019). They are digital IR sensors that output a TTL signal depending on whether they are blocked or not.
When I first bought the parts, I used to have problems, mostly noise that made the sensors switch "on" and "off" when the motors were running. This is an obvious problem and I solved it using 3 capacitors on each motor (4 total). Now I'm facing another problem. When the motors stall or are stressed (for example when I load them a bit more or stop it) the sensors switch to "on", reporting that an object is present. This is wrong and makes the robot go nuts (on the other hand it has some serious dance moves!).
The question is, should I apply more filtering (and where) or is this a battery issue? The motor controller is the classic L298, I will try and separate the motor power from the board/sensor power and report back. I really do not want a different supply, so what can I try? By the way, the sensor's LEDs (that show if they detect an object) seem to flicker when the motors are stalled. Should I try and change the PWM prescaler of the motors?
EDIT: I didn't post this to the sensor subforum because I think it more of a motor problem.