SyncroPulse: LED Therapy Game

Published  November 11, 2024   0
SyncroPulse: LED Therapy Game

This project is a compact and interactive reaction-time training device, which has been developed with two versions to demonstrate its functionality and scalability. The first version, a working prototype, uses an Arduino Mega for initial testing and functional verification. The second version is an improved model using the Sipeed MAIXDUINO AI + IoT Kit. This device maximizes users’ mental and physical fitness by requiring rapid reactions to LED design, making it ideal for users of all ages and skill levels It combines an educational and recreational aspect, making it suitable for personal development and an educational environment.

Impact Statement 

The SyncroPulse: LED Therapy Game is made to help boost thinking skills & how quickly people react. It’s a fun way to do therapy. This game uses cool LED lights and tracks how well players respond in real-time. It's great for training faster reflexes & better hand-eye coordination.

You can play different level, so it works for everyone—no matter their age or skill level. That makes it perfect for a wide range of users in therapy.

Playing this reaction-based game is really helpful for those healing from brain injuries. Plus, it can also help with stress relief & sharpening focus.

This project is all about making cognitive skills & motor abilities, better while having fun by using science!

Components Required

Core Components

Input Components

Output Components

ICs and Expanders

Power Supply

  • Power Module - 5V DC, 2A

Resistors and Wiring

  • 1k Resistors - Required for various pull-up/down configurations and LED current limiting.

  • 28AWG Wires - For connections between components and the microcontrollers.

Supporting Components

To see the full demonstration video, click on the YouTube Video below.

 Properties And Design 

LED display

The device features a sequentially illuminated 8x8 LED matrix, challenging users’ reaction times by requiring them to react quickly to visual stimuli

Version: 1

LED Display

Version: 2

 

LED Display

The user interface

The Arduino Mega version originally used reed switches to capture user input. The Sipeed MAIXDUINO version uses push buttons to test functionality, which can continuously adjust and change the input methods.

Timing and scoring

The device measures the accuracy of when users respond and displays scores, allowing users to track their progress and encourage continuous improvement

Timing Scoring

Adjustable difficulty level

Several complex settings cater for different skill levels, providing fast LED displays for advanced users. This scalable problem ensures continued engagement.

Data Logging (Optional) .

The device has an optional data logging feature for users to track their progress over time, helping them identify strengths and areas for improvement

Hardware Components

  • Sipeed MAIXDUINO AI+IoT Kit with Arduino Mega: Used to maintain and improve performance between both versions of the project.

  • 8x8 LED Matrix: Shows LED patterns for visual feedback challenges.
    Buttons and Reed Switches: Various inputs for user interaction, tested in two versions.

  • Shift Registers (74HC595 and CD4021): Extend the I/O capabilities of the LED and button matrix.
    Power Module (5V, 2A): Provides continuous power to the device.
     

Functions And Functionalities

Starting: When powered ON, the device starts with an LED matrix and displays instructions on the interface, guiding the user on how to start the game.

Interactive games: LEDs light up in random patterns, prompting the user to respond by pressing the corresponding button or triggering a reed switch on the Arduino Mega version.

Time and scoring mode: The device calculates the time between LED activation and user input, and displays scores to promote accuracy and speed.

Level Progress: The customizable level of difficulty allows users to choose fast LED designs, challenging them as their images improve.

Data logging: The data logging feature tracks users’ performance over time, helping them identify progress and adjust training accordingly.

Section Image Description

A block diagram visually represents the interconnections between key components of the system. Here is how the components are arranged in the block diagram.

Components Block Diagram


Microcontroller Block (Sipeed MAIXDUINO/Arduino Mega): Microcontroller Block (Sipeed MAIXDUINO/Arduino Mega).

The central controller controls the input and the LED matrix.
Communicates with shift registers for input and output.

  • Shift Register Section: 74HC595: Used to connect 8x8 LED matrix. It receives serial data from the microcontroller and sends parallel data to the LED matrix. CD4021: Read input from push button (or read switch). It captures parallel button states and sends them to the microcontroller in sequence.

  • LED Matrix Block (8x8): Grid of 64 LEDs arranged in 8x8 configuration. It is controlled by a 74HC595 shift register that brightens specific LEDs in different patterns.
    User input section (pushbutton/reed switch): It provides interfaces for the user. The button or reed switch is used to simulate the response time as the LEDs change pattern. It is connected to the CD4021 shift register to read the input data.

  • Power Supply Section: It provides power for all components (microcontroller, shift register, LED matrix, and buttons). It ensures that the system operates reliably.

How The Components Work Together:

Microcontroller applications: The microcontroller starts the program and sends data to the shift register to detect input from the button to control the LED matrix.

Shift Recording: The 74HC595 sends a series of data to an 8x8 LED matrix, indicating which LEDs should be switched on for the feedback test.

The CD4021 receives synchronized data from the button or readout switch, converts it into a sequence of data that is sent back to the microcontroller for processing

LED array: The LEDs flash in different patterns, flashing randomly to challenge when the user reacts. The microcontroller controls the flashing of LEDs based on user input.

User Input: The user interacts with the device by pressing a button or activating a reed switch in response to LED patterns. These inputs are activated by the shift register and sent to the microcontroller for timing and scoring.

Power supply: A stable power source ensures that all components have enough power and capacity to operate reliably.

CODE :
Version 1:

int ledCols[6] = {33, 34, 35, 36, 37, 38}; // Columns connected to -ve of LEDs
int ledRows[5] = {39, 40, 41, 42, 43}; // Rows connected to +ve of LEDs
int buttonCols[6] = {22, 23, 24, 25, 26, 27}; // Columns connected to one side of buttons
int buttonRows[5] = {28, 29, 30, 31, 32}; // Rows connected to the other side of buttons
int currentCol = -1;
int currentRow = -1;
void setup() {
 // Initialize LED pins
 for (int i = 0; i < 6; i++) {
   pinMode(ledCols[i], OUTPUT);
   digitalWrite(ledCols[i], HIGH); // Set all columns to HIGH (no current flow)
 }


 for (int i = 0; i < 5; i++) {
   pinMode(ledRows[i], OUTPUT);
   digitalWrite(ledRows[i], LOW); // Set all rows to LOW (no current flow)
 }
 // Initialize button pins
 for (int i = 0; i < 6; i++) {
   pinMode(buttonCols[i], OUTPUT);
   digitalWrite(buttonCols[i], LOW); // Set all columns to LOW
 }


 for (int i = 0; i < 5; i++) {
   pinMode(buttonRows[i], INPUT_PULLUP); // Set all rows to INPUT with pull-up resistors
 }
 randomSeed(analogRead(0)); // Initialize random generator
 selectNextLED(); // Select the first random LED
}
void turnOnLED(int col, int row) {
 digitalWrite(ledCols[col], LOW); // Set the column to LOW (enable current flow)
 digitalWrite(ledRows[row], HIGH); // Set the row to HIGH (enable current flow)
}
void turnOffLED(int col, int row) {
 digitalWrite(ledCols[col], HIGH); // Set the column to HIGH (disable current flow)
 digitalWrite(ledRows[row], LOW); // Set the row to LOW (disable current flow)
}
void selectNextLED() {
 if (currentCol != -1 && currentRow != -1) {
   turnOffLED(currentCol, currentRow); // Turn off the previous LED
 }


 currentCol = random(0, 6); // Random column (0 to 5)
 currentRow = random(0, 5); // Random row (0 to 4)
 turnOnLED(currentCol, currentRow); // Turn on the next random LED
}
bool isButtonPressed(int col, int row) {
 digitalWrite(buttonCols[col], HIGH); // Set the column to HIGH
 bool pressed = digitalRead(buttonRows[row]) == LOW; // Check if the button is pressed
 digitalWrite(buttonCols[col], LOW); // Reset the column to LOW
 return pressed;
}
void loop() {
 if (isButtonPressed(currentCol, currentRow)) {
   delay(100); // Debounce delay
   selectNextLED(); // Select the next random LED
 }
}

Version 2:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int ledCols[6] = {33, 34, 35, 36, 37, 38}; // Columns connected to -ve of LEDs
int ledRows[5] = {39, 40, 41, 42, 43}; // Rows connected to +ve of LEDs
int buttonCols[6] = {22, 23, 24, 25, 26, 27}; // Columns connected to one side of buttons
int buttonRows[5] = {28, 29, 30, 31, 32}; // Rows connected to the other side of buttons
int currentCol = -1;
int currentRow = -1;
int score = 0; // Variable to keep track of the score
unsigned long startTime; // Variable to store the start time of the game
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD I2C address
void setup() {
 // Initialize LED pins
 for (int i = 0; i < 6; i++) {
   pinMode(ledCols[i], OUTPUT);
   digitalWrite(ledCols[i], HIGH); // Set all columns to HIGH (no current flow)
 }


 for (int i = 0; i < 5; i++) {
   pinMode(ledRows[i], OUTPUT);
   digitalWrite(ledRows[i], LOW); // Set all rows to LOW (no current flow)
 }
 // Initialize button pins
 for (int i = 0; i < 6; i++) {
   pinMode(buttonCols[i], OUTPUT);
   digitalWrite(buttonCols[i], LOW); // Set all columns to LOW
 }


 for (int i = 0; i < 5; i++) {
   pinMode(buttonRows[i], INPUT_PULLUP); // Set all rows to INPUT with pull-up resistors
 }
 // Initialize the LCD
 lcd.begin(16,2);
 lcd.backlight();
 lcd.setCursor(0, 0);
 lcd.print("Score: ");
 lcd.setCursor(7, 0);
 lcd.print(score);
 lcd.setCursor(0, 1);
 lcd.print("Time: 00:00");
 randomSeed(analogRead(0)); // Initialize random generator
 selectNextLED(); // Select the first random LED


 startTime = millis(); // Record the start time of the game
}
void turnOnLED(int col, int row) {
 digitalWrite(ledCols[col], LOW); // Set the column to LOW (enable current flow)
 digitalWrite(ledRows[row], HIGH); // Set the row to HIGH (enable current flow)
}
void turnOffLED(int col, int row) {
 digitalWrite(ledCols[col], HIGH); // Set the column to HIGH (disable current flow)
 digitalWrite(ledRows[row], LOW); // Set the row to LOW (disable current flow)
}
void selectNextLED() {
 if (currentCol != -1 && currentRow != -1) {
   turnOffLED(currentCol, currentRow); // Turn off the previous LED
 }


 currentCol = random(0, 6); // Random column (0 to 5)
 currentRow = random(0, 5); // Random row (0 to 4)
 turnOnLED(currentCol, currentRow); // Turn on the next random LED
}
bool isButtonPressed(int col, int row) {
 digitalWrite(buttonCols[col], HIGH); // Set the column to HIGH
 bool pressed = digitalRead(buttonRows[row]) == LOW; // Check if the button is pressed
 digitalWrite(buttonCols[col], LOW); // Reset the column to LOW
 return pressed;
}
void updateScore() {
 score++; // Increase the score
 lcd.setCursor(7, 0); // Move cursor to the score position
 lcd.print(score); // Update the score on the LCD
}
void updateStopwatch() {
 unsigned long currentTime = millis() - startTime; // Calculate elapsed time
 int seconds = (currentTime / 1000) % 60;
 int minutes = (currentTime / 60000) % 60;
 lcd.setCursor(6, 1); // Move cursor to the time position
 if (minutes < 10) lcd.print('0'); // Print leading zero for minutes
 lcd.print(minutes);
 lcd.print(':');
 if (seconds < 10) lcd.print('0'); // Print leading zero for seconds
 lcd.print(seconds);
}
void loop() {
 updateStopwatch(); // Update the stopwatch display


 if (isButtonPressed(currentCol, currentRow)) {
   delay(100); // Debounce delay
   updateScore(); // Update the score
   selectNextLED(); // Select the next random LED
 }
}

Conclusion:

Circuit and block diagrams describe how the Sipeed MAIXDUINO / Arduino Mega microcontroller interfaces with shift registers, LEDs, and user inputs to create an interactive response time device. By using shift registers to reduce I/O pin usage, this design ensure that the system remains efficient and scalable. The addition of button or reed switches, adjustable difficulty and added scoring options make the task not only functional but also engaging for users

Demonsytration SyncroPulse LED Therapy Game

Other Features And Specialties:

This project is unique in both conceptual and design aspects, focusing on cognitive training and efficient use of hardware.

Innovation In Thinking:

  • Mental Training: The program increases reaction time, concentration, and hand-eye coordination through fun challenges, suitable for a variety of skill levels.

  • Education and Entertainment: Combines educational intellectual exercises with entertainment, appealing to a wide range of audiences, from schools to home users.

  • Versatile input methods: Uses buttons or reed switches for communication, allowing flexibility based on application needs.

Innovation In Design:

  • Efficient use of I/O: Shift registers (74HC595 for LED and CD4021 for input) reduce pin usage, providing stable communication with minimal hardware requirements.

  • Scalability: The design is amenable to future expansion with more LEDs or buttons, making it easier for different applications.

  • Cost effectiveness: Uses standard, economical components such as shift registers and push buttons, ensuring efficiency and conservation.

This unique combination of conceptual advantage and hardware optimization makes the design innovative and highly functional for real-time communication and scalability

Have any question realated to this Article?

Ask Our Community Members