Hey guys,
I am trying to make an IR obstancle detector - I compare values read from my IR phototransistor when the IR led is off and when it is on. But I have a problem it only works during some settings of light in my room. For example when I turn my lamp on the sensitivity rapidly decreases... So is there any way to filter other sources of normal light? If no, I will probably have to use ultrasonic detection...
using ultrasonic would be better idea because many things would effect IR sensor's sensitivity; any remote controller, sun light, brightness of the environment (your case), even color of the obstacle (white is more reflective than black)
even color of the obstacle (white is more reflective than black)
Almost the same is true for an ultrasonic sensor with different materials. If you have an obstacle made of soft materials you might get no response at all (as with deep black and infrared).
You can make an infrared distance sensor more immune against ambient light by making it oscillating (turn it on and off in a fast repetition and putting a filter on the reception side. Of course you loose resolution with this modification.
You get best results if you use both sensors together.