• 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 24 June 2026 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 and when light come, it turn OFF lamp automatic; so no need to press any switch.

Also, it save time and save power and it is small, simple and very low cost system.

Arduino Code:

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:

ComponentsValuesQuantity
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 and also LDR change resistance with light.

In dark, LDR resistance go high and voltage is at A0 go low, then Arduino read low voltage and it send HIGH to transistor base.

After that transistor turn ON like switch and a big current go to relay coil and then relay turn ON and give power to lamp and lamp glows.

Furthermore, in light, LDR resistance go low and voltage at A0 go high and then Arduino read high voltage and it send LOW to transistor base.

Now transistor turn OFF, no current go to relay coil and relay turn OFF and cut lamp power and then lamp goes OFF.

Therefore, 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 and 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:

  • First, take all parts from circuit.
  • Next, connect LDR to 5V and GND with 100k resistor.
  • Then connect middle point to A0 pin.
  • Now connect other coil side to 5V, connect relay common to AC supply and connect relay NO to lamp.
  • Join Arduino GND and relay GND.
  • Also, connect transistor base to pin 8 through 330 ohm.
  • After that, connect transistor emitter to GND and connect transistor collector to relay coil pin through diode D1.

Conclusion:

To conclude, LDR light sensor circuit with Arduino work good to detect light level; also LDR value change when light increase or decrease and Arduino read this value and do action.

Hence, this project simple and useful for automatic light control and light monitoring system.

Filed Under: Arduino Projects, Automation Circuits, 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
Next Post: PIR Motion Detector Circuit using Arduino »

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar




Categories

  • 555 Timer Projects (132)
  • Alarm Circuits (80)
  • Amplifier Circuits (94)
  • Arduino Projects (103)
  • Audio Circuits (189)
  • Automation Circuits (150)
  • Automobile Circuits (40)
  • Battery Charger Circuits (86)
  • DIY Projects (413)
  • Free Energy (12)
  • Heater and Temperature Controllers (32)
  • High Voltage (24)
  • Hobby Circuits (229)
  • Indicator Circuits (63)
  • Inverter Circuits (17)
  • IoT projects (12)
  • LDR Circuits (47)
  • LED and Lamps (201)
  • Meters and Testers (44)
  • Mini Projects (372)
  • Motor Controllers (25)
  • Oscillator Circuits (70)
  • Power Supply Circuits (240)
  • Radio Frequency (8)
  • Remote Control Circuits (12)
  • Renewable energy (20)
  • Security and Protection (127)
  • Sensors and Detectors (234)
  • Solar Circuits (31)
  • Timer Circuits (62)
  • Transistor Circuits (178)
  • Transmitter Circuit (19)
  • Tutorials (31)
  • Voltage Regulator (43)
  • Water Level Controller (10)

Recent Posts

  • Low Current Controlled Battery Charger Circuit using LM723 IC
  • 741 Op-Amp Treble Booster Circuit
  • Simple Diode and Transistor Based Audio Limiter Circuit
  • Simple 500mW Speaker Driver Circuit
  • Easy DIY LM386 Audio Amplifier Circuit

Recent Comments

  1. Admin-Lavi on High Voltage Fence Charger Circuit
  2. egidio grzinic on High Voltage Fence Charger Circuit
  3. Logic OR Gate Circuit using Transistors - Circuit Ideas for You on Automatic Street Light Circuit using LDR
  4. Tony Gallegos on NTC Thermistor Based Temperature to Voltage Converter Circuit
  5. colin on Simple Single Transistor Audio Amplifier Circuit

Copyright © 2026 | New Circuit Ideas