A bit of background. My brother came to me with an odd box that a friend of his asked someone to make so that they can determine the fastest contestant to push a button. The box consisted of some LEDs, two buttons, and two sets of bicycle bells that made some weird noises. It did light up and make noises, but it did not actually serve the purpose it is made for, which is to actually determine the first competitor to push the button. I told him that I can help, and I searched for an tutorial or a tutorial to make something of the sort using Arduino, however, not knowing the exact name of what I’m searching for didn’t help much, so I set on making one combining whatever it is that I know about Arduino which is not much. Once I finished the project, I found out that it is called a quiz buzzer system (I was searching for a competitors button box), and that there are some cool samples in tutorials that could have saved me a lot of time, but I managed to make something, and I would like to share it with everyone, so here it goes.
Step 1: Prototype Components
As a proof of concept, I had to prototype the whole thing. I used the following items:
- Arduino Nano Clone
- 4 LED lights (it helps if they are of different colors. I used white, green, yellow, and blue)
- Jumper wires
- 2 push buttons
- 2x 5K resistors
- A breadboard
Step 2: The Actual Box Components
So I am not interested in jailing the nano in a plastic box for eternity. I will make an Arduino on breadboard to do the job, and for this, the components are as follows.
For the circuit I used:
- PCB (I use a 5×10 cm pcb)
- 1x ATMega 328P-PU
- 6 green LEDs
- 1 red LEDs
- 5 blue LEDs
- 1x 16MHz crystal
- 2×10 uF capacitors
- 2x 5K resistors
- 10 meters of 2 core telephone wire
- 2x quick release switches
- 1 female micro USB connector
- 1 on/off switch
The tools I need are a soldering iron, solder, and access to a CNC machine.
Step 3: Sketch Logic
To be able to make sense of the loops and actions that will take place. I drew it on paper, but I think this is a clearer view of the way I envision the whole thing to work.
Step 4: Making the Prototype
I used the components I had to wire the prototype. It goes this way:
- Place the Arduino on the breadboard
- Place the push buttons
- Connect the resistors to ground and one leg of each button
- Connect the other push button leg to +Ve (I will use 3V3)
- Connect the Arduino 3V3 pin to the +Ve rail of the breadboard and the GND pin to the GND rail of the breadboard
Now you need to figure out the pins you will use. In my code I used the following pins:
- First player LED: 8
- Second player LED: 9
- Green LED: 10
- White LED: 11
- First player button: 12
- Second player button: 13
- Connect each LED to the pin and ground
For the buttons, connect PIN 12 to the leg opposite of the resistor for player 1 button, and PIN 13 to the leg opposite of the resistor for player 2 button. The Fritzing sketch should show the whole thing very clearly.
Step 5: The Code
So the diagram in step 2 will give you an idea of how the whole thing works. The code required to make it happen is rather simple, and I have attached it here for you.
One thing to note. The white LED is actually red in the code.
Upload the code to your arduino, and move to the next step