Oct 25 2009

Halloween 2009 : Sound Effect Buttons : Part 2

Published by Ron at 1:01 pm under Electronics

Last time I finished up the case and the base for the Sound Effect Buttons. I also installed and wired up the “arcade” buttons.

The buttons drop down to the lower box area via a 1 1/2″ hole in the top (hidden by the button tower part). They are connected via a standard DB-9 connector, so hooking it into other stuff is easy (and you can use standard 9 pin serial extension cables, so you don’t have to make your own). I try to use these standard connectors as much as possible.

Okay, now that the buttons are done, it’s time for the sound. Since the base is made of big 2×10 lumber, speakers would be too muffled if placed inside. At first I was thinking of drilling holes, but then remembered we had some of these attic vents on hand. They are about 3″ x 12″ — perfect. And they have screening built-in, so no larger critters can get in.

Here is what the vent looks like from the outside. This is the back of the base, removed:

HalloweenSoundButtons_06_SpeakerGrillExterior

The other great thing about this grill is that it is exactly the size I need for the speakers I had on hand. Next up, the actual speaker install.

On the left is a tweeter (about 3″ x 8″) and to the right a woofer (about 4″ across).

HalloweenSoundButtons_05_SpeakersMounted_Inside

This is WAY overkill for such a device, but I’ve never been known for my sense of control. :-) Below the speakers is a crossover (which takes a signal and feeds to “lows” to the woofer and the “highs” to the tweeter). I had all this stuff on-hand for another project (that never came together), so might as well put some use it to.

What you can’t see in the above photo is that I used my jigsaw to cut a square opening large enough to allow the speakers to “talk” though. Note that I made sure to keep the opening only as big as it need be, as you need to mount (screw) the speaker to wood. Don’t make the mistake of making a too big opening!

The sound effects will all be stored on a Wave Shield. This is a board that sits on top of the standard Arduino board. It accepts a SD card which you dump your WAVs on.

The Arduino handles two tasks: First, it is connected to the buttons, and “polls” them to see which one was pressed. This takes 8 data lines and a ground. (I know I could have done something fancy to reduce data lines needed, but I have enough to work with.) Second, it plays the WAV files located on the Shield.

This whole process is quite easy, so “making things talk” is almost a trivial task with these components.

Here’s a shot of the completed assembly:

HalloweenSoundButtons_07_WithWaveShieldAndAudioAmp

Below the speakers, from left to right:

  • The gray connector is the DB-9 socket that the cable connecting to the buttons gets plugged into.
  • The board to the right of that is the Arduino with the Wave Shield piggy-backed on it. The DB-9 wires are connected (via Molex connectors) to the top of the board — those are the yellow wires. Three other wires come off the board, heading toward the right.
  • The crossover is in the middle.
  • On the far right is an audio amplifier, using the old standby the LM386. The Wave Shield DOES have an audio amp on it, but it didn’t produce the volume I wanted, so I have it feed into the audio amplifier. This LM386 setup is plain vanilla, with no gain set. (Gain unnecessary, since the amp is getting overdriven as it is.) The output of the audio amp gets connected to the crossover, which then feeds the two speakers.

To get the right volume, with little distortion, you need to fiddle with the output volume on the Wave Shield and the volume on the Audio Amp. That round black wheel on the Wave Shield is its volume control, and I have a PCB mount pot on my amp board (toward the bottom left).

Note that I also threw in a toroid on the audio input side of the LM386. That’s because the 386 has a remarkable amount of gain — if you dangle a wire off of its input you’ll get AM radio. The toroid helps prevent this (don’t know how well, but it was cheap insurance).

The little LM386 is only rated at 0.5 watts, but that is more than enough. (You’ll be surprised how much a couple of watts is.) This thing is pretty loud for its size. However, it is a power hog. Everything is running off the 5V from the Arduino (which takes 9V in — not shown). If you don’t give it enough current overhead it will start distorting and generally freaking out. This is not something that can be run off of a 9V battery. I’ll be using 6 “D” size batteries. (I want no cords near the kids.) If I had a bigger rechargeable battery pack, I’d use it instead.

After some playing around last night, we got first sound. Horray! The buttons worked and the sounds played. (Thanks, Evelyn, for coding it.)

One problem we noticed is that as I added on buttons the thing stopped working! :-(

Then I remembered one important fact that Limor mentions on her site: Watch out for available memory. If you are using an Atmel 168 (the standard MCU on the Arduino board) you will be VERY tight on RAM. If it goes under 150 bytes it WILL start acting strange. That’s what happened to us. We changed a setting on the serial input buffer size (to get more RAM) and it then worked like a charm.

If your Wave Shield is acting strangely be sure to turn on the Serial monitor and see what available RAM is at (Limor’s example programs display available RAM as serial output). If the value is under 150, change the serial buffer setting (as explained on her website). Another option would be to upgrade the chip to one with more RAM. We might do that in the future.

Now that the coding and circuit is done, I just need to button up the box, install the big battery pack, and we are ready for the kids.

Oh, and yes, it is extremely fun to hit buttons and hear screams, cackles, and chainsaws. Every office should have one of these. It would make conference calls more fun. Heck, maybe I’ll make a desktop version of this…I have more buttons, after all….

Comments Off

Comments are closed at this time.