In every game, reaction time is crucial. Quick responses to the ball or mouse click lead to victory. To improve response time, eye and hand coordination, I created a small gaming device.
in this instructables we are going to create a credit card-sized portable reaction time game device for better eye and hand condition
After powering up, the user needs to press any of the 4 buttons to start the game. The OLED will display a "press any button" message during this time.
Once any button is pressed, there will be a When I first thought about making this device, I originally thought of making it the size of a credit card. I have tried to fit this project to that extent. Various button configurations were thought of and arrived at. A 3-second countdown is displayed on the OLED screen in reverse order: 3, 2, 1. After the countdown ends, the screen will display "GO."
When the game starts, an LED inside one of the buttons will light up randomly. The user must press the button with the illuminated LED as quickly as possible. The time between the LED turning on and the user pressing the button will measure the reaction time in milliseconds. After registering the first reaction time, we need to wait 0.5 seconds to light up the other switch. This needs to happen 4 times. All four reaction times need to be averaged to show the final reaction time. The switch that needs to be pressed will be random every time. After averaging this reaction time it needs to show this time in milliseconds. If you press any other button you can restart the game
The best i can do is 220ms let me know if you make one
Supplies
- Seeed studio xiao esp32c3
- Slide switch
- B-7000 multi-Purpose glue
- 30 AWG wires
- 8* square led
- push button
- 500 mah battery
- B-7000 Multi-Purpose Glue
Tools
- Soldering iron kit
- Wire cutter
- Third-Hand Soldering Tool
- 3d printer ( black , white,orange PLA)
Step 1: Designing and 3d Printing
When I first envisioned creating this device, I aimed to make it the size of a credit card. . I considered various button configurations and settled on this design. The front panel, bearing my logo, accommodates the OLED module and button tray using the Heat stake method. This should be printed in black. The low-profile buttons incorporate 2 LEDs for illumination and need to be printed in black. The main body houses the microcontroller, battery, and power switch. It also accommodates the front panel button assembly.
I utilized Fusion360 for the design of this project. After designing, I exported it into an .STL file for 3D printing. I used my Anycubic Kobra to Neo 2 for 3D printing all the files, employing PLA for printing all parts of the project in 3 colors. The buttons need to be printed in white for optimal illumination. You can access all design files and the .STL file below."
Step 2: Flashing the Code to Xiao Eps32c3
I always like to upload the code to the microcontroller before assembly. I am using Arduino IDE to flash the code. follow these tutorials for setting up IDE for Seeed Studio XIAO esp32c3 and learn more about this board
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
#define SSD1306_NO_SPLASH
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// Define push buttons and LEDs pins
const int buttonPins[4] = {D0,D1,D2,D3};
const int ledPins[4] = {D7,D8,D9,D10};
unsigned long reactionTimes[4];
int currentRound = 0;
void setup() {
// Initialize buttons and LEDs
for (int i = 0; i < 4; i++) {
pinMode(buttonPins[i], INPUT_PULLUP);
pinMode(ledPins[i], OUTPUT);
digitalWrite(ledPins[i], LOW);
}
// Initialize the OLED display
display.begin(SSD1306_SWITCHCAPVCC,...
Read more »
This is a very nice pretty straightforward project and provided me with my first experience with the very interesting little XIAO esp32c3. My only suggestion is to wire it up before placing it on the box. Also, I wound up using Tinkercad to make the base a couple of mm taller so the fit was a bit easier.