Vmusic2, you make it walk we make it talk, speech, robot talk, schematics, schematics, source code
0 item(s) / Total: $0  
Large Equipment
New Items
Books, Manuals, CD, Video
Computer Equipment
Electronic Assemblies
Electronic Components
Electronic Kits / Modules & Arduino
Gifts & Collectibles
Lab & Test Equipment
LED's and LED Arrays
Robot & CNC & Parts
Test Equipment
Vacuum Tubes
Tektronix® Parts
Home > Useful Stuph > Vmusic2 Demo with Source Code

Vmusic2 Demo with Source Code

This page is some notes on the Vmusic2 Demo Board I built for FTDI

This document has 3 main sections on the Hardware, Software, Schematics and source code.

First off I must say that the people over at FTDI are down right really cool and have some really neat products. I was able to tour their warehouse and was extremely excited about what I saw.

Actually I was so excited I decided I needed to carry their products in our store. (nothing like holding something in your hands to realize how cool it is.)
If you are interested in seeing what we have on hand checkout our Web Store or stop by the retail store. (we are adding a bunch of inventory and hope to carry all of their products soon. If you need something just let us know...)

Here are some quick notes on a Demo Board I built for FTDI.

(click picture to enlarge)


The basic goal was to demonstrate the power of Vmusic2 in a way that shows how easy it is to use. FTDI's slogan for the Vmusic is "You make it walk, we will make it talk" as they are emphasizing the robot side of things.
The Vmusic2 unit is powered by FTDI's Vinculum chipset (http://www.vinculum.com) and allows the user to interface any USB device to a microcontroller thru a TTL UART or SPI interface. (when I mean any USB device I really mean that. Vinculum has a ton of features and capabilities.)
The cool or 'wow' factor of the Vmusic2 is the 'music' part of its name. It has a MP3 playback chip (VS1003) and custom firmware that make it extremely simple to play an audio file off of a usb memory device (example flash memory stick).

To summarize, what we did was to build a display that demonstrates using a microcontroller with buttons that simulate sensors on a robot. When a button is pushed a corresponding audio file is played.


Here is a basic list of the hardware that was used:
Atmel ATtiny2313-10 (using its internal oscillator at 8mhz)
Vmusic2 module
flash memory stick (with audio files installed)
momentary push buttons
10k resistors for pull up on buttons

The ATtiny2313 is a very low cost (under $3) IC and has a large number of built in features (see atmels web site for datasheet). The one thing that I like the best is the internal oscillator. This allows you to basically plug the IC in and use it with a minimum of external components (like a basicstamp controller). It also has up to 18 lines of I/O not bad for a little 20pin chip...
I don't have the time to go into how to program the chip but I will put together an article later.

We need to cover some basics on how the Vmusic2 connects to other gizmos. The Vmusic2 supports SPI or Serial interface by just moving a jumper. Serial is much easier to work with and just about every microcontroller has the ability to use Serial/UART capability so I am going to use that interface.
The Vmusic2 uses hardware (RTS/CTS) handshaking which can be awkward for programming on some microcontroller. If you are not interested in bi-directional communication you can short CTS to ground. This allows you to transmit to it and not worry about any return data.

Since I just want to use the Vmusic2 in a fairly simple method to play files I am using this method.
I connect TX from my micro to pin 4 of the Vmusic2 (Receive line) and short CTS# to
ground. I also connect Power and ground. (If you do not attach ground your serial data will not be received reliably)

Anyway power, ground, CTS#, and pin 4 and we are off to make some noise.

Here is the basic pin outs for the VMusic2 (click picture to enlarge):

One nice thing about the Vmusic2 is that it comes with a very nice box that will easily mount into a project box. If you want to embed the unit inside of the gizmo you are building it is as simple as removing it from the case. The cover opens very easily.

Here are some pictures of the Vmusic in its case and open (click picture to enlarge).


My current programming language favorite is Bascom-AVR Basic compiler for Atmel series of microcontrollers. I hope to do something in Arduino code and possibly BasicStamp as well in the near future.
I have provided source code at the end of this article.

The software interface to the Vmusic2 defaults to baud=9600 , Parity = None , Stopbits = 1 , Databits = 8
The other critical bit of information is that the Vmusic2 expects to see a command and then a carriage return (CR is ASCII character 13 in decimal or 0D in hex). Bascom's serial print command sends data with a linefeed (LF) then a carriage return (CR) which will cause Vmusic2 to have errors.
To correct this you need to add an extra semicolon ";" at then end of your print statements which will not send any formatting characters. To send the CR we will need to do it literaly by adding CHR(&H0d) at the end ofthe print statement. This sends the ascii value for CR.

print "dir" will send 'dir' followed by LF and CR. Vmusic responds with Bad Command
print "dir"; will send 'dir' and nothing else. Vmusic response is nothing as it is
waiting for more input or a CR
Print "dir";chr(&H0D); will send 'dir' followed by CR. Vmusic response is to read the
directory and output it

The command that we wish to send to the Vmusic2 is vpf which I would assume stands for Vinculum Play File (I think.) example: vpf nmnl.mp3

Now if you want to just do some quick playing with Vmusic copy a couple of MP3 files to
a flash device.
Make note of their full names... (I shortened the names for mine to make it easy)
NMNL.MP3 (no more no less by mercy me is a great song for debugging)

Be aware that if there are any glitches in your coding or if the Vmusic2 has issues with
your commands you will not be able to see them. I use the FTDI TTL-232R cable as a debug tool.(I wrote a short article on it as well.) I use the TTL232R cable and connect the receive pin of the cable to the receive pin of the Vmusic2. This way I can see what the Vmusic2 is seeing.
Also you can use it to see what the Vmusic2 is transmitting (error codes, responses to commands, etc.) by connecting the receive pin of the cable to the Transmit pin of the Vmusic2.

By watching the transmit pin of the Vmusic2 this is what you will see when the Vmusic powers up:

Ver 01.12VMUSIC1 On-Line:
No Upgrade

The 'no upgrade' and 'D:\>' will appear only if there is a flash drive attached.
(check your media is installed if you don't see this)
No Upgrade means it did not find an upgrade file for its firmware on the flash device
The D:\> means that it found a USB storage device and is calling it Drive letter D. It is also showing where it is in the file system known as the root directory.

Timing wise it takes the Vmusic approximately 5 seconds to reach this point. (that was a
hint... Have your code wait 5 seconds before attempting to send VMusic2 data)

Here is a rough outline of a quick program to play a single mp3 file using bascom-AVR:

Config Com1 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Dim Cr As Byte
Cr = &H0D ' this is the hex value for the ascii character 13 'carriage return'
wait 5 'wait 5 seconds for system to come up to speed
print "vpf nmnl.mp3"; chr(CR); 'notice the extra semicolon at end so I don't send line feeds

Now what we want to do for the demo is to play a file based on a button push so here is a quick outline of the code:

Power up so wait 5 seconds for vmusic2 to wake up
we scan the buttons to see if they are pressed for more than .2 seconds (called debounce)
if the button is pressed we send a serial command to Vmusic2 to play an audio file.
wait a certain amount of time so file can start to play
go to Start: to see if other buttons are pressed.

Schematic and Source Code:

The basic schematic for the Demo board is as follows (click picture to enlarge):

The code for this written in Bascom-AVR is located here (I used an ATTiny2313 IC):
Vmusic2-Demo.Bas (this is a text file of the code. I put lots of helpful comments)
Vmusic2-Demo.hex (this is a zip file which contains both source code and hex file for ATTiny2313 IC internal oscillator 8mhz)

Feel free to email us if you have questions.

Also check out the Vmusic2 on our web store as well.

Take care,

Mike <><