IoT-Based Light Control System
_____________________________________________________________
Submitted to:
Muhammad Sarfraz
Submitted by:
1. Introduction
In the age of smart homes and automation, the demand for intelligent lighting systems has surged.
This project introduces an advanced IoT-Based Smart Light Control System that integrates
motion detection, remote control, and automation to reduce energy consumption and enhance
convenience. By leveraging microcontrollers like Arduino and Raspberry Pi, this system forms
the foundation of modern, connected environments.
2. Hardware Components and Estimated Costs
The following components were used to build the system:
[Link]. Component Estimated Cost
(PKR)
1 Raspberry Pi 3/4 10,000 – 15,000
(optional)
2 PIR Motion Sensor 250 – 400
3 Relay Module (1- 400 – 700
Channel)
4 AC Bulb + Wiring 600 – 1,000
5 Breadboard & 300 – 500
Jumper Wires
Raspberry Pi:
Mini computer used for advanced processing, data logging,
or remote access (optional for basic setups)
PIR Motion Sensor:
Detects movement by sensing infrared radiation from objects
like humans.
Relay Module (1-Channel)
Acts as a switch to control high-voltage devices (like an AC
bulb) using low-voltage signals from Arduino.
AC Bulb + Wiring
The output device that lights up when motion is detected.
Breadboard & Jumper Wires
Used for making temporary circuit connections without soldering.
3. System Architecture
The system architecture is modular and flexible. The motion sensor detects movement and sends
signals to the controller (Raspberry Pi). The controller processes this input and toggles the relay
module, which controls the AC light. If IoT functionality is implemented, the Raspberry Pi
enables communication with a mobile or web interface for remote control.
Key Elements of the Architecture:
- Input Layer: PIR Sensor
- Control Layer: Raspberry Pi
- Output Layer: Relay controlling AC Light
- Optional IoT Layer: Remote access via mobile/web apps
4. Software Tools and Platforms
Several software tools and development platforms were used:
- Arduino IDE: For programming Arduino in C/C++.
- Thonny or VS Code (for Raspberry Pi): For Python-based scripting.
- Blynk App or Web Dashboard: For creating IoT dashboards.
- MQTT or HTTP Protocol: For data communication.
- Linux OS (Raspberry Pi): Hosts Python scripts and IoT services.
- Firebase or Thingspeak (optional): For real-time data logging and analytics.
5. Working Principle and Use Case
When motion is detected by the PIR sensor, the controller activates the relay, turning on the light.
After a set timeout or absence of motion, the system automatically turns off the light. With IoT
integration, users can override or monitor the system remotely. This system is ideal for:
- Home automation (hallways, bathrooms, garages)
- Office spaces to minimize electricity wastage
- Industrial areas for automatic light management
- Elderly care for better safety and convenience
6. Advantages
- Hands-free and automatic control
- Energy-efficient system
- Cost-effective components
- Expandable to smart ecosystems
- Supports both local and remote control
7. Circuit Diagram
8. Code:
import [Link] as GPIO
import time
# Pin Definitions
PIR_SENSOR_PIN = 4
LED_PIN = 17 #
# GPIO Setup
[Link]([Link]) # Use BCM pin numbering
[Link](PIR_SENSOR_PIN, [Link])
[Link](LED_PIN, [Link])
# Initially turn off LEDs
[Link](LED_PIN, [Link])
print("PIR Sensor Setup Complete ")
try:
while True:
if [Link](PIR_SENSOR_PIN):
print("Motion Detected!")
[Link](LED_PIN, [Link]) # Turn ON LED
[Link](5) # Keep LEDs ON for 5 seconds
[Link](LED_PIN, [Link]) # Turn OFF LED1
else:
[Link](LED_PIN, [Link])
[Link](0.5) # Small delay to reduce CPU usage
except KeyboardInterrupt:
print("\nProgram Exited by User")
finally:
[Link]()