LDR Sensor with Arduino Board

Z2M Part: EMS-00017-A

Reads light intensity from LDR connected to A0 and prints values to Serial Monitor.

Circuit Diagram
Circuit diagram for LDR Sensor with Arduino Board
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → Analog Pin A0 to LDR–resistor junction
Red → 5V to LDR
Black → GND to 10kΩ resistor

Pin Configuration:

Arduino Analog Pin A0 → LDR (voltage divider junction)
Arduino 5V → LDR (other leg)
Arduino GND → 10kΩ resistor (voltage divider)
Arduino Code
Edit
// LDR Sensor with Arduino Board

int ldrPin = A0;   // LDR connected to A0
int ldrValue = 0;

void setup() {
  Serial.begin(9600);   // Start serial communication
}

void loop() {
  ldrValue = analogRead(ldrPin);   // Read LDR value

  Serial.print("LDR Value: ");
  Serial.println(ldrValue);        // Print value to Serial Monitor

  delay(500);
}

Instruction Details

Wiring: Connect LDR one leg to 5V, other leg to 10kΩ resistor to GND. Connect LDR–resistor junction to Analog Pin A0.
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 intensity values (0–1023) display every 500ms. Cover LDR to see values change.

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 Sensor
  • 10kΩ Resistor
  • Breadboard
  • Jumper Wires

Category: Sensors