Let's Make Robots!

OPB704 Line Sensor


I have received questions regarding the line sensor that I'm using on my mini sumo bot. Here I will post the schematic and pictures of the board. 

The OPB704:

The OPB704 is simply a phototransistor and an IR LED housed in a black plastic case that makes them easier to work with. The light from the IR LED reflects back into the phototransistor when the sensor is close to a reflective surface. The range is very small ~3mm. This makes this sensor ideal for line detection in robots. If the sensor is over a black material, less IR light reflects back into the phototransistor than if it is over a white (or more reflective) surface. We measure the changes in these values to determine if the robot is in the ring or out of it. 


This board is very simple to use. All you need to do is hook up the output of the phototransistor to an analogue input on your microcontroller. These inputs use an analogue to digital converter to take an analogue voltage and break it up into a digital value.

I am using an arduino. There are projects showing how to use analogue inputs included with the arduino environment.  


The circuit for this sensor is very simple. Only two resistors are required. One is a 470Ω connected to the LED. This limits the current. The other is a 10kΩ pull down resistor between the emitter of the phototransistor and ground. The analogue input of the arduino (or whatever microcontroller) is connected between the resistor and the emitter of the phototransistor. 


Sorry about this bad schematic, but it should be able to help people. A large version is available for download at the end of this post. 

The Board:

The circuit is simply soldered onto some protoboard. This provides more material with which to mount the sensor to the robot. 


That's my simple implementation of the OPB704. You use could other line sensors too, but you may need to adjust your resistor values. Remember that the range of this sensor is around 3mm so it is not suited for most object detection applications. Please ask me questions and post comments. I cannot help with programming outside of the arduino because I don't have those systems. Any program that uses analogue inputs should be easy to adapt to this sensor or ones like it. For more info on the OPB704, visit the datasheet at http://www.alldatasheet.com/datasheet-pdf/pdf/35325/QT/OPB704.html.

Thanks LMR!

Schematic.JPG1.52 MB