2. Arduino PIR Motion Sensor Stopwatch with 4-Digit Display

Wiring of the Stopwatch with 4 Digit Display and Sensor

Objective:

Build a smart stopwatch displayed on a 4-digit 7-segment display (5641AS) and controlled by a motion sensor (HC-SR501).
The timer starts on its own, pauses when motion is detected, and resumes only if a second motion is detected at least 20 seconds later.


Components used:

  • 1x Arduino Uno
  • 1x 5641AS 4-digit display (common cathode)
  • 1x HC-SR501 PIR motion sensor
  • 4x 220Ω resistors (one per segment)
  • Jumper wires, breadboard
  • (Optional) Tweezer/screwdriver for adjusting the PIR

How it works:

  1. The timer starts automatically at 0.
  2. When motion is detected, the timer pauses.
  3. A second motion, if detected after at least 20 seconds, will resume the timer.
  4. If the second motion is too soon, it will be ignored.

The display shows minutes : seconds : tenths of seconds.
For example, 1234 : 12 minutes and 34 seconds.


Result:

  • A clean and readable live time display.
  • A motion-based pause/resume system.
  • A great hands-on practice with state logic and time-based decision-making on Arduino.

Code and setup:

  • It uses the SevSeg library to easily control the display.
  • Code logic handles debouncing, timing, and PIR behavior cleanly.
  • Download project file (PIRMotionSensor.ino)

To ensure fast and proper motion detection:

  • Turn the “Time Delay” right potentiometer fully counterclockwise on the PIR sensor.

You can also check my LED control project with a joystick and servo for another use of sensors and feedback.

Comments

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *