Skip to content

Photoresistor Light Sensor

Read a light-dependent resistor as part of a voltage divider and inspect its analog reading.

Photoresistor Light Sensor: the matching Arduino Uno circuit rendered in Circuitera’s simulator
Matching Circuitera simulator circuit. Real firmware capture; modeled components are idealized.

Wire it up

Disconnect power before changing connections. Follow terminal names rather than wire colors.

FromToWhy it matters
LDR (sensor1) · 1Uno · 5VPower connection
LDR (sensor1) · 2Uno · A0Match this terminal to the sketch
LDR (sensor1) · 2Resistor (divider) · 1Match this terminal to the sketch
Resistor (divider) · 2Uno · GND.2Ground reference

The complete sketch

photoresistor.ino
void setup() { Serial.begin(9600); }
void loop() {
  Serial.print("light:"); Serial.println(analogRead(A0));
  delay(100);
}

The launch buttons use this same code and a matching saved circuit.

Build it step by step

  1. Open a complete project

    Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.

  2. Explore the live circuit

    Change the LDR resistance in Component Properties. Lower values should produce larger serial samples.

  3. Try it on hardware

    Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.

Understand the sketch

Resistance becomes voltage

The LDR connects from 5 V to A0 and a 10 kΩ resistor connects A0 to ground. Lower LDR resistance raises A0. The simulator exposes resistance, not calibrated lux.

If something is different

Values appear reversed

The divider orientation matters. Swapping the LDR and fixed resistor reverses the relationship.

Expected output and tested scope

Serial output follows the voltage-divider light reading; changing modeled resistance changes the ADC sample.

Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.

Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.

Keep exploring.