Light Sensor(CDS)

아두위키 : Arduwiki

This is a sensor whose resistance decreases as the brightness increases.


Required Hardware

  • Light Sensor (CDS)
  • Arduino Board
  • 10KΩ Resistor
  • Jumper Wires
  • LED (used in example)


Connection

Even without using an LED, you can check the light sensor readings through the serial monitor.

Circuit without LED
Circuit with LED


Example Code

This example prints the light sensor value to the serial monitor and adjusts the LED brightness based on the sensor value.

#define A_cds A0

void setup()
{
  // Set the serial communication baud rate
  Serial.begin(9600);
}

void loop()
{
  // Read voltage input via analogRead
  // analogRead maps 0–5V to integer values between 0–1024
  double value = analogRead(A_cds);
  Serial.print("value : ");
  Serial.println(value);
  delay(1000);
}

Output Result

Comparison of LED brightness when light sensor is uncovered (left) vs. covered (right)
Comparison of LED brightness when light sensor is uncovered (left) vs. covered (right)