User Tools

Site Tools


VMusic2 player. Wireless Arduino: ZigBee/XBee

VMusic2 audio player

The VMusic2 audio player is an affordable and simple solution to playback audio in a controlled way. You put MP3 files on an USB flash disk and then issue commands to the player via serial communication. All modules from the Interaction Workshop have updated firmware. If you buy your own, make sure you upgrade the firmware before using it.

Preparing the USB flash drive

The VMusic2 module can be quite picky with the USB flash drive. Make sure it is formatted as FAT32 and that filenames are plain (8.3 notation always safest: myfile01.mp3)

Connecting the module

Issuing commands over serial

From Arduino, Serial.println(“command”) doesn't work properly. It is best and safest to split the command and CR (carriage return) over two calls:

Serial.print("V3A"); // send the VMusic2 command
Serial.print(13, BYTE); // send the CR in raw byte 
*** make sure you issue a CR after the command ***

VPF·file       Plays a single file eg: "VPF 1.mp3"
VRF·file       Repeatedly plays a single file
VST            Stops playback
V3A            Plays all MP3 files
VRA            Repeatedly plays all MP3 files
VRR            Repeatedly plays random MP3 files
VSF            Skip forward one track
VSB            Skip back one track
VSD            Skip forward one whole directory
VP             Pause playback
VF             Fast forward 5 seconds
VB             Rewind 5 seconds
VRD·byte       Reads command register
VWR·byte+word  Writes command register
VSV·byte       Sets playback volume

Advanced stuff

The regular Arduino has only one hardware serial port (Pins 0 and 1). The Arduino Mega offers 4 serial ports. Note that with the use of a library (NewSoftSerial, AFSoftSerial, SoftwareSerial), digital pins can be used as software serial port.

#include <NewSoftSerial.h>
NewSoftSerial mySerial(2, 3);  // soft serial: RX on pin 2, TX on pin 3
void setup()  
  Serial.println("Goodnight moon!");
  // set the data rate for the NewSoftSerial port
  mySerial.println("Hello, world?");
void loop()   // run over and over again
  if (mySerial.available()) {
  if (Serial.available()) {

The module provides a bidirectional serial communication, so you can get playback time and status, list of files, etc. Check the documentation and online for exploring these areas.

Wireless Arduino: ZigBee/XBee/802.15.4

The wonderful world of wireless definitely needs more than one hour to master. This is a highly condensed introduction, edges might be rough for now. If you are interested in the topic, please continue exploring on your own and ask questions. I'll try to help as much as I can.

Wireless = No wire!

The fundamental goal of this introduction is to replace the physical wired Serial communication (USB cable) with a wireless one. Graphically it looks like this:

ZigBee/XBee/802.15.4 , confusing, yes!

To put it simply (not 100% accurate, but close enough)

ZigBee    High level communication protocol for wireless personal area network (WPAN).
          Similar to Bluetooth but with a focus on low power
XBee      Commercial product name from Digi (formally Maxstream)
          Series 1 (called 802.15.4) and Series 2.5 are not compatible (watch out we have both in the iWorkshop)

802.15.4  Standard at the base of wireless personal area network (WPAN), used in ZigBee and others

Simple one-way USB cable replacement (Base Station + Node)

Have a working Arduino + Processing wired combo. Arduino sends a sensor value over serial in a packet format like 1:255* that Processing can read and decode.

Arduino Sketch

int analogValue = 0;    // variable to hold the analog value
void setup() {
  // open the serial port at 9600 (or 19200 bps for Xbee)
void loop() {
  // read the analog input on pin 0:
  analogValue = analogRead(0);
  // print out the packet in the format id:value*
  // delay 30 milliseconds before the next reading:

Processing Sketch:

Configure XBee Series 1 node and base station using X-CTU software (simple) or AT commands (challenging). Remember to use your own PAN ID to avoid conflict with others.


courses/2010.02.02.vmusic2.txt · Last modified: 2010/12/07 14:20 by camille