Arduino and VMUSIC2

hey

now you're like, the 8-)STAR :sunglasses: of the forum. nice work, lots of people have been waiting for this!

D

star indeed... well done!

i'd love to hear how you go with 2-way communication. keep us posted!

jon

My thought is that for two-way, you will need to toggle the VMUSIC2 CTS#, so instead of just grounding that pin, you'd attach it to a digital output pin and do something like

digitalWrite(CTS_pin, LOW);
Serial.print("V3A"); #play all files
Serial.print(13,BYTE);
digitalWrite(CTS_pin,HIGH); #allow data to be transmitted from the VMUSIC2 to the Arduino
while (Serial.available() > 0) {
            incomingByte = Serial.read();
... # do something with it
}

Unfortunately I can't test this for a few days...too many projects going on at the same time! But I'll post results if it works.

Yep, well if you take the CTS# pin HIGH you certainly can Serial.read() data coming in from the VMSUIC2.

Unfortunately, the only thing I've been able to read so far is:

"Ver 01.12VMUSIC1 On-Line:
No Upgrade
D:>
D:>"

While I'm getting the "login message" and the "command prompt", the information about playback doesn't seem to be coming in for some reason - obviously the neat part would be for the VMUSIC2 to tell you when a clip has done playing. There might be some weird configuration issue I am missing.

Of course, if you know how long the clip is ahead of time, you can just delay() until it is over.

To date, I've been able to get back an answer to a "DIR" command, but I can't seem to get the VMUSIC2 to properly indicate when an audio file is done playing (I don't even get the command prompt back).

I thought that perhaps I'd have to upgrade the firmware, but it gives "Bad Command" when I try to "FWU" it.

On the other hand, I seem to have no problem playing back files using "V3A" or "VPF".

UPDATE: It turns out that my firmware is so old (Ver 01.12) that it doesn't even have the FWU command...I'll have to ask Vinculum to see what I can do about upgrading the firmware.

New Update:

Yep, I had old firmware. I downloaded the newest firmware from Vinculum (http://www.vinculum.com/downloads/firmware/ftrfb_main_03_56VMSC1B.ftd), and renamed it "ftrfb.ftd" and put it on a thumb drive. I powered it up, and it reflashed the firmware.

Now I'm at "Ver 03.56VMSC1".

Good news: There is some evidence that it sends out the "Playing 1.MP3" style messages once you start playing.

Bad news: Now bringing CTS high appears to stop playback, although that is the only way you can receive serial data from the device.

Ack! Looks like I'll have to bang on it some more.

I have trouble making the VMUSIC work with Arduino... Could some please give a hint?

Schematics:

void setup() {
    Serial.begin(9600);
}

void loop() {
    Serial.print("VPF test.mp3");
    Serial.print(13,BYTE);
    delay(10000);
}

Problem:
The VMUSIC turns on well but does not play any sound... All I want is to command the Vmusic from the Arduino.

I cable the boards as shown on the picture... I pulled-up the jumper pin to activate the serial UART mode instead of SPI.
The TX pin of the arduino seems to send the signal well, but the VMUSIC is not responding even if the LED is green.

Should I format my usb key to a specific standard?
I read that "Disks which do not have a sector size of 512 bytes are not supported".

Am I missing something obvious?

Thanks for your help.

Hi katapulp,

...Am I missing something obvious?

Yes, I think the GND of the Arduino and the GND of the VMUSIC must be connected.

That is very obvious, but since I don't have a VMUSIC myself I can't tell about the rest of the wiring.

BTW any reason why you don't power the VMUSIC from the Arduino-USB-Supply instead of the external Power-Supply ?

Eberhard

Yep, it's working if I connect it without external supply. Does anyone know why?

Yep, it's working if I connect it without external supply. Does anyone know why?

You need to run a ground between arduino and your external power supply; then i bet it will work with external power.

Hi - I've also made some code for the VMUSIC2 that I'd like to share. This works better for me (in our setup) because;
i) Arduino attaches to PC via USB serial, VMUSIC2 attaches to Arduino via softSerial
ii) All commands are available, and there is two-way communication with the VMUSIC2 (particularly good for reading where in the song playback is up to, since the VMUSIC2 sends a time updates every second).

This is slightly buggy, since quite often the VMUSIC2 will respond with 'Bad Command' - but that's the beauty of two-way comms, eh?

Here's the code:

#include <avr/interrupt.h>
#include <SoftwareSerial.h>

#define VMUSIC_CTS 5 //to VMUSIC CTS pin 6 (or ground!)
#define VMUSIC_RX 2 //to VMUSIC TXD pin 5
#define VMUSIC_TX 3 //to VMUSIC RXD pin 4
#define ledPin 13

// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(VMUSIC_RX, VMUSIC_TX); //(RXpin, TXpin)

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

// define pin modes for tx, rx, led pins:
pinMode(VMUSIC_CTS, OUTPUT);
pinMode(VMUSIC_RX, INPUT);
pinMode(VMUSIC_TX, OUTPUT);
pinMode(ledPin, OUTPUT); // declare LED as output
digitalWrite(ledPin, LOW);

// set the data rate for the SoftwareSerial port:
mySerial.begin(9600);

//This will allow softwareSerial to process incoming automatically:
attachInterrupt(0, readSoftwareSerial, LOW);

//Tells VMUSIC that hardware is connected:
digitalWrite(VMUSIC_CTS, LOW);
}

void loop() {
int serialReceived = 0;
if(Serial.available() > 0){
noInterrupts();
digitalWrite(VMUSIC_CTS, LOW);
}
while(Serial.available() > 0){
char incoming = Serial.read();
mySerial.print(incoming);
serialReceived = 1;
}
if (serialReceived == 1){
mySerial.print(13,BYTE); //carriage-return for VMUSIC2
serialReceived == 0;
}
interrupts(); //re-enable softwareSerial
}

void readSoftwareSerial(){
noInterrupts();
digitalWrite(ledPin, HIGH);
char incoming = mySerial.read();
Serial.print(incoming);
digitalWrite(ledPin, LOW);
interrupts();
}

/* VMUSIC COMMANDS:

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

*/

And spend another day finding out a way to format a usb stick with 512bytes per sector on a mac and a pc. Aarrhhgg!!
is there a simple way to do it? disk utility on mac doesnt work, formatting in the explorer in win xp neither.

now i'm playing with the cli tool newfs_msdos but i'm not even shure if that is the right tool for the job.and should i select /dev/disk1 or /dev/rdisk1, or even /dev/disk1s1? no clues here.

it seems that using this tool, i only parially whipe the data. because sometimes it works, sometimes it doens'nt

besies that, if it works, the arduino can control the vmusic very nice.

"What happen????. somebody set up us the bomb!!!" :-?

and once of a sudden it works. same sticks, same computer (mac MDD os x 10.4.9) and disk utilities. first select whole drive and erase as mac os extended, not journaled. then format again as MS_DOS filesystem. eject and voila, working sicks.

How do i know?

make a working serial connection:

remove the atmega from your arduino. pry it off with a small flatscrewdriver. working your way in from both sides. connect the following signals:

orange to 0 RX.

yelow to 1 TX
red to 5v
black to GND
green to GND

notice that for normal arduino operation, orange goes to 1 TX and yellow to 0 RX
set your terminal program to the right port (in zterm hold the shift after staring up the app and select usbserial-xxxxxx where xxxxx is a unique serialstring)
connection speed: 9600, no handshake, 8n1

if you have a working serial connection between the VMUSIC and your computer watch for the right sequence:

Device Detected P2
No Upgrade
D:\>

after removing notice the line that says:

No Disk

if the stick is not recognized you'll get the shorter version:

Device Detected P2

and nothing more. after removing only:

Device Removed P2

so the best thing to do when starting with the VMUSIC2 is:

  1. check the usb stick like mentioned above.
  2. upgrade the firmware to the latest from:
    http://www.vinculum.com/downloads/firmware/ftrfb_main_03_64VMSC1F.ftd

notice that after pressing enter you also get the D:> prompt. this does not indicate a working stick

if you send the string

idd

the VMUSIC answers with something like:

USB VID = $0204
USB PID = $6025
Vendor Id = USB
Product Id = FLASH DISK
Revision Level = 5.00
I/F = SCSI
FAT32
Bytes/Sector = $0200
Bytes/Cluster = $001000
Capacity = $391AB000 Bytes
Free Space = $ Bytes

with a non working stick, you will have a empty line where it reads FAT32 and the sizes will all be zeros

good luck!

and after asking the vinculum team about the power requirements i got the following reply with a interesting option:

The VNC1L will have a normal operating current of 25mA (idle and play modes)
and the SUM firmware command will put the device into suspend during which
the device will only draw a maximum of 2mA.

i just asked them about the min and max voltages the player will work. (batteries?)

ill keep you posted. but it may take a few days before i get a reply.

Did someone manage to set the volume? The code should be "VSV byte" but I've no idea how to handle the command with the byte value.

Here is what I've tried:

  Serial.print("VPF 1.mp3"); // play file
  Serial.print(13,BYTE);
  delay(10000); // wait
  Serial.print("VST"); // stop
  Serial.print(13,BYTE);

  Serial.print("VSV"); // set volume
  Serial.print(100,BYTE); // should be between 0 (loud) and 254 (mute)
  Serial.print(13,BYTE);

Sound keeps loud whatever I put instead of 100...

You want a space after the "VSV" unless you are in "short command set" mode.

Sending that 100 as binary sort of looks like you are mixing modes - did you try sending it as DEC (e.g. ASCII, not binary) instead? Yeah, the documentation sort of indicates binary, but I've had problems with the VDIP docs.

-j

Thanks kg4wsv, I tried every possible combination without success.

I managed to hear a sound variation when printing VSV 80, but that's all...

Hi guys anyone found out how to change the volume in the vmusic2 ?

What i,m trying to achive is :

Play a track when a bottom is pushed when release pause this track then if you push again the track keep playing from the last position so it is play pause only .

The problem , i have is that when the track finish it never play back i,d like it to repeat when is done to do the same play and pause , I tried the command (VRF·file Repeatedly plays a single file) , but does not work or maybe i,m not sending it in the right way .

The other thing is that i need a volume fade out before pause and fade in when play but the commad (VSV·byte Sets playback volume) seem not to do anything ,

here is my code , which only works once until the track is finished after play pause and it does not have the fade in out implemented .

int sensor=7;// this is the buttom 
int value=0;
int LastValue=0;
int pot =0; // poti value .

void setup() {
     
  Serial.begin(9600);
  
}

void loop() {
  
  value=digitalRead(sensor); // this is a buttom in pin 7 .
  pot=analogRead(0)/4; // this is a poti in analog pin  0 which i wanted to use for testing the volume .
     
  if(value != LastValue){
  if (value == HIGH) {
    
  Serial.print("VPF 4.wav "); //#play this file 4.wav
  Serial.print("\r");
   }
  }
  
  if(value != LastValue){
  if(value == LOW) {
    
  Serial.print("VP"); //#pause playing
  Serial.print("\r");
   
 } 
 
 /*
 
 VSV·byte Sets playback volume 
 Serial.print("VSV ");
 Serial.print(pot,BYTE);
 Serial.print("\r");
 delay(1000);*/
 
 
 }
    
LastValue = value ; //this is to write into port only on change .
    
   
} 

/* VMUSIC COMMANDS:
VPF·file Plays a single file eg: "VPF 1.mp3"
VRF·file Repeatedly plays a single file
V3A Plays all MP3 files
VRA Repeatedly plays all MP3 files
VP Pause playback
*/

any tip suggestion apreciated .

cheers ;D

btw (something happen that my usb drive is dead ) ;(

The VRF command works fine with me. Have you updated the firmware?
(1/ download: http://www.vinculum.com/downloads/firmware/ftrfb_main_03_64VMSC1F.ftd 2/ rename to ftrfb.ftd 3/ put it on your usb key and wait for the red light to become green)

You should be able to hear some sound variation using the VSV command then... I read somewhere on the internet that it's not possible to perform a fade in / fade out using that command.

Let us know if you find a way to control the sound!

ok thanks , i,ll try to update the firmware and let you know if any luck with the fade in ;D

cheers