Projects / Desk motion counter

Desk motion counter

Beginner40 minGuided buildReviewed
Arduino UnoD2D4D5D13D3GNDPIRMotion12Count
Serial at 9600 baud

Tap 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 done
  1. UNOmotion

    Set the PIR

    Jumper to L, both trimmers anticlockwise.

  2. UNOmotion

    Wire PIR and LED

    PIR OUT to D2; LED on D13 through 220 Ω.

  3. UNO

    Add the display

    CLK D4, DIO D5, 5V, GND.

  4. UNOmotion

    Upload and wait

    The PIR needs about 30 seconds after power-up before it is reliable.

In short

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

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
PIR VCC / OUT / GNDUno 5V / D2 / GNDMotion signal
TM1637 CLK / DIOUno D4 / D5Display
TM1637 VCC / GND5V / GNDPower
D13 → 220 Ω → LED → GNDMotion light
ButtonD3 to GNDReset 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.

CheckExpected
Walk up to the deskLED lights, count goes up by one
Sit stillCount does not keep rising
Press resetDisplay 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 →

Ask Lark AI

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.