. Arduino-Based Night Security Light System ~ SmartElectronicsDIY

Arduino-Based Night Security Light System

     

Project Title:
👉 Arduino-Based Automatic Night Security Light

Objective:
To automatically turn ON a security light at night when motion is detected, and turn it OFF when there is no motion or daylight.

Concept Used:

  • LDR → Day/Night detection

  • PIR Sensor → Motion detection

  • Arduino → Decision making

  • Relay/LED → Light control


2️⃣ Working Principle (Simple)

  1. LDR checks light condition

    • Day → Light OFF

    • Night → System active

  2. PIR sensor detects motion

    • Motion detected → Light ON

    • No motion → Light OFF (after delay)


3️⃣ Block Diagram 




4️⃣ Required Components (Parts Name)

No.Component NameQuantity
1Arduino UNO1
2PIR Motion Sensor (HC-SR501)1
3LDR (Light Dependent Resistor)1
410kΩ Resistor1
5Relay Module (5V) / LED1
6Bulb / Night Light1
7Jumper WiresAs needed
8Breadboard1
9Power Supply / USB Cable1

5️⃣ Pin Connections

🔌 PIR Sensor

PIRArduino
VCC5V
GNDGND
OUTD2

🔌 LDR

  • One end → 5V

  • Other end → A0

  • 10kΩ resistor from A0 → GND

🔌 Relay / LED

RelayArduino
IND8
VCC5V
GNDGND

6️⃣ Arduino Code (FULL & TESTED)

int pirPin = 2; // PIR sensor int ldrPin = A0; // LDR sensor int relayPin = 8; // Relay or LED int ldrValue = 0; int motionState = 0; void setup() { pinMode(pirPin, INPUT); pinMode(relayPin, OUTPUT); Serial.begin(9600); } void loop() { ldrValue = analogRead(ldrPin); motionState = digitalRead(pirPin); Serial.print("LDR Value: "); Serial.println(ldrValue); // Night condition (adjust value if needed) if (ldrValue < 500) { if (motionState == HIGH) { digitalWrite(relayPin, HIGH); // Light ON Serial.println("Motion Detected - Light ON"); } else { digitalWrite(relayPin, LOW); // Light OFF Serial.println("No Motion - Light OFF"); } } else { digitalWrite(relayPin, LOW); // Daytime Serial.println("Daytime - Light OFF"); } delay(500); }

7️⃣ Output & Result

✅ Light turns ON only at night
✅ Light turns ON only when motion is detected
✅ Saves electricity
✅ Fully automatic security system

0 comments:

Post a Comment