Hardware Hump Day: DIY Game Buzzer for National Trivia Day

Happy National Trivia Day!

Happy National Trivia day, ya nerds! In honor of this very special day dedicated to the great institution of trivia, we have built a four-person game buzzer interface to bring some game show action into your very own living room! The year 2017 has finally arrived, and we all want to do better this year. Why not start by breathing some new life into your game night? An extra competitive edge is guaranteed!

alt text

This DIY game buzzer uses the SparkFun RedBoard connected to four momentary push buttons---each representing a player or team: red, yellow, green and blue. There is an LED for each team in its corresponding color and one speaker. When your game night host asks a question, each team has the opportunity to buzz in. When the first team pushes its button, the corresponding LED will light up for five seconds and a unique tone will play on the speaker for one second. There will also be an indication on the serial monitor as to which team succeeded in buzzing in first. Once the first team manages to press its button, the rest of the players or teams become "locked out" for five seconds so there is no confusion regarding who hit the button first!

alt text

This project is simple and fun to make and use. To get started, you will need to gather the following supplies:

LED - Assorted (20 pack)

COM-12062
$3.95

Breadboard - Full-Size (Bare)

PRT-12615
$6.50

Tactile Button Assortment

COM-10302
$6.50

Resistor 10K Ohm 1/6th Watt PTH - 20 pack

COM-11508
$0.95

Resistor 330 Ohm 1/6 Watt PTH - 20 pack

COM-11507
Retired

Thin Speaker

COM-10722
Retired

SparkFun RedBoard - Programmed with Arduino

DEV-12757
Retired

Resistor 100 Ohm 1/4th Watt PTH - 20 pack

COM-13761
Retired

Jumper Wires Premium 4" M/M - 20 AWG (30 Pack)

PRT-13870
Retired

Use the following diagram to build your circuit. I set up the example as a four-player/team console with each color representing a player/team. However, you can increase or reduce the number of buttons and LEDs to suit your game night crew’s needs.

alt text

Having a hard time seeing the circuit? Click on the wiring diagram for a closer look.

Finally, copy and paste the following code into your Arduino IDE and upload it to your board.

/******************************************************************************
trivia.ino

Melissa Felderman @ SparkFun Electronics
Jan 3, 2017

Description:
game buzzer sketch for four users
******************************************************************************/

//assign buttons to pin
int redBut = 2;
int yelBut = 3;
int bluBut = 4;
int greBut = 5;

//assign LED to pins
int redLED = 6;
int yelLED = 7;
int bluLED = 8;
int greLED = 9;

//initialize button state to 0
int redButState = 0;
int yelButState = 0;
int bluButState = 0;
int greButState = 0;

//locked out state variables
boolean pause = false;
int secs = 5000;

//assign speaker pin
int sound = 12;
int soundSecs = 1000;

void setup() {
  //begin serial communication
  Serial.begin(9600);

  //initialize button pins to input
  pinMode(redBut, INPUT);
  pinMode(yelBut, INPUT);
  pinMode(bluBut, INPUT);
  pinMode(greBut, INPUT);

  //initialize LEDs to output
  pinMode(redLED, OUTPUT);
  pinMode(yelLED, OUTPUT);
  pinMode(bluLED, OUTPUT);
  pinMode(greLED, OUTPUT);

  //initilize LEDs to Off
  digitalWrite(redLED, LOW);
  digitalWrite(yelLED, LOW);
  digitalWrite(bluLED, LOW);
  digitalWrite(greLED, LOW);



}

void loop() {
  if (pause == false) { //only works when buzzers are unlocked

    //read button states
    redButState = digitalRead(redBut);
    yelButState = digitalRead(yelBut);
    bluButState = digitalRead(bluBut);
    greButState = digitalRead(greBut);

    //repeat the following code block for each button included. make sure to update the variable names when copy and pasting this block. 
    if (redButState == 1) { //if red button is pushed
      pause == true; //puts program into lock mode so other players cannot buzz in
      digitalWrite(redLED, HIGH); //lights up corresponding LED
      tone(sound, 900, soundSecs); //plays team tone for one second
      Serial.println("TEAM RED"); //Serial indication of first team to press buzzer
      delay(secs); // five second delay - enforces lockout for other players
      digitalWrite(redLED, LOW); //turn LED off
      pause == false; //turn off lockout mode

    }
    if (yelButState == 1) {
      pause == true;
      digitalWrite(yelLED, HIGH);
      tone(sound, 700, soundSecs);
      Serial.println("TEAM YELLOW");
      delay(secs);
      digitalWrite(yelLED, LOW);
      pause == false;

    }
    if (bluButState == 1){
      pause == true;
      digitalWrite(bluLED, HIGH);
      tone(sound, 500, soundSecs);
      Serial.println("TEAM BLUE");
      delay(secs);
      digitalWrite(bluLED, LOW);
      pause == false;

    }
    if (greButState == 1){
      pause == true;
      digitalWrite(greLED, HIGH);
      tone(sound, 300, soundSecs);
      Serial.println("TEAM GREEN");
      delay(secs);
      digitalWrite(greLED, LOW);
      pause == false;

    }
  }

}

...And just like that, you have your very own game buzzer. With this little project, game night is entirely transformed!

alt text

Feel free to take your game play off the breadboard by fabricating individual buzzers for each player/team!

Have you made a trivia-related project? Share your trivia and game night projects with us on Twitter, facebook, and in the Comments below!