As my first foray into Arduino development, I built a simple toy called a Reaction Time Tester. Designed to be an instructive exercise in construction, the RTT actually turns out to be pretty fun to play with too.
You press the big red button to start play. When the green light comes on, you release the button as quickly as possible, and the RTT displays the number of milliseconds that it took you to react. Repeat 10 times, and your "score" for the "game" is the sum of the 10 individual response times.
Your goal, of course, is to try to minimize your cumulative score. At the end of the game, the top 10 all-time scores (stored in EEPROM) are displayed on the 7-segment display panel. If you are lucky enough to get the low score, LEDs flash admiringly.
The hardware for this project is fairly simple. (As a software engineer, this was one of my core requirements. :)) There are three LEDs and a simple pushbutton switch of the kind you find in arcade consoles. The Yellow ("Get ready!") LED begins to flicker rapidly to prepare the player. At some random time between 2 and 5 seconds later, the Green ("Go!") LED illuminates, signaling the player to release the switch. If the player releases too early, the Red LED comes on, "CHEAT" appears on the display, and the game comes to a humiliating halt.
The display I chose is a very cheap ($4 USD) multi-7-segment display called the HC4LED. You could also make this project with a serial or parallel LCD module, but since I (mostly) only need to display 3- and 4-digit numbers, this suits just fine. I wrote a library for the HC4LED that anyone is welcome to play with.
The microcontroller is Adafruit's Boarduino, which I chose mostly because it is cheaper and smaller than the bonafide Arduino. The finished project fits into a 10 cm cube box.
Item | Supplier |
4x4x3" box | Michael's |
Happ gaming pushbutton | GroovyGameGear.com |
DC Boarduino | Adafruit |
2.1mm 9v power supply | Adafruit |
2.1mm female coax plug | Radio Shack |
LEDs (5mm) | Various |
LED mounts | Jameco |
220 Ohm resistors | Various |
10K Ohm resistor | Various |
HC4LED display module | Hitt Consulting |
In a small box, drill three 1/4" holes for the LEDs, one 1 1/8" hole for the button switch, and a 5/8" x 1 5/8" rectangular hole for the HC4LED display. In the side of the box, make a 7/16" hole for the power connector. Wire the power connector to the Arduino power inputs.
The software for this project makes use of the HC4LED library. The basic flow of the main program is as follows:
This was fun to build and continues to provide some entertainment value for my kids. I'm even building a few for family friends. It's interesting to see the variance between different people's scores. With my lifetime of video game training, I'm not surprised that I have the best average scores (upper 1500s to lower 1600s) of our immediate circle. I was surprised, though, to see that my 11-year-old daughter (scores in the 1700s) can absolutely destroy my baseball and video-game playing 10-year-old son (scores in the 2400s). Why is that? Is it the gender difference? The 18-month age difference? The fact that girls mature faster than boys? With school science fair season rapidly approaching, I can think of a number of interesting research projects that this little box may help bring to fruition.
Mikal Hart
mhcom <at> sundial <dot> com