GIOIA - Karate M5

Overview

▶ Open the TopBox M5 Json to CSV conversion App

TopBox is a reaction-time experiment that measures how quickly participants respond to visual stimuli by hitting a target. The system uses M5 IMU sensors to detect hand movements and impacts.

Hardware Setup

  • LeftImu: Accelerometer on left hand
  • RightImu: Accelerometer on right hand
  • BobImu: Accelerometer on target (punching bag/bob)
  • LeftLed: LED indicator on left side
  • RightLed: LED indicator on right side

Experiment Flow

1. Idle State

  • System waiting for session start
  • All LEDs off
  • No data collection

2. Ready State

Duration: 2 seconds (configurable via autostartDelay)

  • Both LEDs show blue wave animation
  • Participant prepares for trial
  • Auto-advances to trial start if autostart enabled

3. Trial Start

Duration: 2000ms ± 1000ms (randomized via stimulusDelay ± stimulusDelta)

  • LEDs turn off
  • Variable delay creates unpredictability
  • Prevents anticipation
  • Trial object created and sampling begins

4. Trial Stimulus (Active Trial)

Duration: 3 seconds (configurable via trialDuration)

Visual Stimulus:

  • Green LED illuminates on target side (left OR right)
  • Other side remains black
  • Stimulus time recorded

Detection Sequence:

  1. Movement Detection (threshold: 1.25g)

    • System monitors left/right hand IMUs
    • Records leftTime when left hand accelerates above threshold
    • Records rightTime when right hand accelerates above threshold
  2. Hit Detection (threshold: 1.25g)

    • After hand movement detected
    • System monitors bob/target IMU
    • Records hitTime and hitHand when impact detected
    • Rainbow animation shown on both LEDs upon successful hit

Data Sampling:

  • Continuous accelerometer sampling at ~100Hz
  • 500 samples per trial (~5 seconds of data)
  • Records all three IMU channels throughout trial

5. Trial End

Duration: 2 seconds

  • Trial marked as complete
  • Timestamps converted to relative times (ms from trial start)
  • Session data saved
  • Rainbow animation continues

Trial Validation:

  • Complete trial: has stimulus and hit times
  • Incomplete trial: missing hit or moved wrong hand
  • Incomplete trials are retried (moved to end of queue)

6. Session Complete

  • Triggered after all trials completed
  • 5-second rainbow animation on both LEDs
  • Final JSON file saved with format: {totalTrials}_{playerName}_{timestamp}.json
  • Session marked as completed

Session Structure

Total Trials: 48 (default, configurable)

  • 24 left-side targets
  • 24 right-side targets
  • Randomized presentation order
  • Failed trials automatically retried

Key Timing Parameters

Parameter Default Description
autostartDelay 2000ms Ready state duration
stimulusDelay 2000ms Base delay before stimulus
stimulusDelta 1000ms Random variation (±)
trialDuration 3000ms Max time for response
actionThreshold 1.25g Acceleration threshold for detection

Data Output

Each trial records:

  • Trial ID and target side
  • Retry count
  • Timing data (start, stimulus, left/right movement, hit)
  • Hit hand identification
  • Complete accelerometer data arrays (500 samples × 3 channels)

Session file includes:

  • Configuration parameters
  • Player name and timestamp
  • All trial data
  • Completion status
×