PIR Motion Sensor With Arduino & LED
by 779577 in Circuits > Arduino
62 Views, 0 Favorites, 0 Comments
PIR Motion Sensor With Arduino & LED
This project is a motion-activated LED circuit designed to automatically detect movement using a PIR (Passive Infrared) motion sensor. When motion is detected, the sensor sends a signal to the Arduino, which then turns on the LED. The purpose of this setup is to automate lighting, making it more energy-efficient by activating only when motion is present. It can be used in various applications, such as home automation, outdoor lighting, or basic security systems, where the detection of movement triggers a response. This makes it a practical and straightforward solution for convenience and energy savings!
Supplies
1x Arduino Uno R3 ($42.58 CAD)
1x PIR Motion Sensor ($17.49 CAD (Pack of 5))
1x LED ($16.79 CAD, assorted pack)
1x Resistor (330Ω) ($8.71 CAD)
1x Breadboard ($20 CAD)
3x Male/Female Wires ($9.99 CAD)
Wires ($20.86 CAD)
Set Up the Circuit
Connect the PIR Motion Sensor:
- VCC (PIR) → Connect to 5V pin on Arduino.
- GND (PIR) → Connect to GND pin on Arduino.
- OUT (PIR) → Connect to a digital pin on Arduino (e.g., Pin 7).
Connect the LED:
- Insert the LED into the breadboard:
- Long leg (anode) → Connect to a digital pin (e.g., Pin 8) on Arduino through a 330Ω resistor.
- Short leg (cathode) → Connect to GND.
Power the Breadboard:
- Connect the breadboard's power and ground rails to the 5V and GND pins on the Arduino, respectively.
Write the Code
1) Open the Arduino IDE on your computer.
2) Enter the following code:
3) Connect the Arduino to your computer via the USB cable and upload the code.
Test the Circuit
1) Place the PIR motion sensor in an open area.
2) Power the Arduino by keeping it connected to your computer or through an external power source.
3) Observe the behavior of the LED:
- The LED should turn on when motion is detected.
- The LED should turn off after the motion stops (depending on the PIR sensor's delay settings).
Fine-Tune the PIR Sensor (Optional)
Adjust the sensitivity and delay time of the PIR sensor using the two potentiometers on the module:
- Delay time: Adjust how long the LED stays on after detecting motion.
- Sensitivity: Adjust the range of motion detection.
Troubleshooting Tips
1) If the LED is always on:
- Check the wiring of the PIR sensor and ensure the output pin is connected properly.
- Verify the sensor has had time to calibrate (usually 30–60 seconds after powering up).
- Ensure the PIR sensor is not placed near a heat source or other moving objects.
2) If the LED doesn’t turn on:
- Confirm the LED polarity (long leg to the resistor and digital pin).
- Check the resistor value (use 330Ω or similar).
- Make sure the PIR sensor is detecting motion (check the Serial Monitor for output).