The photocell used is of a type called a photoresistor, sometimes called an LDR - Light Dependent Resistor. As the name suggests, these components act just like a resistor, except that the resistance changes in response to how much light is falling on them.

The photoresistor used has a dark resistance in excess of 200 kΩ and under bright light, the resistance falls to 1 or 2 kΩ.

To convert this varying value of resistance into something we can measure on BBB's analog input, it need to be converted into a voltage between 0 and 1.8V.

The simplest way to do that is to combine it with a fixed resistor, in this case of 10 kΩ in an arrangement called a voltage divider.
The voltage at the analog input will be pulled up towards 1.8V by the photoresistor and down towards 0V by the fixed resistor. Exactly who is willing this tug-or-war will depend on the resistance of the photoresistor.

If the photoresistor is brightly illuminated, then its resistance will fall so it will pull the voltage up closer to 1.8V. If, on the other hand, the photoresistor is in the dark, the resistance will increase, so the fixed resistor will dominate and the analog input will be pulled close to 0V.

The VDD_ADC1 pin (P9, pin 32) is a steady 1.8V designed to be used to provide a reference voltage for situations like this.

This guide was first published on Jul 01, 2013. It was last updated on Jul 01, 2013.

This page (Photoresistors) was last updated on Apr 18, 2021.

Text editor powered by tinymce.