It's his birthday this month and since a few years back I am building something for him myself. Two years ago it was a traffic light. Last year I made him a talking clock. (Sorry no instructable for that one, only a vid on my YT channel.) I'd like him to see what fun learning electronics and programming is. If he picks it up, his future will be a bit brighter, there are and will be many jobs for technical people.
The main features are:
• Four games, two of them are multi-player ones
• Zero power drain when off
• Audio on flash memory inside the *uino
• 12 PWM channels (8 bits, 244Hz) for RGB LEDs
• Simple schematic
• It looks very cool, kids love it and it trains their memory a bit!
Step 1: Finding an Enclosure
I looked for a cheap wooden enclosure on a few websites and I couldn't find a nice box for a nice price. Despite I almost never go to a mall, this time I gave it a shot and almost directly hit the jackpot at a store called Xenos. They have nice things for nice prices. The box was almost too pretty to demolish. My mother thought so too and "stole" a few I bought for her own use. No problem mom! ;)
First I was thinking of leaving the top as it is and to mount the buttons and LEDs in the existing holes, but it turns out the thing is not symmetrical. So I measured the inside, corner to corner and drew the same shape in Inkscape. I added holes for the speaker, LEDs and buttons and some text and numbers and sent it to the laser cutter we have at RevSpace. You can also do this manually if you don't have access to a laser cutter. But using a cutter, it fitted perfectly! :)
Now I sprayed the box with a glittery green color and the top with lime acrylic paint. After drying I coated it with a few thin layers of clearcoat. The housing is done!
Step 2: Electronics
I tried to keep the schematic as simple as possible.
If you think it is too hard to build, just omit the power saving part and the diodes of the buttons part. You can play the game now if you power it from USB. You can put the speaker with electrolytic capacitor in series directly on pin 9, but that's officially not within specs of the AVR chip.
For the minimum setup you will need:
- *uino nano or other, does not really matter, as long there is a ATmega328 on the board.
- 4 buttons, normally open
- 4 RGB LEDs, common anode
- 12 resistors of 120 Ohm (or higher, up to 1k)
- 1 47uF cap
- Speaker, 8 to 32 Ohm
Try to find RGB LEDs with wide angle diffused lenses (strawhat, milky) and decent red diodes in them. Many lack good red diodes. With all resistors at 120 Ohm and all LEDs on at 5V mine shine a nice white color.
Step 3: Programming
Just upload the included program (with header file) to the *uino and you're done!
There are some minor bugs, sometimes the power turns off when playing a game. But it's no big deal, the games are short and it doesn't happen that often. Sometimes there is a timing glitch too. Couldn't find the problems 'cause I suck at programming. :P Maybe something with typecasting for the first problem. Second problem seems more like a interrupt problem. But as you can see in the video, it runs fine enough! :D
If you fix problems or (re)write (new) games, please leave feedback, I'd love to see the result!
Step 4: Finishing Touches
Hiding your work is not necessary, but shielding the electronics a bit is safer. So I designed a bright yellowgreen lid in Inkscape. Then put some screws in the corners and glued some magnets onto the plexi. After that I flipped the plexi, the magnets hold it in place nicely! Now my nephew can see my work without danger and the batteries still can be changed easily.
I could share the Inkscape files with you, but I think a gift is something personal, please draw your own, it's not that hard! :)