The Box

Last autumn my friend graduated to Ph.D. degree. I had some trouble trying to come up with any good gift idea, until I realized that the man himself appears on many different videos filmed at various parties for past ten years. Since the videos contained great one-liners and comments I got an idea to create voice box in the spirit of similar kind of kids toys, only with R-rated sound clips.

Since I didn’t have much time to build the box, I spent some time trying to find as ready solution that I could find on a reasonable budget. At Sparkfun, I found VS1000D breakout board which contained almost everything I need. The VS1000D is an OGG player and contains ability to interface with nand-memory chips and usb interface. When the device is connected to computer with usb-cable, it functions as a memory stick. When disconnected and external power is supplied, it functions as simple OGG-player with standard play,next and prev buttons. The only trouble was that even though button interface is nicely available on pin headers, changing the clips by simulating key presses seemed too slow and unreliable.

VS1000D Breakout board. Picture (c) Sparkfun

I found solution on the Sparkfun discussion boards. The chips manufacturer has made the firmware available which makes the board controllable by serial commands (and disables the button interface). There is a good instructions on updating the firmware on Sparkfun’s german reseller Watterrot’s page. I also ordered the board from Watterrot and saved some on delivery time and shipping costs.

Next step was to build the interface for VS1000D board. I wanted to make it as simple as possible, on the box there are only four push buttons. Every combination of buttons pressed plays back one sample, so 15 unique samples were extracted from videos with a little help (thanks Ville). I used avr atmega8535, which powers up the player by pulling PWR pin down, sets the volume and starts to monitor for button events. When any button combination is pressed, button states are read as a binary value. Value is converted to decimal and VS1000D is instructed to play the track with the selected number (1-15). Atmega8535 is a complete overkill for this kind of task, but I had one extra with broken adc, so I decided to use what I already had.

Inside the box

The final step was to get the audio out. The VS1000D can feed the headphones directly and the board has a stereo connector. What the board does not unfortunately have is a pin header for audio, so I had to solder wires directly to connector terminals. TDA7052 chip was used to amplify audio to a small speaker glued inside the box. I selected the chip because it only needs one capacitor as an external component and it gives enough power out with +5v. Since all the sound clips were converted to mono, I wired second channel to audio jack on the side of the box, so that headphones could be used or the box could be connected to an amplifier.

+5v dc power supply was used to power the box. Supply is wired directly to TDA7052 and VS1000D. Interfacing with VS1000D is a bit tricky, since the breakout board needs +5v power supply, but the decoder itself steps the voltage down to +3.3v. VS1000D pins are not +5v tolerant and there is no header to draw +3.3v from the breakout board. I decided to use LM3940 to convert +5v to 3.3v and feed it to atmega so it can the interface directly with VS1000D.

Finished box

After testing the circuit on the table, all the parts were glued to plastic project box and awesome decal was applied to keypad (Thanks Soila and Ville!). Only mistake in this construction was the missing holes for the speaker (duh). Several holes were drilled to box afterwards to get some sound out. All in all, I was very pleased with the result and the box seemed to entertain guests at the graduation party.

With Arduino, things are much simpler, to play the first song, you have to do something like this:
Serial.begin(115200);
Serial.write(“P1\n”);
You can forget the direct register access I’m doing since arduino does these for you. It’s probably good to add some delay at the beginning of the program, since VS1000 might need some time to start.

to stop:
Serial.write(“C\n”);

Remember to add \n after each command, this represent line feed, telling VS1000 to execute the command.