Questions or comments, email joetcochranATgmailDOTcom
One of my all-time favorite video games is MegaMan 2 for the NES. It might be because it's one of the easiest games in the series, but it's also nostalgically fun to blow through the whole game on some lazy afternoon. Mostly though, I enjoy the catchy and highly memorable soundtrack in the game. I thought it would a be fun project to build a soundboard that could play all the different boss themes from the game.
Normal, Please.
Hardware
A few years ago, in 2009, I won an Arduino Mega from a contest held by Libelium for my sketchduino project. It has been gathering dust ever since, and I thought it might be a good candidate for this project.
The Arduino has no native support for playing MP3's, and I wasn't interested in a shield, so I found the MP3 Trigger board which seems like it hooks into the Arduino pretty easily, but can also stand alone without a microcontroller for some future project.
I found some MP3's of the Megaman 2 soundtrack and loaded them onto a flash drive. Success! The MP3 Trigger has a built-in control to cycle through the tracks loaded onto a Micro SD flash card:
The Soundboard
I thought a wood box would look nice with a 9 buttons, each corresponding to a Megaman character. When you push one of the 9 buttons, the Arduino Mega will send a serial command to the MP3 trigger. The MP3 Trigger will read the flash card and play the music for the corresponding Megaman character through the speaker mounted to the side of the box. For Megaman himself, we can play the Intro music.
At Michael's, there are lots of wood boxes available. The trick for me was to find one deep enough to hold all the electronics components. After selecting my box, I used my Dremel router bit to carve out the button holes. I stained it and put a coat of Triple Thick Gloss Glaze on it. Then, I set to work installing the buttons and soldering on my wires.
Before too long, I realized that I could also add LED's to the wood frame, next to each button to highlight which song is playing. I found some 10mm LED's of various colors and began to drop them into the soundboard and solder the resistors on them.
LEDs, Unique Colors
Many of the colors I wanted to use (e.g. Red, Blue, Yellow) are sold specifically, but some colors are a little less common, and will require a RGB LED with a common anode/cathode to get more specific colors. This will also let me use analogWrite commands (an abstraction of PWM), something I've not done before.
Character/LED Color mappings
The RGB LEDs arrived in the mail, and I wanted to see if I could produce some custom colors. The holes in my soundboard were not big enough, so I had to drill through to widen them a bit. The adafruit tutorial on RGB LEDs was an immense help to me in figuring out the wiring. For a longer time than I care to admit, I kept wiring the common anode to GND instead of the 5V port.
It seems that there is a much bigger difference at the lower end of the PWM spectrum than the higher end. For example, the difference between a PWM 0 value and PWM 5 value seems much greater than the difference between PWM 250 and PWM 255. For this reason, some of my R/G/B values are quite low, and non-zero (I use 5).
Hardware funs: Arduino, MP3 Trigger, Speaker
Serial Communication
The arduino can communicate with the MP3 trigger via serial commands. The Mega has several serial ports available for use, but the only ones I could get working with the MP3 Trigger were the Serial ports 0 and 1 for some reason.
I found that I can hook the {TX on Arduino} to {RX on MP3 Trigger} and the RX on MP3 Trigger to TX on Arduino so that the Arduino can receive some of the Serial notifications which indicate that a track is done playing. We need to know when to turn off the LED's. I tried to hook into the STAT command (via TRIG18) from version 2.53 of the MP3 Trigger firmware, but I had very little success with this. I would have liked a little more documentation on how exactly to wire this, or how to create the MP3TRIGR.INI file to support this.
Power
The MP3 Trigger has a power selection option port for "USBVCC" and a onboard jumper to control the power source (USB vs. EXT). Feeding power from the Arduino seems work great. The speaker is a iHome rechargeable speaker, which runs off of its own rechargeable battery. The audio comes from the MP3 trigger via a standard 3.5mm headphone jack (but interfaces into the speaker with a Micro USB for recharging purposes).
Soldering
To interface with the MP3 Trigger, I need to solder some header pins onto the board.
Got all my wiring set up. It's not pretty, so I preemptively created a meme.
Programming the Arduino
Below shows how the wires are connected to the Arduino:
Controllers hooked up
No more technical challenges remain. The only (more cosmetic) challenges involve how to mount the speaker to the side of the box, and how to create some kind of removable (hinged?) panel to the box so that the controllers are hidden.
Abstraction, Command Modes
Pretty quickly, I realized that I could make the whole thing more interesting and put different collections of tracks if I enabled certain command modes. I refactored the code to allow for entry into 2 Command Modes:
1) "Track Command Mode" by pressing buttons 1 (upperleft), 5 (middle), and 9 (lowerright)
2) "Volume Command Mode" by pressing buttons 3 (upperright), 5 (middle) and 7 (lowerleft)
Track Command Mode lets you select the active group of MP3 tracks (by pressing one of the buttons 1-9). I currently have 5 Track Groups loaded onto my flash card:
1: Megaman boss soundtracks
2: Other Megaman 2 sounds
3: Various Music Tracks, including Rick James' "Superfreak"
4: Napoleon Dynamite Quotes
5: Office Space Quotes
6: (empty)
7: (empty)
8: (empty)
9: (empty)
Volume Command Mode lets you control the volume. Press button 2 (upper middle) to turn volume up and button 8 (lower middle) to turn volume down. Fancy.
Future Enhancements
Power: I'd also like to run the Arduino off of a 9V battery and put a power toggle on the side of the soundboard. I have some spare 9V battery snap-connectors I can put to use.
Reduce electronic footprint: I get the sense I've gone overboard with the controllers on this project. I suspect there's a way I could liberate the Arduino from this whole configuration if I were more clever about using the MP3 Trigger the way it was designed.
MP3 Trigger cuts out: The MP3 Trigger sometimes cuts out in the middle of a track. I haven't been able to fix this yet.
White LED: The White LED seems really bright, leading me to think I used the wrong type of resistor on it. Might need to rewire that before it burns out.
Questions or comments, email joetcochranATgmailDOTcom