My latest project is a Jeopardy! style buzzer for two players. Players press the buttons on either side of the board to activate the buzzer and light the respective LED. Once a player has buzzed in, their LED remains lit for approximately five seconds, during which the other player cannot buzz in. Once the five seconds have expired (and the LED turns off), either player is free to buzz in again.
This project is unique from my previous projects because I have replaced the Arduino Uno board with a low cost ATtiny 85 chip. This chip is similar to the ATMega chip that is the brains of the Arduino Uno, but scaled down. The ATtiny has far fewer digital input/outputs, less memory and runs slower. With a price tag of $2.85 this chip is the perfect replacement for the $25 Arduino Uno, assuming that you using 5 or less inputs/outputs. Additionally, the ATtiny can be powered from a small 3.3 volt coin cell battery, as seen in the above photo.
Here are the materials I used:
(1) ATtiny 85 microcontroller chip
(1) Breadboard
(1) Coin cell battery holder for CR2032 battery
(1) CR2032 battery
(2) Mini push button switches, breadboard compatible
(2) 10mm LEDs (I used 1 red and 1 green)
(2) 10k ohm resistors
(2) 330 ohm resistors
(1) buzzer
Various jumper wires
Here’s a link to the complete list of parts at Sparkfun Electronics: https://www.sparkfun.com/wish_lists/44673. They can be had for around $20.
You’ll need to program the ATtiny85 chip with an Arduino board. The instructions for doing so can be found at the MIT High-Low Tech club site, found here: http://hlt.media.mit.edu/?p=1695. Basically, you configure your Arduino to pass code on to the ATtiny chip.
Here’s the code I wrote the project:
// Jeopardy! style, two person buzzer game for ATtiny85 chip.
// by Joel Swenson, joelswenson at me dot com#define LED1 1 //LED 1 (red) connected to pin 1 on ATtiny
#define LED2 3 //LED 2 (green) connected to pin 3
#define BUTTON1 2 //button #1 red connnected to pin 2
#define BUTTON2 4 //button #2 green connected to pin 8
#define BUZZ 0 // buzzer to pin 0int val1 = 0; //stored val for #1
int val2 = 0; //stored val for #2int old_val1 = 0; //previous stored val for #1
int old_val2 = 0; //previous stored val for #2int state1 = 0; // initial state of button #1
int state2 = 0; // initial state of button #2// Setting up input/output for LEDs and buttons
void setup()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(BUTTON1, INPUT);
pinMode(BUTTON2, INPUT);
pinMode(BUZZ, OUTPUT);
}void loop()
//check button 1 and light 1 if pressed
{
val1=digitalRead(BUTTON1); // detect if the button was pressed
if ((val1 == HIGH) && (old_val1 == LOW))
{
state1 = 1 – state1;
delay(10);
}
old_val1 = val1;
if (state1 == 1) // if the button is pressed
{
digitalWrite(BUZZ, HIGH); //activate buzzer
delay(20);
digitalWrite(LED1, HIGH); //light LED
digitalWrite(BUZZ, LOW); //deactivate buzzer
delay(500); // wait 5 seconds to lock out all buttons
digitalWrite(LED1,LOW); // LED off
state1 = 0; // return the button state to unpressed
} else // if button is not pressed. this part might be unnecessary
{
digitalWrite(LED1,LOW); // turn off light
}
//check button 2 and light 2 if pressed
// same code except varibles, button and LED changed for #2
val2=digitalRead(BUTTON2);
if ((val2 == HIGH) && (old_val2 == LOW))
{
state2 = 1 – state2;
delay(10);
}
old_val2 = val2;
if (state2 == 1)
{ digitalWrite(BUZZ, HIGH);
delay(20);
digitalWrite(LED2, HIGH);
digitalWrite(BUZZ, LOW);
delay(500);
digitalWrite(LED2, HIGH);
state2 = 0;
} else
{
digitalWrite(LED2,LOW);
}
}
If you have any specific questions or suggestions about the project please let me know in the comments.



















