Arduino PIR motion sensor projects
A PIR sensor watches for heat moving past it — and the three projects here light a lamp, sound an alarm and chime a doorbell.
A PIR sensor does not detect "movement" in the abstract. It compares the infrared the room gives off against the infrared it saw a moment ago, so what it actually notices is a change in heat across its field — which is why it fires when a person walks past and does not fire when a chair is moved slowly.
That single fact makes the PIR the best teaching tool on the list for the idea of a threshold. The four projects here take the same raw signal and apply three different rules to it: light a lamp, sound an alarm unless it has been disarmed, and chime a welcome. The rule is the easy part; understanding why the sensor fired is the lesson.
What you need
The parts below are the ones the most of these projects share. Each project page lists the full set for that build.
| Part | Used by | Why |
|---|---|---|
| 1× buzzer | 3 | The output you can hear working |
| 1× 220Ω resistor | 3 | Limits the current through an LED or a pin |
| 1× Arduino Uno R3 | 3 | The board that runs the sketch |
| 1× PIR motion sensor | 3 | Reads something about the world |
| 1× red LED | 2 | The output you can see working |
| 1× breadboard | 2 | Holds the circuit together without solder |
All 4 arduino pir motion sensor projects
Easiest first. Each card links to the project's own page with the wiring, the parts and the code written out.
Walk past, the light turns on. Stand still, it goes off.
Detect motion with the PIR sensor and sound the buzzer
Motion + armed switch = loud alarm. Disarm first.
A guest walks up to the door — chime + welcome LED
How to use these with a class
These 4 projects run from about 25 minutes to 35 minutes each, and 0 of them are Tier 1 — one component and one idea, which is what a class can finish in a single period.
Each project page carries the full build — the concept, the parts, the wiring one step at a time and the sketch — so a class can work through it without the teacher having to explain every wire.
Every one of them can be practised in the browser simulator first, with the real sketch and a real circuit solver behind it, and the first 15 projects are free with no account.
Common questions
Why does the PIR trigger when nobody is there?
Two usual reasons. The sensor has a warm-up time of about a minute after power-up, and it reacts to heat, so a heater or a window letting in sunlight will trigger it. The rotation adjustment on the board trims the sensitivity.
What is the difference between HIGH and LOW output?
Most PIR modules output HIGH when they detect motion and LOW when they do not. Some are the other way round, so read the module label — the projects here note which one they assume.
Why does the alarm need a disarm switch?
Because the sensor cannot tell a burglar from the person who walks in to turn the light on. The armed switch is the logic: while armed, motion sounds the alarm; while disarmed, it does not. It is a state machine in its simplest form.
Related
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.