arduino pir sensor wiring diagram

Arduino PIR Sensor Wiring Diagram

By Steven Garcia
AD

Interested in home security or hobbyist electronics? The Arduino PIR (Passive Infrared) sensor is an essential component in DIY motion detection projects. It detects changes in infrared radiation levels, signaling the presence of an object within its detection range. Wire it correctly with your Arduino board, and you're well on your way to creating an effective motion detection system. Let's delve into a step-by-step guide with a comprehensive Arduino PIR sensor wiring diagram.

Before we dive into the wiring process, ensure you have the necessary components: an Arduino board (like Arduino Uno), a PIR sensor (such as HC-SR501 or AM312), jumper wires, and optionally, an LED and resistor for output verification.

Understanding the PIR Sensor

The PIR sensor has three legs: VCC (for power), GND (for ground), and OUT (for data). It has an internal 555 timer and transistors, making it highly sensitive and low-cost. To start, let's learn about its pins and functionality:

AD
Arduino - Czujnik ruchu PIR - Tranzystor.pl - Vortal Elektroniczny
Arduino - Czujnik ruchu PIR - Tranzystor.pl - Vortal Elektroniczny
How to Wire a PIR Motion Sensor to Arduino: Wiring Diagram
How to Wire a PIR Motion Sensor to Arduino: Wiring Diagram
the circuit diagram for a motion sensor that is connected to a light switch with two wires
the circuit diagram for a motion sensor that is connected to a light switch with two wires

1. VCC: Connect this to the Arduino's 5V power pin to supply the sensor with the required voltage.

2. GND: Connect this to the Arduino's GND pin to provide a common ground for the circuit.

the instructions for how to use an arduino pir and motion sensor with arduino
the instructions for how to use an arduino pir and motion sensor with arduino
Electronics Projects
Electronics Projects
Arduino Projects: PIR Motion Sensor - Tutorial45
Arduino Projects: PIR Motion Sensor - Tutorial45

3. OUT: This pin outputs a signal when it detects motion. Connect it to one of Arduino's digital input pins.

Wiring the Arduino PIR Sensor

Now that you're familiar with the PIR sensor's pins, let's proceed with the wiring. Here's a simple and effective Arduino PIR sensor wiring diagram:

AD
  • Connect PIR sensor's VCC to Arduino's 5V.
  • Connect GND to Arduino's GND.
  • Connect OUT to Arduino's digital pin 2 (or any other digital pin).
  • Optional: Connect an LED (positive leg to digital pin 13 and negative leg to GND via a resistor) for output verification.

Arduino Code for PIR Sensor

Use the following Arduino code to read the PIR sensor's data:

Infrared Sensor Tutorial for Arduino, ESP8266 and ESP32
Infrared Sensor Tutorial for Arduino, ESP8266 and ESP32
PIR Sensor Datasheet, Pinout Specifications, Working - Homemade Circuit Projects
PIR Sensor Datasheet, Pinout Specifications, Working - Homemade Circuit Projects
DIY Simple Motion Sensor Alarm Circuit Diagram Using PIR Sensor
DIY Simple Motion Sensor Alarm Circuit Diagram Using PIR Sensor
Bot Verification
Bot Verification
ESP32 PIR Motion Sensor – Detect Motion with Arduino IDE
ESP32 PIR Motion Sensor – Detect Motion with Arduino IDE
50 Arduino Sensors Every Maker Should Know
50 Arduino Sensors Every Maker Should Know
const int PIR_PIN = 2;
void setup() {
  pinMode(PIR_PIN, INPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(PIR_PIN) == HIGH) {
    Serial.println("Motion detected!");
  }
}

Upload this code to your Arduino board. When motion is detected, the Arduino board sends the "Motion detected!" message via the Serial Monitor.

Mounting and Testing the PIR Sensor

Before mounting the PIR sensor, ensure the area you want to monitor is clear of obstructions. position the sensor so its lens faces the detection area. You can modify the detection range and sensitivity settings by adjusting the potentiometers on the sensor.

AD

After mounting, test your motion detection circuit. Position an object or pass through the detection area and observe the serial monitor output. With a correctly wired and mounted PIR sensor, your Arduino board should detect and log the motion.

PIR Motion Sensor With Arduino & LED
PIR Motion Sensor With Arduino & LED
PIR Sensor Datasheet, Pinout Specifications, Working - Homemade Circuit Projects
PIR Sensor Datasheet, Pinout Specifications, Working - Homemade Circuit Projects
HC-SR505 Mini PIR Motion Sensor with Arduino
HC-SR505 Mini PIR Motion Sensor with Arduino
Home Security System using Arduino UNO in Proteus
Home Security System using Arduino UNO in Proteus
Arduino PIR Sensor Circuit and Code Example
Arduino PIR Sensor Circuit and Code Example
Sensitive Arduino Lightning Detector with Homemade Sensor
Sensitive Arduino Lightning Detector with Homemade Sensor
How to Build a Hall Effect Sensor Circuit
How to Build a Hall Effect Sensor Circuit
the wiring diagram for an electronic device that is connected to a light bulb and other electrical components
the wiring diagram for an electronic device that is connected to a light bulb and other electrical components
Arduino - Mini alarm PIR HC-SR501 - Tranzystor.pl - Vortal Elektroniczny
Arduino - Mini alarm PIR HC-SR501 - Tranzystor.pl - Vortal Elektroniczny
Programmatically turn on PIR device with Arduino
Programmatically turn on PIR device with Arduino
PIR Motion Sensor
PIR Motion Sensor
Circuit design Sensor PIR - Tinkercad
Circuit design Sensor PIR - Tinkercad
How to use position wheels with your Arduino - Gadgetronicx
How to use position wheels with your Arduino - Gadgetronicx

Congratulations! You've successfully wired and tested your Arduino PIR sensor. Now, explore more project ideas, such as integrating LEDs, buzzers, or other sensors, or even building custom home security systems. Happy tinkering!

AD