Arduino Nano LDR Photo Resistor Module

The LDR Photo Resistor Module project demonstrates how to interface an LDR (Light Dependent Resistor) sensor module with an Arduino Nano. The LDR changes its resistance according to the light intensity, and the Arduino reads the resulting analog voltage to measure light levels.

Components Needed

  • Arduino Nano
  • LDR / Photoresistor or LDR module
  • Jumper Wires
  • 10K Resistor (for basic circuit, if not using a pre‑built module)
  • Breadboard (optional)

Circuit Setup

1. Connect LDR Module to Arduino Nano:

If using an LDR module (with VCC, GND, and OUT):

  • VCC → 5V on the Arduino Nano.
  • GND → GND on the Arduino Nano.
  • OUT (analog output) → A0 on the Arduino Nano.

If using a standalone LDR in a voltage‑divider circuit:

  • Connect one leg of the LDR to the 5V pin on the Arduino Nano.
  • Connect the other leg to A0 on the Arduino Nano.
  • Place a 10K resistor between A0 and GND.

How the LDR Sensor Works

The LDR is a resistor whose value drops in bright light and rises in darkness. The Arduino Nano reads the voltage at the divider midpoint (A0) as an analog value from 0 to 1023 and converts it into a relative light‑level reading.

Program: Arduino Nano LDR Photo Resistor (Light Level Monitor)
// Analog pin connected to LDR module or divider
const int ldrPin = A0;

void setup() {
  Serial.begin(9600);
  Serial.println("=== LDR PHOTO RESISTOR MODULE READY ===");
  Serial.println("Light Value (0–1023)");
}

void loop() {
  // Read the raw analog value
  int lightValue = analogRead(ldrPin);

  // Print to serial monitor
  Serial.println(lightValue);

  delay(250);  // Smooth reading
}

Instructions

1. Circuit Setup:

Wire the LDR or LDR module to the Arduino Nano as described in the circuit setup section.

2. Code Upload:

Connect the Arduino Nano to your computer via USB.

Open the Arduino IDE and paste the provided LDR code.

Select the Arduino Nano as the board and the correct port, then upload the code.

3. Testing:

Open the Serial Monitor at 9600 baud.

Observe the light values changing when you cover the LDR or shine light on it (higher values = brighter, lower values = darker).

Applications

Automatic Lighting: Turn on LEDs or lamps when the room is dark, simulating automatic street or room lights.

Light‑Meter Projects: Measure and log ambient light levels for gardens, greenhouses, or smart‑home dashboards.

Security & Alarm Systems: Trigger alerts or alarms when unexpected changes in light (e.g., doors opening, flashlights) occur.

Troubleshooting

  • Readings always near 0 or 1023? Check the LDR and 10K resistor are in the correct voltage‑divider configuration and not reversed.
  • Unstable readings? Ensure clean wiring and avoid noise sources; hold the LDR still while testing.
  • No change at all? Verify that the OUT pin (or A0 divider) is connected; a pre‑built module may include a potentiometer for sensitivity adjustment.

Best Practices and Notes

  • Place the LDR where it can see the ambient light clearly, without being blocked by the enclosure or other components.
  • Use a basic threshold in code (e.g. if (lightValue < 300)) to switch lights or LEDs, and adjust the threshold after testing in your environment.
  • For more stable readings, average several analogRead() samples or add a small delay between readings.

Extensions and Ideas

You can extend this project by adding an LED or relay that turns on when the light level drops below a certain value, converting your setup into a simple automatic‑light system, or by displaying the light value on an LCD or TFT screen.