PIR Motion Alarm

A PIR module detects changes in infrared radiation and triggers an armed alarm.

← All project briefs

Safety and scope

This is an educational demonstrator and is not a certified security system.

Plan, predict and test

Suggested virtual study time: about 20 minutes. This is a planning estimate, not a validated construction time.

Preparation: Foundation electricity and basic programming logic. Adult supervision for children. Review a foundation lesson ↗

Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.

  1. Scenario: Simulate PIR LOW, HIGH and warm-up states. Create a table of idle, motion and not-ready.
  2. Expected result: Do not trust the motion decision during warm-up.
  3. Checkpoint: Write your prediction, test it in the virtual model and explain any difference.

Knowledge check

Can PIR reliably detect stationary occupancy?

A correct answer does not certify the physical system.

Record your validation

Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.

CaseWhat to record
Normal inputD2 HIGH → LED ON; LOW → OFF
BoundaryA logic transition changes the indicator on the next sample
Missing or invalid inputThe sketch does not model PIR warm-up or detect a disconnected input. Use a separate ready/valid flag in a real design.
Repeat testRepeat the virtual test, record the actual output and compare with the expected result.

These are test-planning requirements, not recorded hardware results.

Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.

What it does

Demonstrate motion detection, alarm arming and timed outputs in a small security-themed prototype.

Engineering principle

A PIR sensor detects changes in infrared energy across its field of view. It produces a digital output when movement is detected. The controller checks that the system is armed before activating an LED and buzzer for a configured duration.

Hardware and components

  • Arduino Nano or UnoReads the PIR output and arming control.
  • HC-SR501 PIR moduleDetects movement; sensitivity and hold time are adjustable on the module.
  • Active buzzer and LEDProvide audible and visual alarm feedback.
  • Arming switch or pushbutton (optional)Enables or disables the alarm state.
  • Low-voltage supply and wiringPower the sensor and controller.

Suggested build sequence

  1. Allow the PIR module its startup stabilisation period.
  2. Adjust sensitivity and hold time using the module controls.
  3. Read the PIR output and confirm the active logic level.
  4. Use an arming state to decide whether motion should trigger the alarm.
  5. Add a timed alarm and a clear disarm/reset action.

Learning outcomes

  • PIR sensing
  • Digital event handling
  • State variables and timers
  • False-trigger testing

Possible upgrades

Add entry/exit delay, a keypad, multiple zones or local event logging.

Practice the core principle

This simplified exercise is not the full physical project shown above. Test in simulation first; verify real hardware against its datasheet. Children need adult supervision.

Reference components

  • Arduino Uno
  • Compatible PIR module
  • LED
  • 330 Ω resistor
  • Jumper wires

Connection plan

  • PIR OUT → D2 (verify compatible voltage)
  • PIR VCC → specified module supply
  • PIR GND → GND
  • D8 → LED through 330 Ω; cathode → GND

Reference sketch

const int pir=2, led=8;
void setup(){
  pinMode(pir,INPUT);
  pinMode(led,OUTPUT);
}
void loop(){
  bool motion=digitalRead(pir)==HIGH;
  digitalWrite(led,motion?HIGH:LOW);
  delay(50);
}

How the code works

  1. pir and led are pin assignments.
  2. setup selects input/output modes.
  3. digitalRead samples motion output.
  4. digitalWrite reflects the sampled state; delay sets sampling interval.

Practice sequence

  1. Check module voltage and output specifications.
  2. Disconnect power, connect signal, power and common ground.
  3. Connect the indicator with its series resistor.
  4. Allow PIR warm-up, then test moving and stationary conditions.

Expected result

Observe LED on motion detection and off after module hold time.

Troubleshooting

If always on, allow warm-up and check sensitivity/hold-time settings.

Independent challenge

Count motion detection transitions without counting every sample.

Related briefs