Project: Automated Home Lighting System (Light + Motion Based)

:magnifying_glass_tilted_left: Description:

This project creates a smart lighting system that automatically turns lights on when someone enters a room and adjusts brightness based on ambient light.

It’s energy-efficient, cost-effective, and perfect for rooms, corridors, or outdoor lighting.


:light_bulb: Improvements Over Basic Motion Detectors:

  • :white_check_mark: Dual control using both motion and light detection.
  • :white_check_mark: Prevents unnecessary lighting in daylight.
  • :white_check_mark: Expandable for multiple rooms/zones.
  • :white_check_mark: Can connect to relay-controlled bulbs or LED strips.

:toolbox: Required Components:

Component Quantity
Arduino Uno 1
PIR Motion Sensor 1
LDR (Light Sensor) 1
10kΞ© Resistor (for LDR) 1
Relay Module (5V) 1
LED Bulb / Strip (220V or 12V) 1
Breadboard + Jumper Wires as needed
Power Supply 1

:electric_plug: Circuit Diagram (Explanation):

PIR Sensor:

  • VCC β†’ 5V
  • GND β†’ GND
  • OUT β†’ Pin 2

LDR:

  • One leg β†’ 5V
  • Other leg β†’ A0
  • Same leg β†’ 10kΞ© β†’ GND

Relay Module:

  • VCC β†’ 5V
  • GND β†’ GND
  • IN β†’ Pin 3
  • Relay Output:
    • COM β†’ Live wire of power source
    • NO β†’ Bulb’s Live wire
    • Neutral β†’ Direct to bulb

:warning: Caution: Use precautions while connecting AC bulbs. You may test with an LED and battery first.

:brain: Full Arduino Code:

int pirPin = 2;
int ldrPin = A0;
int relayPin = 3;

int lightThreshold = 500; // Tune this as per your environment

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(relayPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int motion = digitalRead(pirPin);
  int lightLevel = analogRead(ldrPin);

  Serial.print("Motion: "); Serial.println(motion);
  Serial.print("Light Level: "); Serial.println(lightLevel);

  if (motion == HIGH && lightLevel < lightThreshold) {
    digitalWrite(relayPin, HIGH);  // Turn ON light
    Serial.println("Motion detected & dark β€” Light ON");
  } else {
    digitalWrite(relayPin, LOW);   // Turn OFF light
    Serial.println("No motion or bright β€” Light OFF");
  }

  delay(1000); // Wait before next reading
}

:white_check_mark: How It Works:

  • The PIR sensor detects human motion.
  • The LDR checks whether the room is dark.
  • If it’s dark and motion is detected β†’ Light turns ON.
  • Otherwise β†’ Light stays OFF.

:gear: Future Upgrades (Optional Ideas):

  • Add Blynk IoT support to control remotely.
  • Add real-time clock for time-based lighting.
  • Use ultrasonic sensor instead of PIR for directional detection.

Useless without a schematic

AI needs more education.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.