So just what is a photosensor?  How does it “sense” light?  As with lots of other types of sensors, there is more than one way to accomplish the task.  In the case of photosensing, the two ways of doing this using solid-state devices are by using either Light-Dependent Resistors (LDRs) or photovoltaic devices (photodiodes and phototransistors).


You’ve probably seen this type of sensor at some time or other.  It’s used for things like dusk-to-dawn outdoor lights, automatic hand sensing at faucets, etc.  It’s typically a round device about a half inch in diameter with a snake-like pattern printed on it, which is the resistor (Figure 1).  This resistor changes its resistance in the presence of light.  Sending current of a known amplitude through this resistor and measuring the resulting voltage across it allows the determination of the resistance and therefore the amount of light present.

Figure 1 – A Light-Dependent Resistor

Photovoltaic Devices

By far the most popular devices used for sensing light in line-following applications are photovoltaic detectors.  These devices absorb light energy and convert it to an electrical current.  Such devices are either a simple PN junction (a photodiode) or a transistor with its base absorbing the light (a phototransistor).  Both devices are two-terminal semiconductors and are similar in operation.  However, the phototransistor will typically produce more current for a given amount of light but is also slower in responding to the light than a photodiode.

Improving Photovoltaic Response in the Presence of Ambient Lighting

As mentioned, photosensor response can be compromised, either by intense sunlight that can saturate the sensor or by indoor lighting that has varying light intensity that can fool the sensor into thinking it is seeing variations in the line/background intensities.  One of the ways that such devices can be made less sensitive to ambient lighting conditions is by using illumination sources (LEDs) that emit in the infrared region and then using photodetectors (phototransistors or photodiodes) that filter out all but the infrared.  Many photodetector manufacturers make such devices, usually as a complement to the same detector with sensing over the visible as well as infrared regions.

Another way that the sensors can be made more immune to ambient lighting is by choosing phototransistors or photodiodes with a narrow field of view.  Most photodetector manufacturers will provide a nominal angle over which the detector “sees” light.  A detector pointing down at the line/background surface and having a narrow field of view will see mostly that surface and little of the interfering ambient light.

Still another way to reduce susceptibility to ambient light problems is to “shroud” the detector.  This is especially effective in situations like line following, where the target – the line/background surface – is below the line-following sensor but the ambient lighting is above the sensor.  Additional electronic design methods for reducing ambient light interference are discussed in subsequent articles in this series.