Kunkune

How to Set Up an HC-SR501 PIR Motion Sensor With Arduino

How to Set Up an HC-SR501 PIR Motion Sensor With Arduino

By Kunkune | Published: 2026-10-13

Category: How-to Guides

Wire an HC-SR501 PIR module to an Arduino, adjust its sensitivity and delay pots, and debug false triggers with a clear step-by-step process.

Quick answer

Wire the HC-SR501 with VCC to 5V, GND to GND, and OUT to a digital pin, then cover the lens and wait 30-60 seconds for warm-up before trusting readings. Set both potentiometers to roughly mid-travel first, upload a simple digitalRead sketch, and only then tune sensitivity and delay while watching the serial monitor.

What the HC-SR501 pins actually do

The module has three pins: VCC, OUT, and GND. OUT is a digital signal that goes HIGH when motion is detected, so any Arduino digital input works. The catalog lists the output voltage as 3.3V, which is the logic level the module presents on OUT. That matters if you plan to feed the signal into a 5V-only logic input or a 3.3V board: a 3.3V HIGH is usually read correctly by 3.3V MCUs such as ESP32 or Raspberry Pi, but a classic 5V Arduino Uno treats anything above about 3V as HIGH, so it also works. If you are unsure, measure OUT with a multimeter during a trigger rather than assuming.

The HC-SR501 also has two potentiometers and a jumper. One pot sets sensitivity (detection range), the other sets the delay (how long OUT stays HIGH after motion stops). The jumper selects repeatable or non-repeatable trigger mode. The module needs a warm-up period after power-up; during that time OUT can sit HIGH or toggle, so do not judge the sensor until it settles.

Power supply and wiring choices that prevent noise

The HC-SR501 is happiest on a stable 5V supply. Powering it from the Arduino 5V pin is fine for a single module, but if you add relays, motors, or long wires, use a separate regulated 5V supply and join grounds. A weak or noisy supply is one of the most common causes of random triggering.

Keep the signal wire short, and route it away from motor or mains wiring. If you must run a long cable, twist the OUT and GND wires together or use shielded cable. For a permanent build, solder the connections or use a screw terminal instead of loose jumper wires that can shift.

A minimal Arduino sketch to verify motion

Start with the simplest possible test: read a digital pin and print its state. Connect OUT to pin 2, then upload a sketch that sets pin 2 as INPUT and prints digitalRead(2) to the serial monitor at 9600 baud. Wave your hand in front of the lens and watch the value change. This confirms wiring before you add any logic.

Once the raw reading works, add a short debounce or a state-change check so one motion event does not spam the serial output. For example, only print when the reading changes from LOW to HIGH. That makes the delay pot behavior much easier to observe.

Adjust sensitivity and delay without chasing false triggers

Turn both potentiometers fully counterclockwise first, then bring sensitivity up slowly until the sensor covers the area you need. More sensitivity is not better: it also picks up heat sources, air currents, and pets. The delay pot controls how long OUT stays HIGH after the last motion; set it short for event counting and longer for lighting or alarm hold times.

Make one change at a time and wait for the module to settle. If the output stays HIGH constantly, reduce sensitivity and check that the lens is not facing a window, heater, or moving curtain. If it never triggers, confirm the jumper mode and that the warm-up period has passed.

Step-by-step HC-SR501 Arduino setup

  1. Step 1: Identify the pinout and set the jumper: With the lens facing you, the pins are usually VCC, OUT, GND from left to right, but confirm against the markings on your board. Set the jumper to non-repeatable mode (H) for simple on/off detection, or repeatable mode (L) if you want OUT to stay HIGH while motion continues. Checkpoint: if the markings are unclear, test with a multimeter before connecting power.
  2. Step 2: Wire power and signal: Connect VCC to 5V, GND to GND, and OUT to Arduino digital pin 2. Keep the signal wire short and away from motors or mains cabling. If you use an external supply, tie its ground to the Arduino ground. Common mistake: forgetting the shared ground when using a separate 5V supply.
  3. Step 3: Wait for warm-up: Power the module and wait 30-60 seconds without moving in front of it. The output may toggle during this period; that is normal. Do not adjust pots until the module has settled. Checkpoint: if OUT is still unstable after two minutes, check supply stability and wiring.
  4. Step 4: Upload a minimal read sketch: Set pin 2 as INPUT and print digitalRead(2) to the serial monitor at 9600 baud. Wave your hand and confirm the value changes. Add a state-change check so only transitions print. Common mistake: using INPUT_PULLUP, which fights the module output; use plain INPUT unless your specific module requires otherwise.
  5. Step 5: Tune sensitivity and delay: Start both pots fully counterclockwise. Increase sensitivity until the sensor reliably covers your target area, then stop. Set the delay to the shortest hold time that suits your project. Checkpoint: if false triggers persist, reduce sensitivity and remove heat or moving-air sources from the field of view.
  6. Step 6: Test the final behavior in place: Mount the sensor at the height and angle you will use, then walk through the detection zone several times. Confirm that OUT goes HIGH when expected and drops LOW after the delay. Next step: add debounce or a hold timer in code if you need cleaner event counting.

Product facts

  • HC-SR501 Motion Sensor Module Detector PIR Adjustable: HC-SR501 Motion Sensor Module Detector PIR Adjustable, output voltage 3.3V. A 3.3V logic HIGH is compatible with 3.3V boards and is still read as HIGH by most 5V Arduino inputs, so you can use it with either without a level shifter in typical setups.
  • DC-DC Buck Boost Converter 4-35V to 1.25-25V LM2596S XL6019E1 3A: DC-DC Buck Boost Converter 4-35V to 1.25-25V LM2596S XL6019E1 3A with adjustable output. Useful when your project runs from a battery or a higher-voltage rail and you need a clean, adjustable 5V supply for the PIR module instead of tapping a noisy Arduino rail.

Shop Related Products

DC-DC Buck Boost Converter 4-35V to 1.25-25V LM2596S XL6019E1 3A

DC-DC Buck Boost Converter 4-35V to 1.25-25V LM2596S XL6019E1 3A

$2.94 $4.90

Shop Now
HC-SR501 Motion Sensor Module Detector PIR Adjustable

HC-SR501 Motion Sensor Module Detector PIR Adjustable

$0.97 $1.45

Shop Now