• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » LDR Light Sensor Circuit with Arduino

LDR Light Sensor Circuit with Arduino

Last updated on 18 September 2025 by Admin-Lavi Leave a Comment

This project is for smart LDR Light Sensor Circuit with Arduino.

It can feel light like human eye.

When dark come, it turn ON lamp by itself.

When light come, it turn OFF lamp automatic.

No need to press any switch.

It save time and save power.

It is small, simple and very low cost system.

Circuit Coding:

int LDR = A0;
int relay = 8;
int value = 0;

void setup() {
  pinMode(relay, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  value = analogRead(LDR);
  Serial.println(value);
  if (value < 300) {
    digitalWrite(relay, HIGH);
  } else {
    digitalWrite(relay, LOW);
  }
  delay(500);
}

Coding Explanation:

  • LDR analog pin is A0.
  • Relay pin is 8.
  • Arduino read analog value from A0.
  • In dark it value is low.
  • If value is below 300 then relay turns ON.
  • Relay ON will turn ON the lamp.
  • If value above 300 then relay turns OFF.
  • Relay OFF will turn OFF the lamp.

Circuit Working:

LDR Light Sensor Circuit Diagram with Arduino

Parts List:

ComponentSpecificationQuantity
Resistors100k 1/4 watt1
330Ω 1/4 watt1
LDR standard type1
SemiconductorsArduino UNO Board1
Transistor BC5471
Relay 5V1
Diode 1N40071
LED Bulb 230V AC1

LDR and resistor make voltage divider.

LDR change resistance with light.

In dark, LDR resistance go high.

Voltage is at A0 go low.

Arduino read low voltage.

It send HIGH to transistor base.

Transistor turn ON like switch.

Big current go to relay coil.

Relay turn ON and give power to lamp.

Lamp glow.

In light, LDR resistance go low.

Voltage at A0 go high.

Arduino read high voltage.

It send LOW to transistor base.

Transistor turn OFF.

No current go to relay coil.

Relay turn OFF and cut lamp power.

Lamp goes OFF.

This is how it work automatic with light and dark.

Formula with Calculation:

LDR and resistor form a voltage divider.

Vout = (R1 / (R1 + RLDR)) * 5V

In dark, RLDR is high so Vout is low.

In light, RLDR is low so Vout is high.

Example:

Dark: RLDR = 1M = Vout = 0.45V

Light: RLDR = 10k = Vout = 4.54V

How to Build:

To build a LDR Light Sensor Circuit with Arduino follow the below steps:

  • Take all parts from circuit.
  • Connect LDR to 5V and GND with 100k resistor.
  • Connect middle point to A0 pin.
  • Connect relay to pin 8 using transistor.
  • Connect other coil side to 5V.
  • Connect relay common to AC supply.
  • Connect relay NO to lamp.
  • Join Arduino GND and relay GND.
  • Connect transistor base to pin 8 through 330 ohm.
  • Connect transistor emitter to GND.
  • Connect transistor collector to relay coil.

References:

LDR with Arduino

Filed Under: Arduino Projects, LDR Circuits, Sensors and Detectors

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « Arduino Text to Speech Voice Generator Circuit

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar




Categories

  • Alarm Circuits (34)
  • Amplifier Circuits (67)
  • Arduino Projects (50)
  • Audio Circuits (97)
  • Automobile Circuits (19)
  • Battery Charger Circuits (48)
  • Free Energy (13)
  • Heater and Temperature Controllers (10)
  • High Voltage (1)
  • Indicator Circuits (39)
  • Inverter Circuits (13)
  • LDR Circuits (16)
  • LED and Lamps (116)
  • Meters and Testers (28)
  • Motor Controllers (18)
  • Oscillator Circuits (34)
  • Power Supply Circuits (92)
  • Remote Control Circuits (7)
  • Security and Protection (26)
  • Sensors and Detectors (91)
  • Solar Circuits (17)
  • Timer Circuits (30)
  • Transistor Circuits (57)
  • Transmitter Circuit (13)
  • Tutorials (5)
  • Water Level Controller (4)

Recent Posts

  • LDR Light Sensor Circuit with Arduino
  • Arduino Text to Speech Voice Generator Circuit
  • Smart Table to Kitchen Order Circuit with Arduino
  • Interfacing TFT LCD with Arduino
  • Arduino Based Coin Value Identifier Circuit

Recent Comments

  1. Admin-Lavi on Constant Voltage, Constant Current Battery Charger Circuit
  2. Bill on Constant Voltage, Constant Current Battery Charger Circuit
  3. Admin-Lavi on Long Range FM Transmitter Circuit (2km)
  4. Sina on Long Range FM Transmitter Circuit (2km)
  5. Admin-Lavi on Long Range FM Transmitter Circuit (2km)

Copyright © 2025 | New Circuit Ideas