A Photocell is basically a resistor that changes its resistive value (in ohms Ω) depending on how much light is shining onto the face.
Photocells are generally small, inexpensive, low-power, easy to use and don’t wear out. For that reason they often appear in toys, gadgets and appliances.
Photocell sensor are fairly inaccurate and each one will act a little differently than the other.
I am using these DigiKey part numbers are PDV-P8103-ND and 49.9KXBK-ND.
Because a photocell is very small light sensor; it makes a great ambient light trigger. For example, users can use this sensor to detect that a light has been turned on in a room.
- Depending on model (you should test and calibrate your sensor):
- model 1: 200KΩ (dark) to 10KΩ (10 lux brightness)
- model 2: 10KΩ (dark) to 1KΩ (10 lux brightness)
- Max voltage : 150V
- Max power: 100mW
- 2 x 4 x 5mm
- 4mm between pins
- 31mm lead length
The best way to attach the photocell to the board is by using GPIO0 and GPIO1. The photocell is attached to the 3V pin (pin 11) on the MetaWear board as well as pin 8. A resistor is hooked up in series between pin 8 and pin 9.
I used the sample iOS App code to set the value of GPIO1 low (0V) and read the analog value on GPIO0 to get a metric for whether the light was on or off. You should experiment and also calibrate your device to determine the threshold for dark versus light.