Introduction
This experiment demonstrates how to measure light intensity using a photoresistor (LDR).

Components Needed
- Photoresistor (LDR)
- Arduino
- Resistor (10k Ohm)
- Jumper Wires
Circuit Setup
- Connect one end of the LDR to 5V on Arduino.
- Connect the other end to an analog input pin (e.g., A0) and also to a 10k Ohm resistor which connects to GND.
The LDR will vary its resistance based on the amount of light falling on it, and the Arduino reads this variation.

Code for Luminosity Measurement
Upload the following code to your Arduino to measure luminosity:
const int ldrPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int ldrValue = analogRead(ldrPin);
Serial.print("Light Intensity: ");
Serial.println(ldrValue);
delay(1000);
}
Explanation
The LDR’s resistance decreases with increasing light intensity, and this change is captured as an analog value by the Arduino.
Troubleshooting
- Ensure that the LDR is connected to the correct pins on the Arduino.
- If readings are not changing, check if the LDR is exposed to varying light levels.