Pages: [1]   Go Down
Author Topic: Got a VLSI VS1000 Audio Module working with serial control.  (Read 1909 times)
0 Members and 1 Guest are viewing this topic.
Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.vlsi.fi/en/products/vs1000module.html

BIG CAVEAT: I got this through a friend who bought 2 at 20 Eu ea PLUS required courier shipping at 20 Eu each. We're trying to see about getting many at reasonable price plus shipping. At USD$55 each these are not a deal. I am sure that those in Europe can do much better!

Note the docs download links on the right side of the page. The module pdf has schematics and instructions as well as specs. It's nice and complete. There is enough there to modify, compile and load new code though I haven't gotten that far just yet.

It plays OGG files and WAV files. VLSI has an OGG converter that I haven't tried. For testing I used Format Factory that doesn't always do such a great job though I understand at least part of that is because I changed the data rate by just using the default. OGG files are smaller than MP3 even at the same quality but the ones I made are tiny compared and only a little artifact-y.

With OGGs on generic 2G micro-SD connect power, grounds and speakers and it plays. If you don't have a micro-SD there are voice files on the internal flash that play.

I don't have a stereo connector so I got some cheap earbuds and soldered jumper wires to the jack. IIRC the tip is one channel, middle is the other and back section is ground.

I went with 5V external power, it can take up to 6V VCC. Running from Arduino, power went down to 4.75V which works too. The module has a 3.3V regulated output and a 3.6V power-out pin as well that us used on the MAX232 control schematic to power the MAX232 but can probably power a small AVR if you don't milk it.

The default serial control is 115200 baud.
I tried using 2 UNOs at 115200 between each other running software serial at that speed with RX, TX and GND connected and got bad bits so for this I used a MEGA 2560 RX1/TX1 at 115200 with the module.
There is one voltage level shift needed. I ran 5V TX from the MEGA through 4.7k ohms to the VS1000 AM RX and 2 4.7k resistors in series to GND from that connection as well. VS1000 AM TX is 3.6V and works connected directly to the MEGA RX.

And that's pretty much it. Make sure to connect all the grounds together!

I am able to enter commands through serial monitor and it responds as I expect. It's a bit picky about file names (the PfilenameOGG command) being upper case. I ended up making 8.3 file names with 8 characters though it probably doesn't need them. First thing I do is send f to get it out of continuous play mode into file mode, then C to stop (Cancel) play. When a file is playing only certain commands work. Pause (=), resume (>) and volume control (-, +) always work as does time (?).

This is the MEGA sketch I used just for test purposes. It blinks pin 13 to show correct running.
Code:
#include "ctype.h";

byte blinkPin = 13;
byte blinkState = 0;
byte data = 255;

unsigned long blinkStart = 0UL;
unsigned long blinkNow = 0UL;
unsigned long blinkLen = 1000UL;


void setup( void )
{
  Serial.begin( 115200 );
  Serial1.begin( 115200 );
  pinMode( blinkPin, OUTPUT ); // should default LOW
  Serial.println( "\nStartup" );
}

void loop( void )
{
  blinkNow = millis();
  if ( blinkNow - blinkStart >= blinkLen )
  {
    blinkStart = blinkNow;
    blinkState ^= 1;
    digitalWrite( blinkPin, blinkState );
  }
  
  if ( Serial.available())
  {
    data = Serial.read();
    Serial1.print((char) data );
  }

  if ( Serial1.available())
  {
    data = Serial1.read();
    if ( isalnum( data ))
    {
      Serial.print((char) data );
    }
//    else if (( data == 13 ) || ( data == 10 ))
    else if ( data == 10 )
    {
      Serial.println();
    }
    else
    {
      Serial.print( " 0x" );
      Serial.print( data, HEX );
      Serial.print( "." );
    }
  }
}

Upcoming, I need to connect a USB interface and modify the software to run at 57600 or less to allow easy software serial control. I also need to make a wiring harness and ditch the breadboard.
« Last Edit: July 02, 2013, 08:25:46 pm by GoForSmoke » Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Boston
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been playing around with this module too. It seems really nice and simple to trigger sounds by either filename or number using basic SoftwareSerial. One thing to remember when triggering by number is that the files are not numbered in alphabetical order, instead they are numbered in order of transfer - so transferring your sounds over 1 at a time is the way to go if you're going to trigger them by number.

At the setup() of my sketch I set the VS1000 to File mode...
Code:
#include <SoftwareSerial.h>
SoftwareSerial vsSerial(2, 3); // Use Arduino pins 2 and three for VS1000 RX, TX

void setup(){
  vsSerial.begin(115200);
  vsSerial.print("f"); //switch VS1000 to File Play Mode
  vsSerial.print("C\n"); //cancel anything that the VS1000 might be playing
  delay(50);
}

To trigger a sound by filename, you start with a P character, then the 8 character filename followed by the extension (no dot). If the filename is shorter than 8 characters you must insert spaces in the command. For example...
Code:
vsSerial.print("PMUSIC   OGG\n"); //play sound file MUSIC.OGG

If a sound is being played, it first must be canceled before another sounds can be triggered. To do this you have to send a cancel command like this...
Code:
vsSerial.print("C\n"); //cancel any current playback
If the SD card is being used, this Cancel command can cause an unwanted pause. If the sounds are being played from the internal memory there is no pause and the VS1000 will be ready to play another sound straight away.

To play a sound my number you do a simple...
Code:
vsSerial.print("p51\n"); //play

I bought mine from PropellerPowered.us for $20 a piece. I also put together a basic Uno shield for two VS1000 modules


* IMAG1177.jpg (81.89 KB, 720x540 - viewed 73 times.)
« Last Edit: July 09, 2013, 09:44:22 am by JoyMonkey » Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't get reliable 115200 using software serial.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Boston
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't get reliable 115200 using software serial.


I haven't had a problem; but I'm also not trying to read from the VS1000, I'm only sending commands to it.
I've tested it on an Arduino Leonardo and a Seeeduino.
Logged

Wales
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't get reliable 115200 using software serial.
I've been looking at a fair few projects connecting Arduino UNO and VS1000 and they all seem to use SoftwareSerial. The guide says:

Quote
"HardwareSerial - Best performance. Always use this first, if available!".

Also

Quote
" The ATmega168 (328) provides UART TTL serial communication, which is available on digital pins 0 (RX) and 1 (TX). The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board via a USB connection."

But... what if I was using a Pro Mini (schematic)? I thought for a moment this might work, as the board doesn't direct pins 0 and 1 through the USB converted chip  as there isn't one

Then I saw a comment on the Pro Mini spec page which said:
Quote
digital pins 0 and 1 go to rx and tx for serial communication. they can't be used if you use the bootloader, but I would assume you could use them if you get rid of the bootloader.

I don't even understand that - why would the bootloader disable hardware serial? Does it? Or is that nonsense?

But then again, I saw this which appears to suggest you can even use the Uno R3 for hardware serial:

Quote
I can't think of a reason why your peripheral UART and the USB-UART would interfere. You probably want to disconnect you UART peripheral during programming, as it may interfere with programming.

I realise this is in danger of drifting off into a more general serial hardware question, but basically:

Arduino Pro Mini + VS1000 + hardwareSerial: Yes or no?

BTW, yes, I'm aware of the AltSoft serial library, but that still only goes to 57600 and besides, "Consumes a 16 bit timer (and will not work with any libraries which need that timer)" - which I need.
« Last Edit: December 16, 2013, 12:49:56 pm by lardconcepts » Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I sent data between 2 UNO's using software serial on both. Some characters corrupted. Yes, I tried more than once and did change jumpers. Soldered, it may be okay. 57600 worked solid as rock. End of story.

I used a MEGA to get the VS1000 playing right.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Wales
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I sent data between 2 UNO's using software serial on both. Some characters corrupted. Yes, I tried more than once and did change jumpers. Soldered, it may be okay. 57600 worked solid as rock. End of story.

Ah! I wonder if you can reduce the VS1000 to 57600...hmmm, might have to look into that!
Still losing 2 pins though. On the other hand, I could pass off some of the "pin work" like LCD driving, to the VS1000.
Swings and roundabouts!

I used a MEGA to get the VS1000 playing right.

For a one off, to test, it might be worth investing. But the difference between an Uno-compatible Pro Mini at £2 and the cheapest Mega 2560 clone at £16 is an 8x increase in price for that part, making the project unviable. So I'd rather avoid that route if possible!

Thanks for the info though.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is much for you at the VLSI website. Their DSP's have MCU's built-in with program space and limited GPIO pins. There's a book on programming the 1053 there.

2 pins? Adafruit has a VS1053 + SD breakout module for $25. By default the control is SPI which is > 2 pins. Most VLSI modules I have seen use SPI.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pages: [1]   Go Up
Jump to: