Archive for October, 2009

Oct 30 2009

Audio Memory / Concentration Game : Part 2

Published by Ron under Electronics

In the previous step I created the button panel, installed the buttons, and wired the matrix. This time, I talk about the technique I’m using to read the 4×4 matrix of 16 buttons.

In a typical matrix, you need wires for the rows and for the columns. My 4×4 configuration of buttons means that I would need 8 digital data lines: Four for the columns, four for the rows. This, unfortunately, is a big waste of a very limited number of data lines. I could use some encoder chips, but wanted to avoid that. I wanted a more old school, yet perfectly capable, solution.

AudioMemoryGame_2_01_ButtonsConnectedToArduino (Large)

Microcontrollers, like the Atmel chip used on the Arduino board, have a selection of I/O pins. Most can be set (via code) to be either input or output. Some are digital (meaning only high/low), but some — and this is the important part — are analog. Not true analog, but they do use an Analog-to-Digital Converter (otherwise known as an ADC).

For the Arduino chips, these ADC pins (there are 6 total) can read voltages between 0V and 5V. They translate voltages within that range into a number between 0 and 1023.  For example, 2.5 V would be 511 (it’s a zero base system–you start counting at zero).

Now most often people use these analog pins to monitor analog type inputs, such as potentiometers. Put a resistor in a circuit and it will reduce the voltage (a potentiometer is a variable resistor–it’s what you use to adjust the volume on your stereo). This is the key to saving a bunch of data lines.

One method is to use a ladder type resistor setup. What this means is that all of the switches are tied together with a common wire (say “positive”). Between each switch you put a fixed resistor, all of the same value (say 100 ohms). When you press button one, the circuit is completed with a 100 ohm resistance in there. Second button, 200 ohms. Third button, 300 ohms. And so on. You can tell which button was pressed because it will have a unique resistance. And the ADC on the microcontroller can “convert” that resistance (voltage drop) to a value you can code to.

For a matrix of buttons, as I’m using, I chose a different method: A matrix based switchable resistor network. In this case, each column and row gets its own unique resistor. Something like this:

Column 1 : 100 ohms
Column 2: 200 ohms
Column 3: 300 ohms
Column 4: 400 ohms

Row 1 : 1000 ohms
Row 2 : 2000 ohms
Row 3: 3000 ohms
Row 4 : 4000 ohms

(These are not actual values, just using them as an example.)

Here’s the idea: If you press the button in Column 1 Row 1 you get a resistance of 1100 ohms. Column 1 Row 2 would be 2100 ohms. And so on. Each button will have a unique resistance.

I went with the switchable resistor network in matrix form because this means you don’t need a resistor between each button. This allowed me to make a generic matrix of buttons, with all of the resistor “logic” on a daughter board. So, if the resistor matrix didn’t work out, I could always fall-back to an alternate method (either using 8 data lines or an encoder).

Here is how the 8 wires of switch matrix connect to my little (1″ x 2″) daughterboard:

AudioMemoryGame_2_02_ButtonMatrixUsingADCAndResistors (Large)

The blue lines are the columns, the yellow lines the rows. (Four of each.) The braided wires in the middle are all I need to connect to the microcontroller board! Power, Ground, and Data.

Here is a closeup of the little board:

AudioMemoryGame_2_03_ButtonMatrixUsingADCAndResistors_Closeup (Large)

The four resistors on the left are tied to the four columns. Four resistors on the right are the rows. You’ll also notice another resistor in there. That is the voltage divider resistor. It’s also keeps the circuit at 0 volts when nothing is pressed.

Think of the flow of power as this: Power comes into board via the red wire, then goes up through the four resistors on the right (yellow rows) up to the switches. Once a switch is pressed, the power flows “down” the blue wires and through their resistors. The reduced voltage then goes to the Data line (green jumper connected to blue outbound wire). The power also goes though the voltage divider resistor to ground.

So with 9 resistors you have reduced 8 data lines down to 1! Now that’s a good investment in parts!

If you are an Arduino user and you want to use a switched resistor network, in a matrix format, you are probably asking: Well, what the heck resistor values should did you use?

Well, there are resistance calculators out there, but I found two problems: First, they are often for 4×3 “telephone” type matrices. I wanted 4×4. Second, they assume simpler ADCs (with only a resolution of 0 to 254). The Arduino has a better ADC, so why not take advantage of it. (It’s a 10 bit divider, so not that much better than an 8 bit, but so be it.) After some trial and error (I’m not a big “calculate all the voltage drops” kind of guy), I came up with a mix of common resistors that work well:

Side A: 10 (or zero), 1000 (1K), 2000 (2K), 3300 (3.3K)
Side B: 220, 470, 680, 1000 (1K)

And I used a 2000 ohm (2K) resistor for the voltage divider.

Update: I updated these values — got rid of the 5.6K on the high end and added the 2K.

These resistor values gave me a good range on the ADC analog readings on the Arduino – between 920 to 237. And most values are at least 10 apart, so you can do +/- 5 and take into account resistance changes (due to temperature, humidity, etc).

Now the only downside with all this stuff is that you can only reliably read one button at a time. If you press more than one, the power will go though the path of least resistance, meaning the lowest resistance value. Basically, if you mash on the buttons, you’ll get unpredictable results. I tried to accommodate this by “stepping” the resistance in decent increments, but there is certainly a chance that two (or more) sets of buttons will show the same resistance, when pressed in tandem. (I haven’t done the math.)

I’ve probably bored to death most of my readers with this talk of ADCs and Arduinos and resistance matrices, but the web is sparse when it comes to 4×4 (and more) matrices, so I thought I’d do my part and share what I’ve learned. (Leave a comment if you need a schematic or more help.)

Next up: Coding to the ADC / Analog input values, and seeing if I can get this thing talking.

Update: I changed some of the text above, because the “9th” resistor is part of the voltage divider, not a pull down per se. I’m also working on some of the values to get better voltage separation. My first set of buttons ( 1 through 8 ) are well separated, but things get wonky from 9 through 16. I’m working on a spreadsheet so that I can easily see the voltage values.

Update: I built out a spreadsheet for the voltage drops so that I could better determine the gaps. Things seem to be better now and the above values have been updated to reflect the ones I’m currently using.

One response so far

Oct 30 2009

Save The Canned Tomato Juices

Published by Ron under Cooking

Most recipes using canned tomatoes call for you to fully drain all the juices. I used to just drain these into the sink, until I learned better. Now I save the juices.

I pour the can into a mesh sieve placed over a bowl, give the tomatoes a couple of minutes to drain, use them, and store the leftover juices in the refrigerator.

After you have a good quantity, all you have to do is boil it down. I put a little olive oil in a saucepan over low heat, add a clove or two of minced/pressed garlic, and cook slightly (less than a minute). Then I pour in the juice, stir, and bring to a boil.

Once it is boiling, reduce the heat so you maintain a good boil without overflowing the pan. Keep boiling. Boil boil boil. You’ll keep boiling until it reaches the consistency you want — something like tomato soup.

If you continue boiling, it becomes syrup-like, so you can use it for dipping breadsticks in. Or, as I found out yesterday, it can turn into the worlds easiest tomato soup. Just garlic, oil, and leftover juices — boiled down to the essence of the tomato. You end up with a surprisingly bright strong tomato flavor. I have never been a tomato soup eater, but I would certainly eat this simple mixture.

One response so far

Oct 29 2009

Audio Memory / Concentration Game : Part 1

Published by Ron under Electronics

After putting together my Halloween Sound Effect Tower, and realizing how AWESOME it is having screams available at the touch of a button, I had a thought: What if I made an audio version of the classic “memory” card game? (Also known as Concentration.)

Instead of flipping cards over, you would press buttons and hear sounds. Press one and you might get a cow, another a sheep, and so on. You need to match the sounds.

I did a big of searching and found that there were computer implementation of this game, but nothing in hardware. So I decided to make my own.

First off, the grid. To keep things simple for the prototype, yet complicated enough to be fun, I decided to use 16 positions. This would be a solid proof of concept, in case I wanted to build a really complicated unit later.

Because I love the sturdy feel of arcade buttons, and I have a bunch on hand, I decided to use them again for this project. They are sturdy, easy to work with, and not horribly expensive.

For my game top, I went with a piece of 12″ x 12″ 3/4″ plywood. The 12″ square surface would fit the 16 buttons quite nicely.

Here is the top all cut, drilled, and with the arcade buttons mounted:

AudioMemoryGame_01_Buttons_Front (Large)

Evelyn really likes the look of the black buttons against the light plywood background, so I think I’ll leave it natural and just protect it with clear polyurethane.

The buttons require quite large (1 1/8″ holes), so I laid out a grid, spacing the buttons about 2″ from the edges and 2 1/4″ on center from each other. Here is how they look from the back, without the micro switches installed:

AudioMemoryGame_02_Buttons_Rear (Large)

Because arcade button are so large, and have replaceable switches, you install them a little differently than other types. First you drill the big hole, then you insert the upper switch assembly (the part the user presses). Then you screw a big plastic nut along the body of the switch, holding it in place. Then the micro switch snaps into place on the bottom mount of the switch. It’s a very cool and easy to work with configuration. It’s necessary because these switches are often mounted in very thick cabinets. They can easily be mounted in a 1″ thick surface!

Now comes the wiring. To keep things simple, I wired the switches into a standard matrix pattern. This means that each row is connected and each column is connected. In the below photo you can see that I used different colored wire for the rows and columns.

AudioMemoryGame_03_Buttons_Wired (Large)

In a normal matrix setup, you would need 8 digital data lines to read the buttons. For example, if the upper left button was pressed, the top right yellow wire and the bottom left blue wire would conduct.

The problem is that I’m short on data lines on my Arduino (Atmel AVR) microcontroller. I need about 6 lines for driving the Arduino Wave Shield. and want to reserve another 3 for possible LED Driver action (lighting up each button).

One was to reduce the number of wires needed is to use a device called an encoder. An encoder basically takes all these lines and simplifies them for downstream use. (This is how your computer keyboard works — you don’t have 102 wires going to your computer, you have only a handful.) I have decoders, but no encoders, so I’d have to order something. So much for that.

Instead, I poked around a bit, looked at some application notes, and discovered — yet again — that the engineers of yore have done the thinking for me. The engineers who work on these sorts of devices are constantly coming up against hardware and software limitations. You can’t just throw in more hard drives, you have to actually solve the problem.

In this case, I discovered a method which will allow me to tell if a button was pressed with only ONE data line. Can you guess how it will be done?

(Keep in mind that I only need to know if one button at a time is pressed. I don’t care if two buttons [or more] are pressed simultaneously. That’s an invalid condition in the game of Concentration. Also, I’m using a microcontroller, which is pretty much required for this solution.)

Next up, testing the method of polling the buttons.

Comments Off

Oct 29 2009

Sound Effect Buttons : The Video

Published by Ron under Electronics

This will give you a better idea of what the unit sounds like. The sounds are all on a SD chip, so I can change out as I desire. Enjoy.

Comments Off

Oct 28 2009

A6276 LED Driver Development Board

Published by Ron under Electronics

We’ve been using the A6276 LED driver quite a bit in our recent projects. It interfaces easily with microcontrollers, drives 16 LEDs, and you don’t have to worry about a bunch of drop resistors.

The downside is that we use it for a lot of different projects — some of them we don’t / can’t move around easily. Or maybe we have an installation (like the garage light bar), and you don’t want to take it down / sit in the garage while debugging new effects.

After the lightbar experience, I decided that we needed a “development” board of sorts. Something that would allow Evelyn to test out her programs, without having the piece sitting in her office. Here is the end result:

A6276_LED_Driver_DevelopmentBoard (Large)

I used (tedious) point to point wiring, but that’s okay, since this is for our personal development use. The board is about 2″ x 3″.

The A6276 driver (24 pins) sits in the middle. Along the bottom are 16 square 5mm-ish red LEDs. I used these square ones because they fit the best (picked them up at Tanner surplus in Dallas a while back). As you test your programs, the LEDs light up. They are in order (1 though 16).

Along the left and right edges are 4 sets of 4 pin Molex connectors. These are the standard .10 on center connectors we use for connecting our small scale electronics. I wanted to have these on the board so that the project (ex. a mask) could be tested on the dev board. This means you don’t need to wire up a whole new A6276 every time you want to just play with something (that may or may not work out). The LEDs and the externals are in parallel, so you’ll get a drop in current, but that’s okay for debugging our projects.

In the upper left there is a three pin connector for connection to the microcontroller (in our case, usually an Arduino / Atmel 168 chip). The three lines are data, clock, and latch.

To the upper right of the chip you have the inbound power connector — everything, chip and LEDs, runs at 5 V. In the upper right there are 4 sets of 2 pin connectors. These are power connection points for the outboard LEDs. In some of our projects we have one common power source, so you’d just use one pin. In other projects we have multiple power feeds (necessary when the sets of LEDs being driven are located away from each other, or if the design is modular).

Near the power connector (partially hidden) is the current reference resistor. I use the term “reference resistor” on purpose. This is NOT AN LED DROP RESISTOR. This is a resistor that works with the A6276 to determine output current. Most LEDs are safe at 20mA, so I used a 1K resistor. Resistors are often off by a factor of +-10% at lower ratings, so it’s a good idea to measure its actual value on a good multimeter. In my case, the resistor was 970 ohms, which gives me 20mA of current. (For the A6276 you calculate output current as I = 18.76 / Rext. Other driver chips will be different — look at your data sheets!)

I also put a header-type pin in there for the downstream serial data (near the white wire).

This morning Evelyn finished soldering up some header pins to the twisted wires and connected it to an Arduno. And, ta-da, it worked. Hopefully this will make development with the A6276 LED Driver easier.

If you are using these drivers, I highly recommend you make your own version.

3 responses so far

Oct 28 2009

Halloween 2009 : The Roundup

Published by Ron under Electronics

We finished up and installed the lightbar effect on Monday evening. This is the lighting device that is mounted near the garage door.

Here is the controller. It’s a Boarduino (Arduino compatable) on a breadboard. Power is supplied by a “wall wart” on a regular light timer. Five wires go up to the lightbar: Power (2) and Data (3).

HalloweenLightbar_01_BoarduinoController

At the lightbar, we have the A6276 LED Driver. You supply it with power, and then stream serial data to it. This allows you to control 16 LEDs independently with only three data lines. Since the lightbar is mounted near the garage door, and will only be up for a week, I didn’t bother waterproofing.

HalloweenLightbar_02_A6276_LED_Controller

You can see in the above photo that I used 2″ “L” brackets to mount the 1×2 near the top of the garage door frame. We also added another strap (actually a piece of Erector set) in the middle, to prevent bowing.

Here is what the installed setup looks like:

HalloweenLightbar_03_Mounted

In the front bedroom window we have to Peggy installed. This is a 625 10mm white LED array (25×25). Evelyn programmed ghost, pumpkin, and alien/boo! images. The Peggy cycles though them. It’s very effective at night. (It’s off and daytime in this photo.)

Halloween_Peggy

In the side bedroom window we have the Bat Sign, along with a rCube Talking Clock that has LED effects (we have the “Halloween” effects running — oranges, purples, flashes of white).

Halloween_BatSign

Here’s a shot of the front “picture” window during the day:

Halloween_FrontWindow

Some of the spotlights and LaserPod that “paint” the figures with light:

Halloween_LaserPod_And_Spots

And a whole mess of wires to light everything up. Good thing this is only temporary!

Halloween_LotsOfWires

We re-purposed an old Christmas popcorn container (about 12″ x 12″) for our candy bucket. Spray painted it black and then I (poorly) spray painted a bat using a paper stencil. I need to work on this technique, as I got too much bleeding/running. Good enough for this, though.

Halloween_CandyBucket

That about does it for effects and pieces. We’re also going to be setting up our “robot voice” pumpkin thing, along with our sound effects tower. (I need to do a video of the sound effects in action.) That stuff will get put out early Saturday, to prevent vandalism.

Also, I’d like to mention a really nice effect that our neighbor put up. She first put large “stick on” Halloween silhouettes on her front window. Then draped a series of orange “Christmas lights” about a foot behind. Finally, put a drape (old sheet) behind it all. It’s a very nice effect and can be done inexpensively. I’ll try and get a photo.

2 responses so far

Oct 27 2009

Building A Giant DTV Antenna

Published by Ron under Electronics

This Instructables design is very similar to our Coat Hanger Antenna. If you are in a bad fringe area (>30 miles from a station), this might be your answer:

Build A Large DB8 DTV / HDTV Antenna For Fringe Areas

I’m going to try and build my own version, as we have plenty of coat hangers and lots of “hardware cloth” 1/2″ metal mesh.

Comments Off

Oct 25 2009

Halloween 2009 : Light Bar : Part 1

Published by Ron under Ron's Rambling

Or: We Need More Lights!

Last night Evelyn programmed the Peggy 2 board with a couple of Halloween images. Our neighbors (with kids) were outside, and it quickly got their attention. Six hundred and twenty five LEDs have a way of doing that. :-)

Our garage is looking a little dim, so I decided to make a light bar for it. The idea is to suspend a line of lights across the top of the door. They will then bathe the door with computer controlled light.

I was going through the different colors of 10mm LEDs we have on hand, and again went back to the Blue and Green. Both of these colors are far brighter than the Reds and Pinks we have, and they give a nice gloomy color. I would have preferred more blood-like, but need to go for luminosity instead.

First thing I did was take an 8 foot 1×2 and drill holes every 6 inches. (Our garage door is 8′ wide.) This resulted in 15 holes in total. Then I inserted 10 mm LEDs into the holes, alternating colors. (If I had bright Red, I would have done RGB. In this case, only GB.)

Once the LEDs were firmly in the holes, I put in a dab of silicon caulk (for some water resistance), and then filled in the rest with construction adhesive (PowerGrab).

HalloweenLightbar_01_StandingUp

Then came the wiring. The Allegro A6276 LED driver we are using “sinks” current. So you have one common “positive” and then each LEDs cathode goes to a pin on the driver chip. This particular chip can handle 16 LEDs, and can daisy chain. This makes it a great chip for driving lots of LEDs independently.

The bundle of wires runs down the 1×2, meeting at one end:

HalloweenLightbar_02_LotsOfWires

In the above photo you can see the common positive wire (red). It’s connected to every LEDs anode. Then each of the 15 LEDs gets its own blue wire (negative/cathode).

At the end, all of the wires meet, at the A6276 LED driver:

HalloweenLightbar_03_Allegro6276LEDDriver

There are four sets of four Molex connectors (toward the left). The driver is in the middle. Toward the top right is the common anode (positive) connection, and the lower right is where the power goes.

How does the Allegro A6276 LED driver work? Well, you really need to connect it to a microcontroller (MCU), such as the Arduino. You “tell” the driver what to light via a Data, Clock, and Latch line.

Now at first this may seem like more trouble than it’s worth — why not just tie each LED to a pin on my MCU and be done with it? Well, here are a couple of reasons why you should use LED driver chips:

  • The A6276 driver is a constant current source. Current is EXTREMELY important with LEDS — too much and you will blow them. Most LEDs need 20 mA or less. A constant current driver means you need ONE resistor for everything. None of the “resistor for each LED” drag.
  • It runs on a 5V supply, so you can power everything directly from the Arduino 5V rail.
  • The driver has serial out, so you can daisy chain.
  • You can drive 16 LEDs with only THREE data lines on your Arduino — without any fancy multiplexing (like Charlieplexing). Save your pins for other stuff!
  • The driver can support up to 90 mA continuous per output — so you can driver brighter/bigger LEDs.
  • You can separate your driver chip from the MCU — and only need three wires (plus two power) to connect them. This is great for big displays.
  • It makes wiring dead simple.

If you need to individually control a number of LEDs, I highly recommend that you check out these kinds of chips. We’ve tried just about every technique, and this is, by far, the easiest and least aggravating method. All of our new designs use these kinds of LED driver chips. Save yourself a lot of frustration and drop the $3 for the driver. (Newark stocks them.)

A couple of hints on using LED driver chips:

  • They either “source” or “sink”. If they source, then you have individual anodes (positive) and a common cathode (negative). If they sink, then you have a common anode (positive), and individual cathodes (negative). The wiring is the same, just think about which LED pin you are connecting to the chip. For the Allegro A6276 you tie the LED’s cathode (negative) to the control pin on the driver chip.
  • The LED current resistor is based on the DRIVER CHIP’S CALCULATION. It is NOT based on the the LED’s typical drop resistor. This is VERY important to keep in mind. An example: If you were using a standard 20 mA LED with a 9V source, you’d want a drop resistor in the range of 450 ohms. However, the A6276 does NOT use that standard drop resistor calculation. You must use its calculation, which is roughly: mA = 18 / resistance. So, a 1K resistor would give you about 18 mA, which is okay for your LEDs. This is what was blowing all of our LEDs with the first version: We used a regular drop calc, which resulted in the driver providing us over 80 mA — which blew the LEDs.
  • ALL of your LEDs tied to a given driver chip must be able to handle the same current range. DO NOT mix 100 mA LEDs with 20 mA LEDs unless you plan to drive everything at 20 mA. If you need to run big current LEDs along with lower current, then use TWO driver chips. One would handle the low current LEDs, the other the high current LEDs.

Hopefully these hints on using driver chips will prevent some frustration. :-) They are great chips and save a lot of time — once you know how to use them.

Now that the driver chip is all connected, we just need to test it out with the Arduino. Again, what is cool about the driver is that it can be part of the light bar (which will be outside, but protected from rain), and the Arduino can sit safely inside the garage. The two get connected with 5 wires (3 data related and 2 power).

Comments Off

Oct 25 2009

Halloween 2009 : Sound Effect Buttons : Part 2

Published by Ron 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

Oct 21 2009

Halloween 2009 : Sound Effect Buttons : Part 1

Published by Ron under Electronics

The lighting effects are coming along quite nicely, but I felt that we didn’t have enough “noise makers” for the daytime kids. So I came up with the Really Annoying Sound Effects button idea.

It’s pretty simple: A three foot long box with eight buttons mounted on it.

HalloweenSoundButtons_01_FaceWithButtonsInstalled

Those are “arcade” buttons, so they are meant to take a beating. They are also nice and big — 1 1/4″ across.

Here is some of the wiring on the reverse side:

HalloweenSoundButtons_02_RearOfFace_WithButtonWiring

The wires run down to one end of the board, where they will be soldered to a DB-9 connector (the same use in Atari and Commodore games/computers).

The buttons are going to be included in this “black box”:

HalloweenSoundButtons_03_OuterCase
I’m not sure yet whether I’m going to mount the button assembly horizontally or vertically. We’ll see.

Once the button controller is done, it will get hooked up to an Arduino with a Wave Shield. The Wave portion allows the Arduino board to (easily) play audio files. The idea is to load up some creepy sound effects on the Shield. Then when kids hit the buttons, it plays the different sounds. If we have time, we might also have it control other stuff (like moving effects — bats spinning, arms moving, etc).

Again, the idea is that this is one of the “young kid friendly” effects.

Update: Here is the base I came up with. I ended up going with the vertical setup. The base is heavy enough to keep it from falling over.

HalloweenSoundButtons_04_MountedOnBase

One response so far

Next »