Reaction Speed Trainer for Sports Performance
by mathFan in Circuits > Sensors
257 Views, 0 Favorites, 0 Comments
Reaction Speed Trainer for Sports Performance
My sister competes in fencing, where reaction time is crucial. A fraction of a second can mean the difference between landing or missing a touch. I built this training tool to measure her reaction speed and improve eye-hand coordination over time.
The basic idea is that speed in sports is trainable. I'm trying to optimize athlete speed by measuring reaction times, training, and showing results by gathering and analyzing data. This is my entry in the Let There Be Speed contest.
This project uses a Makey Makey to turn aluminum foil pads into a game controller, Python with Pygame for the game logic, and cardboard to create a physical board. The game logs every reaction to a CSV file, and a Python script generates charts showing how reaction time changes with practice. Total cost beyond the Makey Makey: under $5.
Supplies
Electronics:
- Makey Makey Classic with USB cable (and optional USB-A to USB-C connector)
- Laptop (Mac, PC or Linux)
Materials:
- Cardboard (sizable, roughly 24"x20")
- Aluminum foil
- Clear tape
Tools:
- Ruler
- Scissors or craft knife (optional)
Code repository is linked to in Step 5.
How the Makey Makey Works
The Makey Makey turns everyday objects into keyboard keys. It works by detecting when a circuit is completed between one of its pins and ground. When that happens it sends a keystroke to your computer.
No coding is required on the Makey Makey itself. It just emulates a regular keyboard connected to your computer. We use the four arrow keys (up, down, left, and right) for this project and connect them to aluminum foil pads as targets.
One important detail: the athlete must be connected to the Makey Makey's EARTH pin for the circuit to work. In our setup that means holding the ground wire in the non-striking hand.
Building the Target Board
The physical board is simple but important. It should be large enough for quick hand movement between targets, rigid enough to stay put during use, and durable enough for repeated strikes. The board will be placed flat on the ground or table.
Construction steps:
- Cut a single large piece of cardboard as the base (roughly 24x20")
- Cut and fold aluminum foil into four 4x4" squares
- Arrange the four foil squares into a 2x2 grid with about 2" space between (as shown in the picture)
- Tape the foil squares down to the cardboard. A scotch tape donut works well as double-sided tape. However you choose to tape it, make sure that some portion of the foil is loose at the edge to attach the alligator clip.
- Place the board flat on the ground or table in front of your laptop
Connecting the Makey Makey
Now it's time to connect the Makey Makey to the target board. Each foil target connects to an arrow key pin via an alligator clip. The alligator clips come with the Makey Makey kit and are identical aside from color, which is used to distinguish between wires. The mappings between target position and arrow keys are defined in our program, so these connections need to match exactly.
Wiring list:
- Top-left target: Orange clip → UP arrow
- Top-right target: Light green clip → RIGHT arrow
- Bottom-left target: Green clip → LEFT arrow
- Bottom-right target: Red clip → DOWN arrow
- Ground: Grey clip → EARTH (athlete holds this in their free hand)
Use tape to secure the wires in place so that they do not interfere with touching the pads.
Final Physical Setup
Here is the complete setup, assembled and ready to test. Plug the Makey Makey into your laptop via USB. If your laptop only has USB-C ports, you'll need a USB-A to USB-C adapter. The board should light up.
The OS will recognize the Makey Makey as a keyboard. No driver installation is necessary. Close the installation window if one comes up.
To test each connection, hold the ground clip in one hand and touch each aluminum pad in sequence. A small green light should appear next to the corresponding arrow on the Makey Makey. If the pad doesn't register, check the alligator clip has a firm grip on the foil. If nothing registers, try unplugging and replugging the Makey Makey.
Training Game
The reaction time training game is in Python using Pygame. It shows 4 target areas arranged in the same 2x2 grid as the physical targets. When the game lights up a target, the athlete touches the corresponding pad as quickly as possible. The screen briefly flashes green for a correct hit, red for a miss. Meanwhile the software captures every detail for later analysis.
Three modes of play:
- Blitz: 10 reps. The next target appears immediately after each response.
- Random delay: 10 reps. A random pause of 300-1200ms is inserted before the next target, forcing reaction from a standstill.
- Timed: 30 seconds to hit as many targets as possible. This was our primary mode for data collection.
Every rep is recorded as a HIT or MISS. Either way, the game advances to the next target keeping the pace constant.
To run the game:
- Download reaction_trainer.py and requirements.txt
- Install Python 3
- Install the required packages: pip3 install -r requirements.txt
- Run: python3 reaction_trainer.py
All project files are available at my GitHub repo.
Data Collection
The trainer was tested over about a two week period, with multiple sessions across several days. Most sessions used Timed mode (30 seconds per session). In Timed mode the main performance metric is how many correct hits in 30 seconds, which captures an aspect of both speed and accuracy. However, the CSV file created by reaction_trainer.py captures every session across all modes.
Data is appended to a CSV file at the end of each session with timestamp, session ID, rep number, mode, target shown, target struck, reaction time, and result. This makes it possible to analyze speed, accuracy, per-target confusion, and speed vs accuracy tradeoffs. Both hits and misses are logged making it possible to spot a variety of patterns. Example data with some variety is listed below:
timestamp,session_id,rep,mode,target_shown,target_struck,reaction_ms,result
2026-03-06T21:24:58.361931,20260306_212431,39,TIMED,TR,TR,595.9,HIT
2026-03-06T21:24:59.144999,20260306_212431,40,TIMED,BR,TL,647.4,MISS
2026-03-06T21:24:59.994190,20260306_212431,41,TIMED,BL,BL,715.2,HIT
2026-03-06T21:25:00.708459,20260306_212431,42,TIMED,BR,BR,578.7,HIT
2026-03-06T21:25:01.437911,20260306_212431,43,TIMED,BR,BR,595.3,HIT
2026-03-06T21:25:02.489623,20260306_212431,44,TIMED,TL,TL,916.9,HIT
2026-03-06T21:25:03.238332,20260306_212431,45,TIMED,BL,BL,613.6,HIT
2026-03-08T21:00:33.725786,20260308_210030,1,BLITZ,TR,TR,1166.9,HIT
2026-03-08T21:00:34.289580,20260308_210030,2,BLITZ,TL,TL,424.8,HIT
2026-03-08T21:00:34.902191,20260308_210030,3,BLITZ,BL,BL,477.2,HIT
2026-03-08T21:00:35.569814,20260308_210030,4,BLITZ,BL,BL,534.0,HIT
2026-03-08T21:00:36.210020,20260308_210030,5,BLITZ,TL,TL,509.9,HIT
2026-03-08T21:00:36.784857,20260308_210030,6,BLITZ,BR,BR,440.7,HIT
2026-03-08T21:00:37.363120,20260308_210030,7,BLITZ,TL,TL,442.9,HIT
2026-03-08T21:00:37.942919,20260308_210030,8,BLITZ,BR,BR,444.2,HIT
2026-03-08T21:00:38.521279,20260308_210030,9,BLITZ,TL,TL,443.3,HIT
2026-03-08T21:00:39.099102,20260308_210030,10,BLITZ,TR,TR,442.6,HIT
2026-03-08T21:00:47.002781,20260308_210044,1,RANDOM_DELAY,BR,BR,525.1,HIT
2026-03-08T21:00:48.020172,20260308_210044,2,RANDOM_DELAY,BL,BL,442.6,HIT
Analysis & Visualization
A separate Python program (analyze_reactions.py, same GitHub repo linked in Step 5) processes the CSV data and generates four charts as PNG files saved alongside the CSV.
To run it:
- Place analyze_reactions.py in the same folder as your CSV
- You can run with a choice of modes:
- All modes combined: python3 analyze_reactions.py
- Only Timed: python3 analyze_reactions.py --mode TIMED
- You can substitute BLITZ or RANDOM_DELAY in the mode option to analyze those modes separately.
For our testing we used --mode TIMED since that was the main training mode. The script produces four charts:
- Median Reaction Time: line chart plot of the median reaction time. A downward slope indicates the athlete is getting overall faster. Our chart (included above) shows a clear downward trend.
- Reaction Time Spread: boxplot showing reaction time variation in each session. Tighter means more consistent times. Our chart (included above) showed more consistency over time.
- Fatigue: bar chart comparing the first 5 reps to the last 5 reps in each session. When the green bar and red bar are close together it means the athlete is maintaining speed throughout instead of slowing down. In our chart (included above) the gap improved over time showing increased stamina.
- Distribution: histogram of all reaction times with a median. Useful for seeing overall shape but not for tracking improvements.
With about two weeks of training, we saw clear improvement: faster median times, tighter spread, and less drop-off between early and late reps.
What's Next?
This project had good results, but there's plenty of room to take it further:
- Blade-touch targets so the fencer can strike with an actual blade instead of by hand. This has several challenges including grounding and completing the circuit, and durability of the targets.
- New modes to trigger actions off of color or sound instead of target position
- Dashboard app instead of a script to produce charts
- Audio feedback: beep on correct hits and different tone on misses
- Multiple athlete profiles so this could be used at a club
If you build this, try it with your own sport and share the results!