Difference between revisions of "VMusic2 Anleitung"

From Digipool-Wiki
Jump to: navigation, search
Line 1: Line 1:
<pre>
+
[[File:VMusic Arduino.jpg|400px|right]]
  
// vMusic-PlayOnSong by www.olafval.de  
+
 
// more info: www.vinculum.com/prd_vmusic1.html
+
== Komponenten ==
 +
 
 +
Zum Bau eines programmierbaren MP3-Players benötigen wir: <br>
 +
Der VMusic-MP3-Player wird von der Firma [http://www.ftdichip.com/Products/Modules/ApplicationModules.htm FTDI] entwickelt. Bis jetzt gibt es die Versionen VMusic, VMusic2, VMusic3 die sich jedoch in der Nutzung nicht wesentlich unterscheiden. Da es bei älteren Versionen Probleme mit Bugs gab, würde ich immer die jeweils neuste Version empfehlen.
 +
 
 +
* VMusic3 - MP3-Player ([http://www.digikey.de/product-detail/de/VMUSIC3/768-1179-ND/4009908 zum Beispiel])
 +
* Arduino 5V ([http://arduino.cc/en/Main/ArduinoBoardPro zum Beispiel])
 +
* USB-Stick
 +
 
 +
<br>
 +
 
 +
== Funktionsprinzip ==
 +
 
 +
Die MP3 Dateie werden auf dem USB-Stick gespeichert und können mit dem Sound-Chip des VMusic2-Moduls abgespielt werden. Dieses besitzt eine kleinen Klinkenstecker für Kopfhörer, Boxen, Aktiv-Boxen usw... Das VMusic2 wird von einem Arduino gesteuert. Das Arduino ist ein kleiner Computer, der sich leicht programmieren lässt. Er gibt dem VMusic2-Player einfache Befehle (siehe unten) über eine Serielle Verbindung. Der große Vorteil dieses selbst gebauten MP3-Players ist, dass wir genau programmieren können, was passiert. An das Arduino lassen sich Taster, Schalter uns Sensoren anschließen über die das Abspielen der MP3-Sounds gesteuert wird. Zusätzlich Kann das Arduino Leuchtdioden, Lampen, Motoren oder andere dinge in Kombination mir dem Sound steuern. Ein kleiner Nachteil liegt in leichten Verzögerung von ca. einer Sekunde, die es dauert bis der VMusic-Player reagiert.
 +
 
 +
<br>
 +
 
 +
 
 +
== Steuerbefehle ==
 +
 
 +
VMusic Steuerbefehle
 +
* "VSV" = VMusic set volume – 0 (loud) and 254 (mute)
 +
* "VPF" = VMusic Play File
 +
* "VRF" = VMusic repeatedly plays a single file
 +
* "VST" = VMusic stop
 +
 
 +
* "V3A" = VMusic plays all MP3 files
 +
* "VRA" = VMusic repeatedly plays all MP3 files
 +
* "VRR" = VMusic repeatedly plays random MP3 files
 +
* "VSF" = VMusic skip forward one track
 +
* "VSB" = VMusic skip back one track
 +
* "VSD" = VMusic skip forward on whole directory
 +
* "VP" = VMusic Pause playback
 +
* "VF" = VMusic fast forward 5 seconds
 +
* "VB" = VMusic rewind 5 seconds
 +
 
 +
<br>
 +
 
 +
 
 +
= Code-Beispiele =
 +
 
 +
<br>
 +
 
 +
== PlayOneSong ==
 +
 
 +
<source lang="java">
 +
// PlayOneSong with vMusic2
 +
// Example by by Olaf Val (www.olafval.de)
  
 
#include <SoftwareSerial.h>
 
#include <SoftwareSerial.h>
  
// USB-stick max 4 G
+
// USB-stick max 4 G (hard to buy this days)
// Name Songs "001.mp3" "002.mp3" . . .  
+
// Format the Stick with FAT32
 +
// Name Songs "001.mp3" "002.mp3" . . .
 +
 
 
// cut the blue  
 
// cut the blue  
 
// conect the brown to the reen cable
 
// conect the brown to the reen cable
Line 30: Line 79:
 
    
 
    
 
   mySerial.print("VSV"); // set volume
 
   mySerial.print("VSV"); // set volume
   mySerial.print(0,BYTE); // should be between 0 (loud) and 254 (mute)
+
   mySerial.write((byte)0); // should be between 0 (loud) and 254 (mute)
   mySerial.print(0x0D,BYTE);
+
   mySerial.write((byte)0x0D);
 
}
 
}
  
Line 37: Line 86:
 
   Serial.println("Song_1");  
 
   Serial.println("Song_1");  
 
   mySerial.print("VPF 001.mp3"); // play song nr one
 
   mySerial.print("VPF 001.mp3"); // play song nr one
   mySerial.print(0x0D,BYTE);
+
   mySerial.write((byte)0x0D);
 
  delay(9000);
 
  delay(9000);
 
}
 
}
 +
</source>
 +
 +
<br>
 +
 +
== PlayNextSong ==
 +
 +
<source lang = "java">
 +
// PlayNextSong with vMusic2
 +
// Example by by Olaf Val (www.olafval.de)
 +
 +
#include <SoftwareSerial.h>
 +
 +
// USB-stick max 4 G (hard to buy this days)
 +
// Format the Stick with FAT32
 +
// Name Songs "001.mp3" "002.mp3" . . .
 +
 +
// cut the blue
 +
// conect the brown to the reen cable
 +
// red cable to 5V
 +
// black cable to GND
 +
#define VMUSIC_RX 14 // yellow cable ti Analog in 0
 +
#define VMUSIC_TX 15 // orange cable ti Analog in 1
 +
 +
 +
// set up a new serial port
 +
SoftwareSerial mySerial =  SoftwareSerial(VMUSIC_RX, VMUSIC_TX);
 +
 +
int n = 0; // Song Nummer
 +
int buttonPin = 17; // Button Pin
 +
int b = 0; // Inputval of button
 +
 +
 +
void setup() {
 +
 +
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
 +
 +
  // define pin modes for tx, rx, led pins:
 +
  pinMode(VMUSIC_RX, INPUT);
 +
  pinMode(VMUSIC_TX, OUTPUT);
 +
 +
  // set the data rate for the SoftwareSerial port
 +
  mySerial.begin(9600);
 +
 +
  mySerial.print("VSV"); // set volume
 +
  mySerial.write((byte)0x00); // should be between 0 (loud) and 254 (mute)
 +
  mySerial.write((byte)0x0D);
 +
 +
  pinMode(buttonPin, INPUT); // setup Button Pin
 +
  digitalWrite(buttonPin, HIGH); // enable PullUpResistor for Button Pin
 +
 +
}
 +
 +
void loop() {
 +
 +
  // wait untill button is pressed
 +
  b = digitalRead(buttonPin);
 +
  while(b == 1){
 +
    // wait untill button is pressed
 +
    b = digitalRead(buttonPin);
 +
  }
 +
 
 +
  if(n == 0) mySerial.print("VPF 001.mp3"); // play song nr one
 +
  if(n == 1) mySerial.print("VPF 002.mp3"); // play song nr one
 +
  if(n == 2) mySerial.print("VPF 003.mp3"); // play song nr one
 +
  if(n == 3) mySerial.print("VPF 004.mp3"); // play song nr one
 +
 
 +
  mySerial.write((byte)0x0D);
 +
  delay(1000);
 +
 +
  n = n + 1;
 +
  if(n > 3) n = 0;
 +
  Serial.print("Song Nr ");
 +
  Serial.println(n);
 +
  delay(100);
 +
 
 +
}
 +
</source>
  
</pre>
+
<br>

Revision as of 13:22, 25 February 2021

VMusic Arduino.jpg


Komponenten

Zum Bau eines programmierbaren MP3-Players benötigen wir:
Der VMusic-MP3-Player wird von der Firma FTDI entwickelt. Bis jetzt gibt es die Versionen VMusic, VMusic2, VMusic3 die sich jedoch in der Nutzung nicht wesentlich unterscheiden. Da es bei älteren Versionen Probleme mit Bugs gab, würde ich immer die jeweils neuste Version empfehlen.


Funktionsprinzip

Die MP3 Dateie werden auf dem USB-Stick gespeichert und können mit dem Sound-Chip des VMusic2-Moduls abgespielt werden. Dieses besitzt eine kleinen Klinkenstecker für Kopfhörer, Boxen, Aktiv-Boxen usw... Das VMusic2 wird von einem Arduino gesteuert. Das Arduino ist ein kleiner Computer, der sich leicht programmieren lässt. Er gibt dem VMusic2-Player einfache Befehle (siehe unten) über eine Serielle Verbindung. Der große Vorteil dieses selbst gebauten MP3-Players ist, dass wir genau programmieren können, was passiert. An das Arduino lassen sich Taster, Schalter uns Sensoren anschließen über die das Abspielen der MP3-Sounds gesteuert wird. Zusätzlich Kann das Arduino Leuchtdioden, Lampen, Motoren oder andere dinge in Kombination mir dem Sound steuern. Ein kleiner Nachteil liegt in leichten Verzögerung von ca. einer Sekunde, die es dauert bis der VMusic-Player reagiert.



Steuerbefehle

VMusic Steuerbefehle

  • "VSV" = VMusic set volume – 0 (loud) and 254 (mute)
  • "VPF" = VMusic Play File
  • "VRF" = VMusic repeatedly plays a single file
  • "VST" = VMusic stop
  • "V3A" = VMusic plays all MP3 files
  • "VRA" = VMusic repeatedly plays all MP3 files
  • "VRR" = VMusic repeatedly plays random MP3 files
  • "VSF" = VMusic skip forward one track
  • "VSB" = VMusic skip back one track
  • "VSD" = VMusic skip forward on whole directory
  • "VP" = VMusic Pause playback
  • "VF" = VMusic fast forward 5 seconds
  • "VB" = VMusic rewind 5 seconds



Code-Beispiele


PlayOneSong

<source lang="java"> // PlayOneSong with vMusic2 // Example by by Olaf Val (www.olafval.de)

  1. include <SoftwareSerial.h>

// USB-stick max 4 G (hard to buy this days) // Format the Stick with FAT32 // Name Songs "001.mp3" "002.mp3" . . .

// cut the blue // conect the brown to the reen cable // red cable to 5V // black cable to GND

  1. define VMUSIC_RX 14 // yellow cable ti Analog in 0
  2. define VMUSIC_TX 15 // orange cable ti Analog in 1


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

void setup() {

 Serial.begin(9600);	// opens serial port, sets data rate to 9600 bps
 // define pin modes for tx, rx, led pins:
 pinMode(VMUSIC_RX, INPUT);
 pinMode(VMUSIC_TX, OUTPUT);
   
 // set the data rate for the SoftwareSerial port
 mySerial.begin(9600);
 
 mySerial.print("VSV"); // set volume
 mySerial.write((byte)0); // should be between 0 (loud) and 254 (mute)
 mySerial.write((byte)0x0D);

}

void loop() {

 Serial.println("Song_1"); 
 mySerial.print("VPF 001.mp3"); // play song nr one
 mySerial.write((byte)0x0D);
delay(9000);

} </source>


PlayNextSong

<source lang = "java"> // PlayNextSong with vMusic2 // Example by by Olaf Val (www.olafval.de)

  1. include <SoftwareSerial.h>

// USB-stick max 4 G (hard to buy this days) // Format the Stick with FAT32 // Name Songs "001.mp3" "002.mp3" . . .

// cut the blue // conect the brown to the reen cable // red cable to 5V // black cable to GND

  1. define VMUSIC_RX 14 // yellow cable ti Analog in 0
  2. define VMUSIC_TX 15 // orange cable ti Analog in 1


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

int n = 0; // Song Nummer int buttonPin = 17; // Button Pin int b = 0; // Inputval of button


void setup() {

 Serial.begin(9600);	// opens serial port, sets data rate to 9600 bps
 // define pin modes for tx, rx, led pins:
 pinMode(VMUSIC_RX, INPUT);
 pinMode(VMUSIC_TX, OUTPUT);
 // set the data rate for the SoftwareSerial port
 mySerial.begin(9600);
 mySerial.print("VSV"); // set volume
 mySerial.write((byte)0x00); // should be between 0 (loud) and 254 (mute)
 mySerial.write((byte)0x0D);
 pinMode(buttonPin, INPUT); // setup Button Pin
 digitalWrite(buttonPin, HIGH); // enable PullUpResistor for Button Pin

}

void loop() {

 // wait untill button is pressed
 b = digitalRead(buttonPin);
 while(b == 1){
   // wait untill button is pressed
   b = digitalRead(buttonPin);
 }
 
 if(n == 0) mySerial.print("VPF 001.mp3"); // play song nr one
 if(n == 1) mySerial.print("VPF 002.mp3"); // play song nr one
 if(n == 2) mySerial.print("VPF 003.mp3"); // play song nr one
 if(n == 3) mySerial.print("VPF 004.mp3"); // play song nr one
 
 mySerial.write((byte)0x0D);
 delay(1000);
 n = n + 1;
 if(n > 3) n = 0;
 Serial.print("Song Nr "); 
 Serial.println(n); 
 delay(100);
 

} </source>