I was reading some article where, writer was trying to impress upon the affect of Reaction time on life of athletes, snipers, cricketers and baseball players. Finally he concluded with its effect on life of normal people and I was amazed to see that reaction time had many implications on our day to day life.

For example a slower than normal reaction time while driving can have grave results.

I thought, How can I measure my reaction time?

Following is the result.

Step 1: Things we will need

Following is the list of things we will need to measure our reaction time.

Hardware:

Software:

Above mentioned components must be lying on floor of an electronic hobbyist :).

Step 2: What will be our procedure to measure reaction time(RT)?

There are many reaction time involved with our human body. we have Audio RT , visual RT, Touch RT and many more. In this instructable we will look at measuring

Visual Reaction time.

Procedure of measuring Visual Reaction Time:

Let me clarify that from the list of hardware components that i have mentioned, out of 3 buttons, one button will act as ready button and remaining two buttons will correspond to two LEDs i.e. LED1-->BUTTON1 , LED2-->BUTTON2. which means if LED1 lights up person under test should press BUTTON1 similar is the case for LED2.

Step 3: Putting things together

In the image above you can see the construction of the circuit. let me put up few points here.

Please Note: Pin numbers that I have mentioned above can vary as per your choice, I have just mentioned my preference.

If you have doubt in any of the above steps, just go through attached video.

Step 4: Lets Code

I have attached Arduino code for the instructable, that you can download and start playing but I suggest you write your own. Following are few points that you need to keep in mind while writing your code.

If you have doubt in any of the above steps, just go through attached video.

// set pin numbers:
const int buttonPin1 = 4;     // the number of the pushbutton1 pin
const int buttonPin2 = 2;     // the number of the pushbutton2 pin
const int buttonPin3 = 7;     // the number of the pushbutton3 pin
const int ledPin1 = 8;        // the number of the LED1 anode(+) pin
const int ledPin2 = 12;       // the number of the LED2 anode(+) pin

// Variables will change:
int ledState1 = LOW;         // the current state of the LED1
int ledState2 = LOW;         // the current state of the LED2
int buttonState1;             // the current reading from the input pin1
int buttonState2;             // the current reading from the input pin2
int buttonState3;             // the current reading from the input pin3
int lastButtonState1 = LOW;    // the previous reading from the input pin1
int lastButtonState2 = LOW;    // the previous reading from the input pin2
int lastButtonState3 = LOW;    // the previous reading from the input pin3


// the following variables are long's because the time, measured in microseconds,
// will quickly become a bigger number than can be stored in an int.

unsigned long lastDebounceTime = 0;   // the last time the output pin was toggled
long debounceDelay = 20000;           // the debounce time in micro second

unsigned long randNumber;                 // Generated random number
unsigned long minRandomNumber = 2000;     // minimum number used to specify the range of random number
unsigned long maxRandomNumber = 5000;     // maximum number used to specify the range of random number

unsigned long time1,time2;
int button3Pressed = LOW;
int printcount = 0;

int takeReading = LOW;

//following variable help in reading buttons pins
int reading1;
int reading2;
int reading3;

//following variable help in reading button corresponding to perticular led i.e LED1 --> BUTTON1 and LED2 --> BUTTON2
int oddNumber ;
int evenNumber ;

void setup()
{
      pinMode(buttonPin1, INPUT);
      pinMode(buttonPin2, INPUT);
      pinMode(buttonPin3, INPUT);
      pinMode(ledPin1, OUTPUT);
      pinMode(ledPin2, OUTPUT);
      
      //enabling serial communication
      Serial.begin(115200);
      
      // set initial LED state
      digitalWrite(ledPin1, ledState1);
      digitalWrite(ledPin2, ledState2);
    
      // if analog input pin 0 is unconnected, random analog
      // noise will cause the call to randomSeed() to generate
      // different seed numbers each time the sketch runs.
      // randomSeed() will then shuffle the random function.
      randomSeed(analogRead(0));
}
    
void loop() 
{
      if( printcount == 0)
      {
          Serial.println("press button 3 when you are ready");
          printcount = 1;
          takeReading = LOW;    // not to read button number 1 and 2
          oddNumber = LOW;
          evenNumber = LOW;
      }
      
      if( button3Pressed == HIGH)
      {
          digitalWrite(ledPin1, LOW);
          digitalWrite(ledPin2, LOW);
          randNumber = random(minRandomNumber,maxRandomNumber);     //in our code we have kept them as 2000 to 5000
          delay(randNumber);
          if ( randNumber & 1 == 1)
          {
              digitalWrite(ledPin1, HIGH);
              digitalWrite(ledPin2, LOW);
              time1 = micros();
              //Serial.println("ODD");
              oddNumber = HIGH;
          }
          else
          {
              digitalWrite(ledPin1, LOW);
              digitalWrite(ledPin2, HIGH);
              time1 = micros();
              //Serial.println("EVEN");
              evenNumber = HIGH;
          }
          button3Pressed = LOW;
          
      }

      reading3 = digitalRead(buttonPin3);         //read button3
      
      if(takeReading == HIGH)
      {
          if(oddNumber == HIGH)
              reading1 = digitalRead(buttonPin1);
          if(evenNumber == HIGH)    
              reading2 = digitalRead(buttonPin2);
      } 
    
      // If the switch changed, due to noise or pressing:
      if (reading1 != lastButtonState1 || reading2 != lastButtonState2 || reading3 != lastButtonState3) 
      {
        // reset the debouncing timer
        lastDebounceTime = micros();
      }
      
      if ((micros() - lastDebounceTime) > debounceDelay) 
      {
          // whatever the reading is at, it's been there for longer
          // than the debounce delay, so take it as the actual current state:
          // if the button state has changed:
          if (reading1 != buttonState1)
          {
                buttonState1 = reading1;
                
                // only toggle the LED if the new button state is HIGH
                if (buttonState1 == HIGH) 
                {
                  Serial.print("Your reaction time is: ");
                  Serial.print(lastDebounceTime - time1);
                  Serial.println("us");
                  Serial.println();
                  printcount = 0;
                }
          }

          if (reading2 != buttonState2)
          {
                buttonState2 = reading2;
                
                // only toggle the LED if the new button state is HIGH
                if (buttonState2 == HIGH) 
                {
                  Serial.print("Your reaction time is: ");
                  Serial.print(lastDebounceTime - time1);
                  Serial.println("us");
                  Serial.println();
                  printcount = 0;
                }
          }

          if (reading3 != buttonState3)
          {
                buttonState3 = reading3;
                
                // only toggle the LED if the new button state is HIGH
                if (buttonState3 == HIGH) 
                {
                  Serial.println("READY TO GO");
                  button3Pressed = HIGH;
                  takeReading = HIGH;
                }
          }
      }
    
      // save the reading.  Next time through the loop,
      // it'll be the lastButtonState:
      lastButtonState1 = reading1;
      lastButtonState2 = reading2;
      lastButtonState3 = reading3;

}

Step 5: Testing time

All set, call your friends and lets see who is the fastest. Prepare chart take average (better make arduino do that) and declare the winner. I have attached my demo video feel free to have a look. Average visual reaction time for us is around 250 ms.

PS: if its more than this after drinks, please don't drive.