Robotics/electronics

LED Reaction Timer

Measure response time to a randomly delayed LED cue while rejecting early button presses.

The hard part is not timing one button press. It is creating an unpredictable cue, detecting false starts, and separating milliseconds of code timing from human reaction.

Difficulty
Intermediate
Build time
60-90 min
Estimated cost
$0-$15
Age range
11-17
Workspace
A clear table about 90 cm wide

The finish line

What you will build

The timer records five valid reaction trials in milliseconds, detects early presses, and reports an average and best time.

Learning goals

  • Identify how button press after a light cue produces measured reaction time in milliseconds.
  • Construct and explain a human event-to-digital timing result system.
  • Measure how cue type or hand used changes performance.
  • Diagnose losses caused by button bounce and display delay.

Before you build

Materials, tools, and safety

Reuse-material cost: Usually under $5 with an existing kit. Supervision: Adult guidance recommended for wiring and cutting.

Tools

  • Small screwdriver
  • Wire stripper
  • Multimeter
  • Low-temperature glue gun or tape

Low-cost swaps

  • Use alligator-clip leads for a no-solder version.
  • Build and test the mechanism manually before adding electronics.
  • Use a microcontroller board with built-in button and LED for a no-breadboard version.

Wiring table

FromToPurpose
Pin 9LED anode through 220 ΩProvide visual cue with limited current
LED cathodeGNDComplete LED circuit
ButtonPin 2 and GNDProvide active-low response input
USBController and serial monitorSupply power and show results

Project-specific safety

  • Use only the listed low-voltage battery supply; never use mains electricity.
  • Disconnect power before changing wires and stop if a motor, wire, or battery becomes warm.
  • Use low voltage, include the LED resistor, keep screen brightness comfortable, and take breaks rather than repeating for long periods.

Orient the build

Place the build so button press after a light cue is on your left and measured reaction time in milliseconds is on your right. Call the side facing you the front, the far side the back, the tabletop the bottom, and the opposite face the top.

Build it

Step-by-step instructions

  1. Step 1

    Build the cue circuit

    Connect the LED through its resistor and verify polarity.

    Point it toward the player without glare.

  2. Step 2

    Wire the button

    Connect between pin 2 and ground with internal pull-up enabled.

    Mount it firmly.

  3. Step 3

    Test input edges

    Print button state and confirm one press changes HIGH to LOW.

    Add a short debounce interval.

    Builder checkpoint: After test input edges, the first subassembly should stay aligned when handled gently.

  4. Step 4

    Create random waiting

    Choose a 2-5 second random delay after a ready message.

    Keep the LED off.

    Watch for: If this stage binds or drifts, inspect timer resolution before adding more parts.

  5. Step 5

    Detect false starts

    If the button is pressed before the cue, cancel the trial.

    Require full release before reset.

  6. Step 6

    Measure valid response

    Store millis when LED turns on and when a new press arrives.

    Subtract and print the result.

    Builder checkpoint: After measure valid response, operate the build slowly and confirm that measured reaction time in milliseconds begins without binding.

  7. Step 7

    Collect five trials

    Record each valid result and ignore only clearly labeled false starts.

    Allow a rest between trials.

  8. Step 8

    Report summary

    Calculate average and minimum valid time.

    Explain why more trials improve confidence.

    Builder checkpoint: At the final checkpoint, The timer records five valid reaction trials in milliseconds, detects early presses, and reports an average and best time.

See the engineering

Why it works

Input
button press after a light cue
Output
measured reaction time in milliseconds
Motion
human event-to-digital timing result
Energy losses
button bounce, display delay, false starts, timer resolution
LED Reaction Timer concept diagram with labeled input, output, and motion arrows.
The human event-to-digital timing result motion path, with the main efficiency losses called out.

Why this works

Elapsed-time measurement

The program stores the cue time, waits for a new button edge, and subtracts timestamps. A random pre-cue delay prevents anticipation from replacing reaction.

Look for: Compare the distribution of five trials rather than treating one fastest press as the whole result.

Where the energy goes

Efficiency and losses

The ideal model leaves out button bounce, display delay, false starts, timer resolution. These effects turn some input energy into heat, sound, vibration, or unwanted motion, so measured performance will be lower than an ideal calculation.

Look for: Run the build slowly and locate the first place where button bounce becomes visible or audible.

Math bite

Calculate average reaction time

Formula: average = sum of valid times / trial count

  • Times = 245, 260, 238, 275, 250 ms
  • Trial count = 5

Substitute: average = 1268 / 5 = 253.6 ms

Result: Average reaction time is about 254 milliseconds.

The best single trial does not represent consistency.

Button and software timing add small delays.

reaction_timer.ino

A complete serial reaction timer with false-start handling and five-trial average.

const int ledPin=9, buttonPin=2; long total=0; int validTrials=0;
bool pressed(){ return digitalRead(buttonPin)==LOW; }
void waitRelease(){ while(pressed()) delay(5); delay(30); }
void setup(){ pinMode(ledPin,OUTPUT); pinMode(buttonPin,INPUT_PULLUP); Serial.begin(9600); randomSeed(analogRead(A5)); }
void loop(){
  if(validTrials>=5){ Serial.print("Average ms: "); Serial.println(total/5.0); while(true){} }
  Serial.println("Ready"); waitRelease(); unsigned long waitTime=random(2000,5001), start=millis();
  while(millis()-start<waitTime){ if(pressed()){ Serial.println("False start"); waitRelease(); return; } }
  digitalWrite(ledPin,HIGH); unsigned long cue=millis();
  while(!pressed()){} unsigned long reaction=millis()-cue; digitalWrite(ledPin,LOW);
  Serial.println(reaction); total+=reaction; validTrials++; waitRelease(); delay(800);
}
Brick-building meme reading: Chuck Norris does not build LEGO; he roundhouses the bricks into sculptures.
The timer said 254 milliseconds. The button said it had been ready for hours.Image supplied by the site owner.

Make it behave

Test, troubleshoot, and tune

Controlled test

Start here: Confirm false-start detection before collecting valid data.

Success looks like: Five valid trials are timed and early presses are rejected.

Measure: Reaction time, false starts, average, best, and range.

Change: cue type or hand used

Keep constant: same participant, button, delay range, posture, code, and room

  1. dominant hand
  2. non-dominant hand
  3. audio cue if available
Troubleshooting guide
SymptomLikely causeConfirm itFix
Times read zeroA held button is accepted as a new pressLog button edgesRequire release before cue
Every trial is a false startInput polarity or pull-up logic is wrongPrint raw state without game codeInvert logic or rewire
Results vary impossiblyButton bounce creates extra edgesWatch serial timestampsAdd edge debounce
The delay repeatsRandom seed is constantCompare sequences after resetSeed from an unused analog input or entropy source

Choose your tradeoff

Make the cue and input logic reliable before comparing people or conditions. More smoothing can reject bounce but adds measurement delay.

Keep experimenting

Try another version

Easier

Three trials

Show each time with no average.

Performance

Consistency score

Calculate range or standard deviation.

Advanced

Two-choice reaction

Use two cues and two buttons, scoring both speed and correctness.

Build together

Classroom and access options

Classroom version

Teams can compare cue type or hand used while keeping same participant, button, delay range, posture, code, and room. Assign builder, tester, recorder, and explainer roles; have each team predict the result before collecting three trials.

Access adaptations

  • Color-code and label every wire at both ends.
  • Use clip leads, larger controls, and pre-crimped connectors when fine motor work is difficult.
  • Offer an audio buzzer cue or large external switch and compare within the same cue type only.

Reflect on the design

  1. How did cue type or hand used change the measured result?
  2. Where did button bounce affect the build most strongly?
  3. What evidence shows that elapsed-time measurement explains the motion?
  4. Which change would improve measured reaction time in milliseconds without creating a new problem?
Glossary
Elapsed-time measurement
The program stores the cue time, waits for a new button edge, and subtracts timestamps.
Input
The action or energy supplied to a system; here it is button press after a light cue.
Output
The useful response produced by a system; here it is measured reaction time in milliseconds.
Efficiency
The fraction of input energy that becomes useful output instead of friction, sound, heat, or unwanted motion.

Build your dreams

One build can start the next.

Share what you learned, change one variable, and help another builder understand what worked.

Explore more guides

Sources and build notes

A platform-agnostic low-voltage robotics or electronics project with original assembly guidance.

  • Low-voltage design review: Battery voltage, polarity, component roles, current paths, and motor or LED protection were editorially checked.

Written and edited by BrickLabClips. Published 2026-07-22; updated 2026-07-22.

Next builds

Related guides