Do you love games? Making games? Modifying games? Yes! Then you'll love this Instructable, where you'll learn to make a custom game timer with whatever time duration and sound effects you want.
In this example I'll be hacking an off-the-shelf "No!" button (similar to the Staples "easy" button) and adding in a different sound chip with my own timer sound and sound effects. This off-the-shelf button works great because it already has a speaker, battery box, and pushbutton switch as part of the product. I'm adding in two new switches so that I can select between two different timer durations and two different "times up" sound effects.
You can build your own housing from scratch if you want, or build the electronics into some other existing housing.
This Instructable can be easily adapted for many other applications, like toys or costume props, or anything you want to add sounds to. If you like this type of project, please check out my other projects:
1.) How to Make a Personalized Children's Audio Book
Step 1: Parts and Stuff You'll Need
To make a custom game timer, you'll need the electronics for controlling the timer function and playing back the audio and sound effects. To do this I'm using Foxonix, which is an awesome, easy-to-program platform for playing audio and controlling the program.
1.) Foxonix Fox Development Board
2.) Foxonix Project Board
3.) Two (2) two-position slide switches (like ON/OFF switches)
5.) If you want to add or modify sound effects, you'll need an audio editor like Adobe Audition, Wavepad (free), or Audacity (free)
6.) Soldering iron and solder
The speaker, battery holder, and pushbutton are already included in the off-the-shelf button, so I haven't included them in this list. If you want to build the timer into some other housing then you'll need those parts.
Step 2: Opening Up the Button
The top and bottom half of the button were held together with weird "triangle drive" screws. I don't have a driver to fit those screw specifically, but I used a 1.5 mm hex wrench and it worked perfectly. Opening up the housing reveals that the electronics are really simple. We're going to reuse almost everything, but we'll swap in our own sound chip.
Step 3: Hardware and Software
We're going to start by hooking up the Fox Development Board. This will allow you to test out the existing program so you can play around with it and see how it works. The Fox Board should be plugged into your computer with a USB cable. Here are the connections as shown in the diagram:
1.) The speaker is plugged into the PWM jack.
2.) One pushbutton is connected between pin P1.0 and 3.3V
3.) One slide switch is connected between pin P2.0 and 3.3V
4.) One slide switch is connected between pin P2.1 and 3.3V
All of the software files used to create this project are included here, but can also be found on GitHub. You can download these files and use them as the basis for your own program. The program won't change much, but you can substitute in your own sound effect files that you want to use.
To test the existing program with the hardware before you make any changes, use the Fox Hardware Programmer to load the file custom_game_timer.bin onto the Fox Development Board. After the program is loaded, you should be able to press the button and hear the "tick-tock" sound followed by the "times up" sound effect.
Step 4: Updating the Program to Include Your Own Sounds
To make changes to the program you will need the Code Editor which is part of the Foxonix software bundle.
You can customize the program to include your own timer sound and "times up" sound effects by simply moving your audio files into the program folder and changing the file names in the program. You may also need to change the program a bit depending on the number of sounds you want to include, since you may have more or fewer sound effects than the sample project. After you've made your updates and recompiled the program you can load the new program onto the development board to test it out.
Step 5: Programming the Project Board
After you've updated your program and you're happy with how everything sounds, you can load the program onto a Project Board for installing into the housing. One of the super cool things about Foxonix is that the development board has the programming connector built in, so you can simply plug the Project Board into that connector and load up the code. Now you have a small, stand alone PCB with your program and audio on it, which is perfect for putting into projects.
Step 6: Putting the Electronics Together
Now it's time to assemble the electronics into the housing.
To start, remove the battery wires and speaker wires that are connected to the original PCB. Remove the original PCB from the housing and remove the pushbutton from that board. I tried to use the pushbutton while it was still connected to the PCB, but it didn't work because of the other components still connected to it. So instead I removed the button and hot glued it to the center of the other side of the PCB. This PCB already has mounting holes and screws so we want to reuse it.
In order to get the Project Board to fit, I had to remove a few of the support posts on the inside of the bottom part of the housing as shown in one of the photos above.
The speaker and buttons are wired up to the Project Board the same way as on the development board in Step 3:
1.) The speaker is connected to the PWM pads.
2.) One pushbutton is connected between pin P1.0 and Vcc.
3.) One slide switch is connected between pin P2.0 and 3.3V (shown in next step)
4.) One slide switch is connected between pin P2.1 and 3.3V (shown in next step)
You also need to connect the positive (+) lead from the battery pack to the Vcc pad and the negative lead (-) to the GND pad.
Step 7: Putting the Electronics in the Housing
After the batteries, speaker, pushbutton, and switches are connected to the PCB everything will need to be installed in the housing. I drilled two holes in the lower part of the housing so that the switch sliders can poke through. One of these switches will be used to select timer duration and the other will select the "times up" sound effect.
The slide switches are hot glued into place on the inside rim of the housing
Since the Project Board is squeezed between the old PCB and the battery compartment, I put some electrical tape around it so that it doesn't short to anything. I also removed the spring that was directly above where the Project Board is sitting. It took a little bit to get everything contained inside, but I was able to close the housing up and screw it back together without too much trouble.
OPERATION: To start the timer just press the big red button! If the timer reaches the end, the "times up" sound effect will play. If you press the red button while the timer is ticking, the timer will stop.
Good luck, have fun, and let me know if I can help you with anything! Thanks!