Contents

Overview

This is a small sensor that changes resistance depending on the amount of light it is exposed to. The Photocell is also referred to as a photo-resistor, photo-detector, and photo-conductor.

Inputs and Outputs

As for inputs and outputs, the sensor is basically a resistor and thus should be read from the analog input pins. To work with the analog input, you must put 1kΩ resistor from analog ground to the analog input you choose then connect the sensor from the analog VDD to the analog input you choose. The input voltage can then be read by the processor to interpret the amount of light in the room.

Bone Usage

Wiring Example of MiniPhotocell

To interface this with the BeagleBone you just need to connect the photo-resistor from the analog VCC to an analog input and another resistor (I used 1.1kΩ) from analog input to analog ground(on P9). From there you can read the voltage input and manipulate it using code however desired. In my case I basically took the number that the analog input gave me and manipulated it to work as the duty cycle for a pwm which dimmed the light if it was too bright and brightened the light if it was too dim. You can see this in the sample code provided. There is also a picture included of how to wire the photocell to the bone.

Reading and Interpreting Analog Input Data

The resistance of the Mini Photocell is interpreted as such. When there is a very dim room the resistance shoots up to 10MΩ, but normal ranges occur anywhere from 8 to 20kΩ. So, the lower the number the analog input pin says it is, the darker it is in the room, with the set up explained in the previous section.