Arduino Maker Series Under 1000: Smart Room Light Automation
Arduino Maker Series Under 1000: Smart Room Light Automation
Welcome to the Arduino Maker Series Under 1000! 💡 This is the third project in the series. Today, we will build a Smart Room Light Automation system that turns your lights ON or OFF automatically based on motion detection and ambient light. It’s perfect for beginners and makers looking to add intelligence to their rooms without spending a fortune.
Table of Contents
- Introduction
- Required Hardware
- Arduino IDE Setup
- Wiring the Components
- Arduino Code
- How It Works
- Testing Your Project
- Advanced Modifications
- Common Issues and Troubleshooting
- Learning Insights
- Conclusion
1. Introduction
This project automates your room lighting using a PIR motion sensor and an LDR (light-dependent resistor). The Arduino reads motion and ambient light levels to decide whether to turn the room light ON or OFF. Benefits include:
- Energy saving by ensuring lights are only ON when needed
- Convenience – lights turn on automatically when you enter the room
- Hands-on experience with sensors, relays, and Arduino programming
2. Required Hardware
- Arduino Uno (or compatible) – ~₹500
- PIR Motion Sensor – ₹50
- LDR (Light Dependent Resistor) – ₹30
- Relay Module (5V) – ₹100
- Jumper wires & Breadboard – ₹100
- LED or Room Light – ₹0–₹200
- Arduino IDE installed on your PC
3. Arduino IDE Setup
- Install Arduino IDE on your PC.
- Connect Arduino Uno using USB.
- Select Arduino Uno under Tools > Board.
- Select the correct COM port under Tools > Port.
- Verify IDE can compile simple examples before uploading.
4. Wiring the Components
Follow this wiring layout carefully:
- PIR Sensor: VCC → 5V, GND → GND, OUT → Digital Pin 2
- LDR: Connect in a voltage divider with a 10kΩ resistor, output to Analog Pin A0
- Relay Module: VCC → 5V, GND → GND, IN → Digital Pin 7
- LED/Room Light: Connect through relay COM & NO pins
5. Arduino Code
Upload this code to your Arduino Uno:
const int pirPin = 2; const int ldrPin = A0; const int relayPin = 7; int lightThreshold = 300; // Adjust for ambient light void setup() { pinMode(pirPin, INPUT); pinMode(relayPin, OUTPUT); digitalWrite(relayPin, HIGH); // Relay OFF initially Serial.begin(9600); } void loop() { int motionDetected = digitalRead(pirPin); int ambientLight = analogRead(ldrPin); Serial.print("Motion: "); Serial.print(motionDetected); Serial.print(" | Light Level: "); Serial.println(ambientLight); if(motionDetected == HIGH && ambientLight < lightThreshold) { digitalWrite(relayPin, LOW); // Turn light ON Serial.println("Light ON"); } else { digitalWrite(relayPin, HIGH); // Turn light OFF Serial.println("Light OFF"); } delay(500); }
6. How It Works
The PIR sensor detects motion. When motion is detected, Arduino checks the ambient light via LDR. If the light level is below the threshold (dark room), Arduino activates the relay to turn ON the light. When no motion is detected or the room is bright, the light turns OFF automatically.
7. Testing Your Project
- Upload the code to Arduino Uno.
- Place PIR sensor where it can detect room entrance.
- Insert LDR in a position representing ambient light.
- Observe light turning ON when entering room in dark conditions.
- Adjust lightThreshold in code for sensitivity.
8. Advanced Modifications
- Add Wi-Fi notifications when light turns ON/OFF.
- Use multiple PIR sensors for larger rooms.
- Integrate dimmable LED lights using PWM.
- Add a manual override button or remote control.
- Log light usage on SD card for energy monitoring.
9. Common Issues and Troubleshooting
- Light not turning ON: Check relay wiring and connections.
- PIR always ON or OFF: Adjust sensor sensitivity or check wiring.
- Ambient light incorrect: Check LDR wiring and resistor value.
- Relay clicking but no light: Verify COM & NO connections and power supply.
- Serial monitor not showing values: Check correct COM port and baud rate 9600.
10. Learning Insights
- Learn how PIR and LDR sensors work with Arduino.
- Understand relays and controlling AC/DC loads safely.
- Practice conditional logic for automated systems.
- Hands-on experience with debugging sensor data.
11. Conclusion
This is the third project in the Arduino Maker Series Under 1000. Your Smart Room Light Automation is now ready! It’s a simple, affordable, and practical project that adds intelligence to your room while teaching you valuable Arduino skills.
By Kaushal Haladi
Comments
Post a Comment