Creating a Motion-Activated Light with a Passive Infrared Sensor
Passive Infrared (PIR) sensors are widely used in various applications to detect motion. For a
school project, you can create a simple yet effective motion-activated light using a PIR sensor.
This project is not only educational but also practical, as it can be used in real-life scenarios like
home security or automatic lighting systems.
Materials Needed
PIR Sensor: Detects motion by measuring infrared radiation.
Arduino Uno: A microcontroller board to process the sensor’s data.
LED: Acts as the light source that will be activated.
Resistors: To limit the current to the LED.
Breadboard and Jumper Wires: For building the circuit.
USB Cable: To connect the Arduino to a computer for programming.
Step-by-Step Guide
1. Setting Up the Circuit:
o Connect the VCC pin of the PIR sensor to the 5V pin on the Arduino.
o Connect the GND pin of the PIR sensor to the GND pin on the Arduino.
o Connect the OUT pin of the PIR sensor to a digital input pin on the Arduino (e.g.,
pin 2).
o Connect the anode (longer leg) of the LED to a digital output pin on the Arduino
(e.g., pin 13) through a resistor.
o Connect the cathode (shorter leg) of the LED to the GND pin on the Arduino.
2. Programming the Arduino:
o Open the Arduino IDE on your computer.
o Write a simple code to read the PIR sensor’s output and control the LED. Here’s
an example code:
3. int pirPin = 2; // PIR sensor input pin
4. int ledPin = 13; // LED output pin
5.
6. void setup() {
7. pinMode(pirPin, INPUT);
8. pinMode(ledPin, OUTPUT);
9. Serial.begin(9600);
10. }
11.
12. void loop() {
13. int pirState = digitalRead(pirPin);
14. if (pirState == HIGH) {
15. digitalWrite(ledPin, HIGH); // Turn on the LED
16. Serial.println("Motion detected!");
17. } else {
18. digitalWrite(ledPin, LOW); // Turn off the LED
19. }
20. delay(100); // Small delay to avoid bouncing
21. }
22.
23. Testing the Project:
o Upload the code to the Arduino board using the USB cable.
o Once uploaded, the LED should light up when the PIR sensor detects motion.
o You can monitor the sensor’s activity through the Serial Monitor in the Arduino
IDE.
Applications and Benefits
Educational Value: This project teaches the basics of electronics, programming, and
sensor integration.
Practical Use: The motion-activated light can be used in various settings, such as
automatic lighting in rooms, security systems, or even in creative projects like interactive
art installations.
Scalability: You can expand this project by adding more sensors, integrating it with other
devices, or using it as a basis for more complex systems.
Conclusion
Building a motion-activated light with a PIR sensor is an excellent school project that combines
learning with practical application. It introduces students to the world of sensors and
microcontrollers, providing a foundation for more advanced projects in the future. Plus, it’s a fun
and engaging way to explore the principles of electronics and programming.