Automatic Room Lighting System
Automatic Room Lighting System |
Introduction:
An automatic room lighting system is a convenient and energy-efficient way to manage lighting in a room. This system uses sensors to detect the presence of people in a room and adjust the lighting accordingly. By implementing such a system, energy can be saved by turning off lights when a room is unoccupied. Here's a simple design for an automatic room lighting system using passive infrared (PIR) sensors.
Components Required:
- Arduino Uno
- Passive Infrared (PIR) Sensor
- Relay Module
- Breadboard
- Jumper Wires
- LED Bulb
- 220V AC to 5V DC Power Supply
Circuit Diagram:
Working Principle:
The PIR sensor is used to detect the motion of people in the room. When it detects motion, it sends a signal to the Arduino Uno. The Arduino Uno then triggers the relay module to turn on the light. If no motion is detected for a certain period, the Arduino will turn off the light via the relay module.
Arduino Code:
cpp// Pin Definitions
const int pirSensorPin = 2; // PIR sensor connected to digital pin 2
const int relayPin = 3; // Relay module connected to digital pin 3
// Variables
int pirState = LOW; // Variable to store PIR sensor status
int relayState = LOW; // Variable to store relay status
void setup() {
// Initialize the digital pin as an output
pinMode(relayPin, OUTPUT);
// Initialize the digital pin as an input
pinMode(pirSensorPin, INPUT);
// Initialize Serial Communication
Serial.begin(9600);
}
void loop() {
// Read PIR sensor value
pirState = digitalRead(pirSensorPin);
// Check if PIR sensor is triggered
if (pirState == HIGH) {
// Motion detected, turn on the light
digitalWrite(relayPin, HIGH);
relayState = HIGH;
Serial.println("Motion Detected!");
delay(1000); // Delay to avoid multiple detection
}
else {
// No motion detected, turn off the light
digitalWrite(relayPin, LOW);
relayState = LOW;
}
}
Assembly:
- Connect the PIR sensor to digital pin 2 of the Arduino Uno.
- Connect the relay module to digital pin 3 of the Arduino Uno.
- Connect the LED bulb to the relay module.
- Power the Arduino Uno using a 5V power supply.
- Place the PIR sensor in a suitable location in the room where it can detect motion effectively.
Conclusion:
An automatic room lighting system is an effective way to conserve energy and provide convenience by automatically turning on the lights when someone enters a room and turning them off when the room is vacant. This project can be extended further by integrating Bluetooth or Wi-Fi modules to control the lighting system remotely via a smartphone or computer.