Sunday, March 4, 2012

Light Sensing with a CdS (LDR)

A Cadmium Sulfide (CdS) sensor is a Light Dependent Resistor (LDR). It is a resistor that reduces resistance when hit with light. The more light, the lower the resistance. The Arduino is ideal for monitoring one of these sensors, and can be the heart of a streetlight or burglar alarm system, turning devices on or off in the presence of light. It could also be used in photography or solar applications, detecting the amount or direction of light.

See the following sketch for ideas. The parts are available at

Cds Connections:
CdS Pin 1 to +5v
CdS Pin 2 to Analog Pin 3
10k ohm resistor pin 1 to Analog Pin 3
10k ohm resistor pin 2 to Gnd

int analogPin = 3;   // CdS (ldr) connected to analog pin 3
int val = 0;         // variable to store the read value

void setup() {

void loop() {
  val = analogRead(analogPin);   // read the input pin

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...