Reaction Time Test

by 1041985 in Circuits > Arduino

8 Views, 0 Favorites, 0 Comments

Reaction Time Test

IMG_E2849.JPG

Test your reflexes with this interactive reaction time game! LEDs light up in sequence using a 4017 chip, and you must press a button as fast as possible. The game records your time, shows it on an OLED screen, and waits for a touch sensor before each new round.

_______________________________________________________________________________________________

Example Serial Output

Setup complete.

Displayed start screen, waiting for touch sensor...

---------------------

Touch detected! Starting game...

Countdown: 3

Countdown: 2

Countdown: 1

GO!

Round 1 - LED 3 ON

Displaying Round 1 | LED 3 ON

Waiting for button press...

Button input received. Time: 412 ms

---------------------

Waiting for touch sensor to continue...

Touch detected, continuing...

...

Game Over!

Round 1 time: 412 ms

Round 2 time: 398 ms

Round 3 time: 420 ms

Round 4 time: 377 ms

Round 5 time: 389 ms

Average Time: 399 ms

---------------------


Supplies

IMG_2820.JPG
IMG_2848.JPG
IMG_E2849.JPG

Arduino Uno/Nano, Any compatible board will work

4017 Decade Counter IC, Controls LED sequence - 1

SSD1306 OLED (128x32, I2C) - 1

LEDs - 4, Any color

White LED - 1

220Ω Resistors - 4, For each LED

Push Button 4, For user response input

Touch Sensor (e.g., TTP223) - 2, Starts and continues rounds

10kΩ Resistor - 4

Breadboard - 1

Buzzer - 1

NPN Transistor - 1

PNP Transistor - 1

Wire, Any Color

Building the Circuit

IMG_2840.JPG
IMG_2829.JPG

Connect the 4017 Decade Counter

  1. Place the 4017 IC in the middle of the breadboard so each pin has room to connect.
  2. Connect pin 8 of the 4017 to GND.
  3. Connect pin 16 of the 4017 to 5V.
  4. Connect pin 14 (clock input) of the 4017 to Arduino pin 10.
  5. Connect pin 15 (reset) of the 4017 to Arduino pin 9.
  6. Connect LEDs to the following output pins on the 4017:
  7. LED 1: 4017 pin 3 (Q0) → 220Ω resistor → LED → GND
  8. LED 2: 4017 pin 2 (Q1) → 220Ω resistor → LED → GND
  9. LED 3: 4017 pin 4 (Q2) → 220Ω resistor → LED → GND
  10. LED 4: 4017 pin 7 (Q3) → 220Ω resistor → LED → GND

Connect the OLED Display

This OLED uses I2C, so only 4 pins are used.

  1. Connect VCC of the OLED to 5V on the Arduino.
  2. Connect GND of the OLED to GND on the Arduino.
  3. Connect SDA of the OLED to A4 on the Arduino.
  4. Connect SCL of the OLED to A5 on the Arduino.

Connect the Push Button

  1. Connect one leg of the button to Arduino pin 12.
  2. Connect the same leg to GND using a 10kΩ resistor (pull-down resistor).
  3. Connect the opposite leg of the button to 5V.

Connect the Touch Sensor

  1. Connect VCC of the touch sensor to 5V on the Arduino.
  2. Connect GND of the sensor to GND.
  3. Connect OUT of the sensor to Arduino pin 7.

Layout

  1. Use your own custom layout
  2. Feel Free To Follow The Pictures And Copy My Layout And Circuitry

Power Up and Upload Code

  1. Plug the Arduino into your computer using a USB cable.
  2. Open the Arduino IDE.
  3. Make sure the following libraries are installed:
  4. Adafruit GFX Library
  5. Adafruit SSD1306
  6. Paste the full game code into the IDE.
  7. Select your board (Uno or Nano) and the correct COM port.
  8. Click "Upload".

Step 7: Play the Game!

  1. When you power on the circuit, the OLED will display "Touch Pads to START".
  2. Touch the capacitive sensor to start the game.
  3. A 3-second countdown will show on the OLED screen.
  4. One of the LEDs will turn on randomly.
  5. Press the button as fast as you can after the LED lights up.
  6. The OLED and Serial Monitor will display your reaction time.
  7. After each round, touch the sensor again to continue.
  8. After 5 rounds, your average time will be shown on the OLED and Serial Monitor.