Tuesday, January 01, 2013

Arduino: Trivia/Game Show Buzzer System

So I have a new addiction: Arduino.

The Arduino is a programmable microcontroller. It's a way to create your own electronics projects at home.  Ever wish you could have you garage door automatically close if you leave it open?  With the Arduino, you can (and I did).  I set up a small sensor that will relay to the Arduino when the garage door is opened. If it is left open for more than 5 minutes, it will close the garage door via a relay switch connected to the garage door opener.  Others have done similar projects in which they even hooked theirs up to their web server so they could close the door via their smartphone.  I didn't have much use for that feature, so I'm perfectly satisfied with my setup.  I've also read about other people making Pumpkin Tetris, security systems, windows that close themselves when a train is coming, and all kinds of cool stuff.  It's for the hobbyist nerd, definitely, but that doesn't make it any less cool.

For my current project, I'm making a trivia buzzer system, like in Jeopardy.  My girlfriend's family plays a few games of trivia like this every Christmas.  It's a lot of fun (I'll admit, I was very skeptical at first), but it's very low-tech in that everyone just raises their hand and her uncle is the judge of who raised their hand first.  It's all for fun, and [usually] no one gets too upset if they think their hand was actually up first.  But because I'm a nerd, I thought about how much cooler it would be if I could set up a system with handheld buzzers that would take some of the heat off her uncle.  At this point, I'm not planning on including scorekeeping, so he won't be entirely without a job.

Here's a short video of the prototype I built:




The final project will most likely include the following:
  • Main Control Box
    • 1 or more rows of LEDs to indicate who has buzzed in.
    • LEDs will have a light-up sequence similar to what's shown in the video ti indicate that contestants may buzz in.
    • Audible buzzer sound when someone buzzes in.
  • 24x Handheld Buzzers
    • Connect to the main control box with a telephone cable.
    • LED(s) on the buzzer itself to indicate that person has buzzed in.
    • Made from 1/2" PVC pipe.
  • 1x Handheld Reset Button for Host
    • After someone has buzzed in to answer a question, no one else can buzz in until the host presses his reset button.
Unfortunately, the biggest pain will be making the actual buzzers and wiring everything inside the control box (which will probably be approximately the size of a shoebox). But I'm pretty excited about it and I'm hoping I'll be able to finish it before the end of the month. 

I'm hoping it will keep me busy enough that I'll be motivated to post updates on here.  Surprisingly, Verbatio has gotten quite a bit of traffic in my absence, mostly due to my post about Cryolipolysis 2 years ago.  I'm happy Google/people seem to have found that post informative, and I'd like to give people a reason to come back.  We'll see if I can stick to being more active now that I'm mostly coasting along on electives until Match Day in March!

Update: Here's the Arduino sketch I'm using.  Note that I still have some of my Serial.print commands in there, but commented out, since I was using those when I was trying to fix some bugs/typos.

/*
 * Define button names and inputs
 */

int alex = 28;
int alexstatus = 1;
int user[] = {
  30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41};
int led[] = {
  42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
int userstatus[] = {
  HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
int i = 0;
int reset = 1; // if =1, then show reset animation.
int buzz = 0;  // if =0, no one buzzed in. =1 when someone has buzzed in.
void setup() 
{
  for (i=0;i<12;i=i+1)
  {
    pinMode(user[i], INPUT);
    pinMode(led[i], OUTPUT);
    digitalWrite(user[i], HIGH);
  }
  digitalWrite(alex, HIGH);
  Serial.begin(9600);
}
void loop()
{
  /* Activate and cycle LEDs to show system was reset */
  while(reset==1)
  {
    for (i=0;i<12;i++)
    {
      digitalWrite(led[i], HIGH);
      //   Serial.println("All LEDs on.");
    }
    delay(200);
    for (i=0;i<12;i++)
    {
      digitalWrite(led[i], LOW);
      //   Serial.println("All LEDs off.");
    }
    for (i=0;i<12;i++)
    {
      digitalWrite(led[i], HIGH);
      //  Serial.print(led[i]);
      //   Serial.println(" is on");
      delay(50);
      digitalWrite(led[i], LOW);
      //   Serial.print(led[i]);
      //   Serial.println(" is off");
    }
    for (i=0;i<12;i++)
    {
      digitalWrite(led[i], HIGH);
      //  Serial.println("All LEDs on.");
    }
    delay(200);
    for (i=0;i<12;i++)
    {
      digitalWrite(led[i], LOW);
      //  Serial.println("All LEDs off.");
    }
    reset=0;
    buzz=0;
  }
  Serial.print("reset=");
  Serial.println(reset);
  Serial.print("buzz=");
  Serial.println(buzz);

  /* Poll inputs to see if anyone has buzzed in yet. */
  while(buzz==0)
  {
    for (i=0;i<12;i++)
    {
      userstatus[i]=digitalRead(user[i]);
  /*    Serial.print(user[i]);
      Serial.print(" is ");
      Serial.println(userstatus[i]);
      delay(200); */
      if (userstatus[i]==0)
      {
        buzz=1;
        digitalWrite(led[i],HIGH);
  /*      Serial.println("Someone buzzed in!");
        Serial.print("buzz=");
        Serial.println(buzz);
        Serial.print("reset=");
        Serial.println(reset);
        Serial.print("alex=");
        alexstatus=digitalRead(alex);
        Serial.print(alexstatus); */
      }
    }
  } 
  /* If someone has buzzed in and is answering, wait for alex to reset the system. */
  while(buzz==1)
  {
    alexstatus=digitalRead(alex);
    if(alexstatus==1)
    {
      buzz=1;
    }
    if(alexstatus==0)
    {
      buzz=0;
      reset=1;
    }
  }

}

5 comments:

tonysix00 said...

Please help me make this. I have arduino but I need this for my students in school, its hard trying to see how slams there hands on the desk first.

RaLuminous said...

hi,

i really like your buzzer system. Is it possible to get your circuit etc.

RaLuminous said...

hi, I really like that buzzer system of yours. Is it possible to get the whole project details (Layout of circuit ...) ?

Efficiency MD said...

Sorry for not getting to your comments earlier. I haven't checked Verbatio in a while (obviously). I can try to draw up the basic circuit I used some time this week.

Efficiency MD said...

I've posted a basic schematic for the buzzer system to get you started.