Home > Electronics > The Box

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.

Schematic:

Schematic

box.sch
Firmware: box.c
Eagle libraries for LM3940 and TDA7052 parts:
LM3940.lbr
TDA7052.lbr

Update 5.3.2013: Link to firmware instructions updated

About these ads
Categories: Electronics
  1. Thiago
    03/12/2011 at 20:35

    Hey, great gift!
    I’m thinking about duplicating your idea with some friend of mine.

    Thanks for sharing the project details =]

  2. Jérémy Morelle
    03/05/2013 at 15:45

    Hello,
    I’m trying to use the board for a very simple audio project, but as I’m really new to electronic, I face a lot of difficulty. I read your code, but I’m using arduino language so I’m lost.

    Can you help me with just some basic concepts behind your code ?
    Uart Communication is those lines
    PORTC=0xff; // pull-ups on port c
    UBRRL=0; // 115200 bps
    UCSRB=(1<<RXEN) | (1<<TXEN) | _BV(TXCIE); // rx,tx,tx interrupt enable

    when you want to send an order to the board you just use
    uart_send("C\n"); // Stop playback
    ?

    Is the same as
    serial.write("C/n")
    in arduino langage ?

    In VLSI docs I've found this in uartcontrol.txt
    "pnum\n" plays song with a specific number

    In your code you seem to send
    uart_send(buf); // Issue play command (p N)
    or I am wrong ?

    Hope you can help me !

    best

    Jérémy

    • 03/05/2013 at 16:08

      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.

      You have replaced the VS1000’s default firmware with these instructions (https://github.com/watterott/KnowledgeBase/wiki/SparkFun-VS1000-Breakout), have you?

  3. Jérémy Morelle
    03/06/2013 at 00:59

    Yes, I have.

    I almost achieve to connect it via UART, but

    This don’t work :
    Serial.write(“P1\n”);

    This work :
    Serial.write(“pnum/1″)
    but in erratic way (have to press several times with some sound interruptions)

    And I wonder.
    RX/TX fom arduino is 5V, no?
    And VS1000 is 3,3 v tolerant only, as far I remember.

  1. 03/12/2011 at 19:01

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: