Automatic Room Light Controller Using Arduino | DIY Smart Light Project
Automatic Room Light Controller Using Arduino
An Automatic Room Light Controller Using Arduino is a smart electronics project that turns a room light ON automatically when someone enters the room and turns it OFF when no motion is detected. This project is useful for smart homes, energy saving, classrooms, offices, washrooms, and DIY automation learning.
In this tutorial, you will learn how to build an Arduino-based automatic light controller using a PIR motion sensor, relay module, and Arduino UNO.

What is an Automatic Room Light Controller?
An automatic room light controller is a smart circuit that controls a light without manual switching. When the PIR sensor detects human movement, it sends a signal to the Arduino. The Arduino then activates the relay module, which turns ON the connected light.
When no motion is detected for a selected time, Arduino turns the relay OFF, and the light goes OFF automatically.
How This Project Works
This project works in a simple way:
- The PIR sensor detects human motion.
- The sensor sends a HIGH signal to Arduino.
- Arduino turns ON the relay module.
- The relay switches ON the room light.
- When no motion is detected, Arduino waits for a few seconds.
- After the delay, Arduino turns OFF the relay and the light.
Components Required
| Component | Quantity | Purpose |
|---|---|---|
| Arduino UNO | 1 | Main controller |
| PIR Motion Sensor | 1 | Detects human movement |
| 5V Relay Module | 1 | Controls AC/DC light |
| LED Bulb / Lamp | 1 | Output light |
| Jumper Wires | As required | Connections |
| Breadboard | 1 | Testing circuit |
| 5V Power Supply | 1 | Power source |
Circuit Connections
PIR Sensor to Arduino
| PIR Sensor Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | Digital Pin 2 |
Relay Module to Arduino
| Relay Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| IN | Digital Pin 8 |
Relay to Light Connection
- Connect the live wire of the power supply to the relay COM terminal.
- Connect the relay NO terminal to one terminal of the bulb.
- Connect the other bulb terminal to the neutral wire.
Arduino Code for Automatic Room Light Controller
int pirPin = 2;
int relayPin = 8;
int pirState = LOW;
int motionValue = 0;
void setup() {
pinMode(pirPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW);
Serial.begin(9600);
Serial.println("Automatic Room Light Controller Started");
}
void loop() {
motionValue = digitalRead(pirPin);
if (motionValue == HIGH) {
digitalWrite(relayPin, HIGH);
Serial.println("Motion Detected - Light ON");
pirState = HIGH;
}
else {
delay(5000);
digitalWrite(relayPin, LOW);
Serial.println("No Motion - Light OFF");
pirState = LOW;
}
}
Code Explanation
In this code, the PIR sensor output pin is connected to Arduino digital pin 2, and the relay module input pin is connected to digital pin 8.
When motion is detected, the PIR sensor output becomes HIGH. Arduino reads this signal and turns ON the relay. When motion is not detected, Arduino waits for 5 seconds and then turns OFF the relay.
Adjusting the PIR Sensor
Most PIR sensors have two small adjustment knobs:
- Sensitivity Adjustment: Controls the detection range.
- Time Delay Adjustment: Controls how long the sensor output remains HIGH after motion detection.
For room light automation, adjust the sensor so it can properly detect movement inside the room without false triggering.
Applications of Automatic Room Light Controller
- Smart room lighting
- Automatic bathroom light
- Office energy-saving system
- Classroom automation
- Staircase lighting
- Garage light control
- DIY smart home projects
Advantages
- Saves electricity
- Works automatically
- Easy to build
- Beginner-friendly Arduino project
- Useful for home automation
- Can be upgraded with LDR or IoT control
Common Problems and Solutions
| Problem | Possible Reason | Solution |
|---|---|---|
| Light not turning ON | Wrong relay or PIR connection | Check wiring carefully |
| Relay always ON | PIR sensor delay or active-low relay | Adjust PIR delay or change relay logic |
| False triggering | Sensor facing heat source | Keep PIR away from sunlight or fans |
| Arduino resets | Power supply issue | Use stable 5V power supply |
Project Upgrade Ideas
- Add an LDR sensor so the light turns ON only at night.
- Add an LCD display to show motion status.
- Use ESP8266 or ESP32 for IoT-based light control.
- Add a manual switch for override control.
- Use multiple PIR sensors for large rooms.
SEO Keywords
Automatic room light controller using Arduino, Arduino room light project, PIR sensor Arduino light control, automatic light using Arduino, smart room light controller, Arduino home automation project, PIR sensor relay Arduino project.
Frequently Asked Questions
Can I use this project for AC room light?
Yes, you can control an AC room light using a relay module, but proper safety precautions are required while working with AC voltage.
Can I use a DC LED instead of an AC bulb?
Yes, beginners should first test this project with a DC LED or low-voltage lamp before using AC appliances.
Why is my PIR sensor detecting motion again and again?
This may happen due to high sensitivity, nearby heat sources, or sensor placement. Adjust the PIR sensitivity knob and place the sensor properly.
Can this project save electricity?
Yes, it automatically turns OFF the light when no motion is detected, which helps reduce unnecessary power usage.
Conclusion
The Automatic Room Light Controller Using Arduino is a useful and beginner-friendly smart home automation project. It teaches how to use a PIR motion sensor, relay module, and Arduino together to control a light automatically.
This project is perfect for students, beginners, and DIY electronics lovers who want to start learning practical Arduino home automation projects.