I want to detect the black line with RPR220 when building a line tracker. I connect the rpr220 output to a LM311 the comparator.but when it can detect the black line when the distance between RPR220 and the line is 2.5cm,it cannot do it correctly with the distance 1.5cm. And recognize the black line as the white background .
the voltage on the collector of RPR220 can clearly distinguish black and white at a certain distance, but cannot do it if the distance is closer ,why is that?
It seems like the circuit is too sensitive, even the black line reflects too much IR when the sensor is close. Have you tried adjusting the 10k potentiometer to decrease the sensitivity?
I have tried.But I need it I have tried.But I need it to detect the line as far as 3cm, if I low down its sensitivity it cannot detect that far. How should I do then?
Ah, I understand now, you need it to work near and far.
The R2 (5.1kΩ) resistor controls the sensitivity of the phototransistor part of the circuit - if you make that smaller (try 2-3kΩ, or add in another potentiometer like R3) then the readings from 1.5cm and 3cm won’t be so different from each other. You’ll probably need to adjust R3 each time you change R2, but with a bit of calibration you should be able to get the circuit to work the way you want.
I find a very strange phenomenon in the circuit.When the voltage on PIN2-LM311 is 3.88V and PIN3 is 4.4V,the output is still high.But when I test the LM311 in another circuit, it works fine.Is that sth. wrong with the RPR220?
I tried that way.And it dosenot seem to work. Also the reason R4 is too low cannnot explain why LM311 whorks fine in another circuit where IN+ and IN- are all connected to potentiometer used to get an adjustable voltage. Is that sth. wrong with the input impedance?
Are you saying that you used the same value for R4 and set the inputs to 3.88V and 4.40V and got a different result on the output? The input impedance for the LM311 should be very high and not something to worry about.