ToolSphere
All perfboard layouts

LDR Light Sensor Perfboard Layout

A light-dependent resistor (LDR) changes resistance with light. Put it in a voltage divider with a fixed 10 kΩ resistor and a microcontroller's analog input can read the light level as a voltage.

LDR light sensor perfboard layoutLDR1R1 10kJ1 ADC
Open this layout in the simulator Connection check: no shorts, 3 named nets

Red wires carry power, white is ground, yellow and blue are signals. Every hole is an isolated pad; connections are the wires shown. In the simulator you can move parts, add your own and re-run the check.

Parts list

As an Amazon Associate, ToolSphere earns from qualifying purchases.

How it works

With the LDR on the +5V side and 10 kΩ to ground, the analog pin sees:

V_A0 = 5 V × 10 kΩ ÷ (R_LDR + 10 kΩ)

For a typical GL5528-type LDR:

Light LDR resistance Voltage at A0
Dark about 1 MΩ 0.05 V
Room light about 10 kΩ 2.5 V
Bright about 1 kΩ 4.55 V

So brighter light gives a higher reading. Swap the two parts if you want the opposite. 10 kΩ suits indoor light; use a smaller fixed resistor for bright outdoor sensing and a larger one for dim rooms.

int light = analogRead(A0);   // 0 (dark) to 1023 (bright) on a 5 V Arduino

Building it, step by step

  1. Run +5V along the top row and GND along the bottom.
  2. Fit the LDR from +5V down to the junction (it has no polarity).
  3. Fit the 10 kΩ resistor from the junction to GND.
  4. Take the junction across to the A0 pin of the 3-pin header, and wire the header's +5V and GND to the rails.
  5. Read A0 with analogRead and cover the LDR with your hand: the value should drop sharply.

Tools for this build

Frequently asked questions

What resistor do I use with an LDR?

Pick one close to the LDR's resistance at the light level you care about most. 10 kΩ suits indoor light with a GL5528; it puts room light near the middle of the ADC range.

Why does my LDR reading go the wrong way?

It depends which side the LDR is on. LDR to +5V and resistor to ground: brighter gives a higher reading. Swap them to invert it.

Is an LDR accurate enough to measure lux?

Not really: LDRs vary between parts and respond slowly. They are fine for light or dark decisions; use a sensor such as a BH1750 for lux.