DIY Reaction Timer
“
Product Information
Specifications:
- Name: DIY Reaction Timer
- Components: Single LED, Single Button
- Connections: LED between pin 12 and GND, Button between pins 7
and GND - Code Example: Reaction Timer Serial
Monitor
Product Usage Instructions
Wiring / Hook-up Guide:
The wiring for this circuit is simple. Connect the LED between
pin 12 and GND using the solderless breadboard. Make sure the LED
leg and the connecting wire are in the same row. Connect the button
between pins 7 and GND.
Example Code:
Upload the example code to your Arduino. Open the Serial Monitor
and press the button as soon as the LED turns on. Data results will
be displayed in the terminal window.
Labs / Examples / Investigation Ideas:
Explore statistics related to reaction times such as fastest
reaction time, slowest reaction time, measures of central tendency
(mean, median, mode), identification of outliers, and understanding
standard deviation.
FAQ
Q: How can I improve my reaction time using this DIY Reaction
Timer?
A: Practice regularly by trying to beat your own reaction time
records. Focus on improving your hand-eye coordination and
reflexes.
Q: Can I customize the components used in this reaction
timer?
A: Yes, you can experiment with different LEDs and buttons as
long as they are compatible with the Arduino board.
“`
Name: _______________________________ Date: ___________
DIY Reaction Timer
Introduction
Mental chronometry is the study of how fast humans react to different inputs. It takes a few hundred milliseconds for the signal to get from your eyes, to your brain, out to your limbs to respond. The reaction timer is a great project to demonstrate this time delay. It also makes for a fun game between friends! According to the team at Human Benchmark1, the average human reaction time is about 215 ms. How fast are you? The principal of the reaction timer is simple: when the user sees the light turn on, press the button! A microcontroller is perfect for this because it can time milliseconds very accurately For this project, we will use an Arduino to be the time-keeper. An Arduino is a small, low-cost, and fast microcontroller that is capable of performing command / instructions at a rate of 16 MHz or roughly 62.5 ns per instruction.
Wiring / Hook-up Guide (Fritzing)
1 http://www.humanbenchmark.com/tests/reactiontime/index.php
learn.sparkfun.com
The wiring for this circuit is simple, it requires a single LED and a single button. Connect the LED between pin 12 and GND using the solderless breadboard. Remember that each row of 5 holes are connected together by an internal metal clip. Make sure that the LED leg and the connecting wire are in the same row. Also, LEDs have a polarity. Make sure that the short leg of the LED is connected to GND.
Similarly, connect the button up between pins 7 and GND.
Example Code
https://codebender.cc/sketch:62303
/******************************************************************** * Reaction Timer Serial Monitor * * Hardware connections: * LED: Pin 12 * Button: Pin 7 * * Upload this example, open up the serial monitor set to 9600 bps. * Push the button as soon as the light turn on. *******************************************************************/
int sound = false
// enables the buzzer
/* Pin out definitions */
int ledPin = 12
// connect LED between pin 12 and GND
int buttonPin = 7
// connect push button between pin 7 and GND
int gameNum = 0
// counter for the games played
unsigned long waitTime // Random “waiting” time before turning on the light unsigned long zeroTime // Zero reference time unsigned long reactTime // Reaction Time
void setup() {
Serial.begin(9600) // setups up communication to talk back to the computer
pinMode(ledPin, OUTPUT) // sets up the ledPin to be an OUTPUT pinMode(buttonPin, INPUT_PULLUP) // Sets the pullup resistor for the button digitalWrite(ledPin, LOW) // sets pin LOW (GND) // prints out the header. Serial.print(“Iter”) Serial.print(“t”) Serial.print(“React (ms)”) Serial.println() Serial.print(“==============”) Serial.println() }
void loop()
{
randomSeed(analogRead(A5)) // Get noise to seed the random number generator
// Use an unused pin for the random noise.
waitTime = random(2000, 3500) // randomTime from 2 to 3.5 seconds
delay(waitTime)
// delay randomTime
digitalWrite(ledPin, HIGH) // turn on LED!
zeroTime = millis()
// set zeroTime reference
while(digitalRead(buttonPin) == HIGH) // holding loop until button is pressed. { }
learn.sparkfun.com
2
reactTime = millis() zeroTime // calculation of reaction time
digitalWrite(ledPin, LOW) // turn off LED!
// Display information to Serial Monitor //
Serial.print(gameNum) Serial.print(“t”) Serial.print(reactTime, 1) Serial.println() delay(1000) // short delay before starting again. gameNum++ }
After uploading this code to your Arduino, open up the Serial Monitor. When the LED turns on, press the button as fast as you can. You should see your data results show up in the terminal window. This is text that the Arduino is printing / sending back to the computer for display.
Labs / Examples / Investigation Ideas
You now have a reaction timer. Great, now what? Here are a few ideas of things to explore:
Statistics: What is your fastest reaction time? What is your slowest reaction time? What is the best measure of your actual reaction time? (Measures of central tendancy -mean, median, mode) How do you identify an “outlier”? What does standard deviation mean?
Bio / Social / Other Science: Does reaction time vary with age? Does reaction time vary with dominant vs. non-dominant hand? Does the color of the light make a difference? Do males vs. females have a difference in reaction time? Internal Clock. How good is yours? How well can you estimate 5 seconds? How about 30 seconds?
Going Further
See if you can add sound to your reaction timer. You’ll need a buzzer and a few extra lines of code. Connect up a buzzer between pins 9 and GND.
In the setup(), add a line that reads: pinMode(9, OUTPUT)
And, to make a tone, use the command: tone(9, 440) // 9 indicates the OUTPUT pin, and 440 is the frequency
To stop the tone, use this command: noTone(9)
learn.sparkfun.com
3
Documents / Resources
![]() |
sparkfun DIY Reaction Timer [pdf] User Guide DIY Reaction Timer, Reaction Timer |
