A week ago I bought 3 OPB704 reflectance sensors, but can't get them to work properly. I searched on Google for the sensor, and found this post:
I (tried to) recreate the schematic given, but I don't think it worked.
I get very low values that don't change when switching from white to black.
Can somebody give me an instruction on how to wire the sensor?
Thanks in advance,
Most likely 2 pins will be used for Lighting up the IR And the Other 2 for Input to the arduino.
The schematic here looks right to me, and is what Revolution was getting at. You can make it a bit simpler by leaving out the pullup resistor and use pinMode with INPUT_PULUP instead.
I have not used this sensor before, but have experience in designing IR sensing devices.
IRLED Current Draw:
This is determined mainly by the IRLED's resistor. This LED has a voltage drop of 1.7V at 40mA max. The more current through the led, the stronger the reflected signal will be. However, if using batteries, current draw becomes more important. With 5V supply, this shows some values:
IRLED Resistor Current mA
For the circuits shown in the previous posts, the signal at the analog input should normally be at a low level. When the sensor encounters a dark line/colour, the signal will rise to a higher level.
Its possible to wire the transistor so that the collector is connected to a pullup resistor to 5V and the emitter is connected to ground. Now the signal at the collector should normally be at a high level. When the sensor encounters a dark line/colour, the signal will fall to a lower level.
After choosing the IRLED resistor, then the transistor's resistor should be chosen. The sensor should be positioned over what would be considered an average surface / average colour (not dark).
For the circuit that's normally high, use a pull down resistor of value that makes the Arduino's analog input read around 750 ±100.
For the circuit that's normally low, use a pull up resistor of value that makes the Arduino's analog input read around 250 ±100.
You may find the optimal transistor resistor value to be anything from 1K to 100K.
Now with either circuit, there should be a good response (large change in signal) when a dark surface is encountered.
Another thing to note about that particular one is that it refers to it as "focused" and has a detection distance of 3.8mm. I wonder how crucial that distance is?
Yes, I noticed that. I also get the impression the surface needs to be smooth as in another link "specular reflection" was mentioned. Anyways, when calibrated for maximum response, that will somewhat increase the ± tolerance from 3.8mm.
EDIT: Not sure, how crucial this is, but probably not that crucial as there is no focusing lens - just the diagonal shape of the module.
Sorry for this late response, but thanks. I will look at your solutions!