Serial at 9600 baudTap a part to see what it does.
Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.
Build it step by step
0 of 4 doneSet the PIR
Jumper to L, both trimmers anticlockwise.
Wire PIR and LED
PIR OUT to D2; LED on D13 through 220 Ω.
Add the display
CLK D4, DIO D5, 5V, GND.
Upload and wait
The PIR needs about 30 seconds after power-up before it is reliable.
How do you build a desk motion counter?
A PIR sensor counts each time someone arrives at a desk and shows the total on a 4-digit display. A button resets it. You need Arduino Uno R3, PIR Motion Sensor HC-SR501, TM1637 4-digit display, LED 5 mm green, Resistor 220 Ω, Tactile push button 6 mm and Breadboard 830 Tie Points. It takes 4 steps and about 40 minutes.
- Level
- Beginner
- Time
- About 40 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- DisplaysBuy
- SemiconductorsBuyLED 5 mm green × 1
- PassivesBuyResistor 220 Ω × 1
- SwitchesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| PIR VCC / OUT / GND | Uno 5V / D2 / GND | Motion signal |
| TM1637 CLK / DIO | Uno D4 / D5 | Display |
| TM1637 VCC / GND | 5V / GND | Power |
| D13 → 220 Ω → LED → GND | Motion light | |
| Button | D3 to GND | Reset count |
Code
Library: TM1637Display by Avishay Orpaz. Set the PIR jumper to L (single trigger) and the time trimmer fully anticlockwise (about 3 s) so one arrival counts once.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <TM1637Display.h>
TM1637Display disp(4, 5);
const int PIR = 2, LED = 13, RESET = 3;
int count = 0;
bool last = LOW;
void setup() {
pinMode(PIR, INPUT); pinMode(LED, OUTPUT); pinMode(RESET, INPUT_PULLUP);
disp.setBrightness(3);
disp.showNumberDec(0);
Serial.begin(9600);
delay(30000); // let the PIR settle
}
void loop() {
bool now = digitalRead(PIR);
digitalWrite(LED, now);
if (now == HIGH && last == LOW) { count++; disp.showNumberDec(count); Serial.println(count); }
last = now;
if (digitalRead(RESET) == LOW) { count = 0; disp.showNumberDec(0); delay(300); }
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Walk up to the desk | LED lights, count goes up by one |
| Sit still | Count does not keep rising |
| Press reset | Display shows 0 |
If it does not work
Counts several times per visit
Jumper on H, or hold time too short: use L and add a 5 s lock-out in code.
Never triggers
Wait the 30 s warm-up, and point the dome at where people move.
Display blank
CLK and DIO swapped.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the desk motion counter?
Arduino Uno R3, PIR Motion Sensor HC-SR501, TM1637 4-digit display, LED 5 mm green, Resistor 220 Ω, Tactile push button 6 mm and Breadboard 830 Tie Points.
How long does the desk motion counter take to build?
About 40 minutes for a beginner maker, in 4 steps.
How do I know the desk motion counter works?
Walk up to the desk: LED lights, count goes up by one. Sit still: Count does not keep rising. Press reset: Display shows 0.
Counts several times per visit: what should I check?
Jumper on H, or hold time too short: use L and add a 5 s lock-out in code.
Never triggers: what should I check?
Wait the 30 s warm-up, and point the dome at where people move.
Display blank: what should I check?
CLK and DIO swapped.
