LDR Sensor

Z2M Part: EMS-00017-A

Measure light intensity using LDR.

Circuit Diagram
Circuit diagram for LDR Sensor
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → Analog Pin A0 to LDR module OUT
Red → 5V to LDR module VCC
Black → GND to LDR module GND

Pin Configuration:

Arduino Analog Pin A0 → LDR module OUT
Arduino 5V → LDR module VCC
Arduino GND → LDR module GND
Arduino Code
Edit
int LDR = A0;   // LDR connected to analog pin A0
int LDRVal;     // Variable to store LDR reading

void setup() {
  pinMode(LDR, INPUT);   // Set LDR pin as input
  Serial.begin(9600);    // Initialize Serial Monitor
}

void loop() {
  LDRVal = analogRead(LDR);   // Read value from LDR
  Serial.print(\"LDR Value: \");
  Serial.println(LDRVal);     // Print the value to Serial Monitor
  delay(100);                 // Wait a little before the next reading
}

Instruction Details

Wiring: Connect LDR module VCC to 5V, GND to GND, OUT to Analog Pin A0 (or Digital Pin for D0).
Library: Not required (built-in).
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: Open Serial Monitor (Tools → Serial Monitor) at 9600 baud. Light level values display. Adjust onboard potentiometer for sensitivity.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • LDR Module (or LDR + 10kΩ Resistor)
  • Breadboard
  • Jumper Wires

Category: Sensors