DIY Handheld Electronic Game    



I wanted this game. It's just a little game that counts how many times you can press a button in 10 seconds.  I was also looking for a project to really use my STK500.  It's been a long time since I've written any thing for a micro-controller, and I wasn't very good at it when I did.  I'm also much worse at hardware type things, and my soldering skills are laughable. 

I randomly chose to use at the Atmel ATTiny2313 micro-controller for this project.  Honestly, the choice was purely random.  As luck would have it, this turned out to be a great choice.  They only thing I can complain about now is that it only has 2k of memory, and that's more a commentary on my coding skills than anything; 2k of memory should be plenty for this project.  In fact, I still believe the 2312 to be overkill for this project, but I still really like it.

I thought I needed 5 volts to power my 2313, so I started looking at batteries, but couldn't figure out a good way to get 5 volts out of them.  I found this page explaining how to build a 5 volt power supply, using the LM7805 and a capacitor.  I connected the ground to the GND pin on the 2313, and the output pin to the Vcc pin.  It seems to have worked well, although the LM7805 does get pretty hot when hooked up to a 9 volt battery.

I connected the negative end of 7 leds to port B (0-6). Then I connected all 7 positive ends together, then connected a small resistor (brown green brown, which I think is 150 ohms) between the positive ends and the output voltage of the LM7805.

I connected two push button momentary switches to port D (0-1) and to resistors (100 ohms) which I connected to the ground pin of the LM7805.

I found a power switch and chucked it between the battery clip and the input voltage on LM7805.

 The fun part, and the part I felt slightly less incompetent about was the code.  I wound up writing 4 different games.  The first counts how many times I can press a button in a certain amount of time.  The second game is a targeting game.  The third game is a two player tug of war style game.  The fourth (and the best in my opinion) is kind of a rhythm/pong game.  There are some bugs in the software (most noticeable in the 4th game), and hopefully I'll fix them soon.