Arduino library for WTV020-SD-16P audio module

It's attached to the first post on the first page of this thread.

rulicos:
I´m trying to conect the module like point 8.8 of datasheet. Reset works but when a press play, led go off and i heard a noise for 1-2 second, then stop and led go on. I try with 4 differents sd (two of 2gb kingstom and scandisk, one of 256mb and other of 4gb)

I try with 2 speakers of 8 ohms and 3w and 1w, and somes buzzer and little speakers. I try with mnay audio example form hear an otrher from youtube

I think ALL problems with this module are because of the power supply. SD cards need more than 3.3V to work (it's in their specification).

Using this power supply, all my problems disappeared:

wtv_power.png

Hey, Thanks for the library.

I am using Audio-Sound Breakout - WTV020SD from spark fun (https://www.sparkfun.com/products/11125), people recommend to use your library to control this module.

I first tested the model without arduino, simply grounded the play pin and it worked, I can hear sound coming from the speaker. however it didnt work with the library.

I'm not sure if I connected the right pin. according to the library, the pin 2 on arduino goes to reset on the module; pin 3 to DCLK, pin 4 to DIN, pin 5 to BUSY. and connect VCC to external 5v power.

is this correct?

thank you !

best

the-rebel-agent:
Welcome and you are clear to go. Just be careful about the micro SD card you are using. Got a lot of pain in the b... figuring out why mine did not work from the start.

I hope you share on that later in this thread!
Learning traps to avoid after stepping in so many is why I read so many posts!

Waytronic-Jasmine(Li):

djole_ru:
Hello!
I have a question!
How to manually change modes on vtv020-sd-16p,all ekys are on/off(loop),key 5 group of voice...
Thanks!!!

I want to ask which control mode module do you use?for example ,If you buy 2-wire series mode can not us key 5 group of voice,control mode is fixed when we program main chip,and you need tell supplier what you want,i think they will give you correct control mode module.

Please. On eBay the supplier tells little. This is typical and notice it says "MP3":

Nothing about mode. This one also uses mini-SD I don't find easily, nor adapter mini to micro-SD so this module says 'problems' to me.

I am having problems enough with the VS1003 modules I got. Yes there is software for other modules with the same chip that do almost what I want. In the meantime I have someone who wants dozens of Arduino-controlled sound players.

What I find that "works out of the box" is expensive and the rest are take your chances when buying and see how many hours before you get it to work if ever. Does that sound like any way to sell a lot of anything here?

HELLO,
this page helped me alot when I started using WTV020. i had used it as both stand alone mp3 player and interfaced with arduino (using arduino UNO and arduino mega 2560 both!). it was working pretty well. but now when I am trying to play the module, all I hear is a slight beep. nothing else. thje connections are pretty fine and so is SD card. can anyone suggest me what can be the problem? How can i get it working again! please help me out.

Kindly explain in English. I don't understand the language

I finally got mine to work. All this time is was an incompatible memory card. The data sheet should give some examples of working cards to use, that way we know what to get, the first time.

I've got the Sparkfun breakout board for this audio module working intermittently. I'm using it in serial mode connected to an Arduino UNO with the Wtv020sd16p.h library from the original post in this thread. The breakout board is powered from the 3.3 volts from my UNO. I'm getting my sounds to play okay, but frequently I don't get any sounds. If I remove power the UNO (which removes power from the breakout board), then re-apply, it works again. I've tried adding a speaker.reset() before I try to play a sound. I also tried increasing the delay() in Wtv020sd16p.cpp on line 37 from 300 to 750 and line 94 from 20 to 50 per a suggestion from a Sparkfun user in the breakout board comments, but neither helped. Here's my sketch:

#include <Wtv020sd16p.h> 

int resetPin = 8;  // The pin number of the reset pin.
int clockPin = 9;  // The pin number of the clock pin.
int dataPin = 10;   // The pin number of the data pin.
int busyPin = 11;   // The pin number of the busy pin. 

bool playingSong; 

// Create an instance of the Wtv020sd16p class.
Wtv020sd16p speaker(resetPin,clockPin,dataPin,busyPin);

void setup() 
{
  Serial.begin(9600);
  speaker.reset(); // Initializes the speaker module
  playingSong = false;
  Serial.println("Finished setup");
}

void loop()
{

  if (playingSong == false)
  {
    Serial.println("Play sound");
    speaker.asyncPlayVoice(0);
    delay(200);  
    if(digitalRead(busyPin) == HIGH)
    { 
      playingSong = true; // Set flag so command to play song doesn't run again
      Serial.println("Busy"); 
    }
    else
    {
      Serial.println("speaker not busy");  
    }
  }
  
  if (digitalRead(busyPin) == LOW)  // when song is over, reset flag so it will play again
  {
    Serial.println("finished song, play again");
    playingSong = false;
  }
}

When I have the problem of no sound the sketch outputs this over and over, it's seems to loop a few times per second:
Play sound
Busy
finished song, play again
Play sound
speaker not busy
finished song, play again
Play sound
Busy
finished song, play again
Play sound
speaker not busy
finished song, play again
Play sound
Busy

Hi the-rebel-agent,

Thanks for your library. Got my unit up and running in less that 30 minutes (most of it getting the wiring right!).

I had an old 64Mb(!) micro SD card that works fine and will probably be enough for what I want to do (voice for a robot).

Thank you for sharing this library!

I'm using the SparkFun breakout board as well, but I'm encountering some weird problems. Basically, I can get it to play back sounds, but when I try to play multiple files in a row, things don't work properly. Sometimes it will play the first file and then nothing for a couple of minutes, sometimes it will skip a file. Here's an example:

while(true){
wtv020sd16p.playVoice(1);
delay(2000);
digitalWrite(testLED, LOW);
wtv020sd16p.playVoice(3);
delay(2000);
digitalWrite(testLED, HIGH);
}

This behaves erratically. The LED flashes as expected, but the sound doesn't always play. Sometimes file 1 will play, sometimes nothing plays, and rarely file 3 plays. If I take it out of the loop, file 1 usually plays, but file 3 does not. I also tried it with asyncPlayVoice(), with the same results. If I take the delays out, the LED flickers and then stops while one of the files plays. Then it flickers some more and plays another file (usually it'll alternate, but sometimes it'll repeat).

Any ideas?

As with so many others on this thread, my problems have all come down to SD card issues.

Both a Sandisk and a Kingston 2GB failed to play any music at all - however a no-name 2GB card works fine. And by "works", I mean all songs play through fine as expected via 2-line control as done by this thread's library - so I must add my name to the chorus thanking the-rebel-agent!

And this behaviour was exactly the same on 2 WTV020-SD-16P modules (I got the second while trying to get the first to work, since I assumed Sandisk not working implied there might be a problem with my module).

All 3 SD cards look fine when used with a Mac SD card reader. However particularly in the case of the Sandisk, I wonder if the branded SD cards are genuine, particularly Sandisk which has a huge fakes problem?

My next steps

  1. Run cards through F3 (http://oss.digirati.com.br/f3/, Mac version of h2testw) to see if anything emerges.
  2. I have seen elsewhere (http://forum.arduino.cc/index.php?topic=115411.0) people suggesting trying slightly higher than 3.3v to the WTV, eg send in 3.6v - and that this can make previously failing cards work. I am getting a variable voltage regulator so I can try various levels and see if that helps with the 2 cards that are currently failing.
  3. I've just got a job lot of old 1Gb and smaller SD cards and will see if any pattern emerges from that, in terms of what SD cards work and what don't.

If anyone could give an amazon UK (or other) supplier of cards that is guaranteed to work, that would be extremely useful!

  1. Run cards through F3 (http://oss.digirati.com.br/f3/, Mac version of h2testw) to see if anything emerges.

All 3 SD cards showed full capacity and no errors on reading/writing. So nothing obvious there. The no-name SD card that works is slower than the other two - could it be possible that cards get too fast for the WTV020 somehow?

I will put results on this thread when I've got the regulator to test 3.5/3.6 driving voltage, and/or have tried a wider range of SD cards.

I would like to make a whole bunch of very small, very noisy things, and the WTV is the ideal module - if I can figure out a reliable source of working SD cards.

Faster card might drain more current but only if you run it faster.

Having now tried a number of SD Cards at various voltages (3.3v, 3.40v, 3.48v, 3.57v):
Kingston 2Gb: 1 card, doesn't work at all
Transcend 2Gb: 1 card, doesn't work at all
Sandisk 2Gb: 3 cards, 1 works at 3.3v, 2 require 3.4v+
No-Name 2Gb: 1 card, works perfectly at 3.3v
No Name 128Mb: 8 cards, 7 work perfectly at 3.3v, 1 skips some plays at 3.3v, works at 3.4v+
Nokia 128Mb: 3 cards, 2 work perfectly at 3.3v, 1 skips some plays at 3.3v, works at 3.4v+

Conclusions (from my admittedly limited sample):
128Mb cards do better at 3.3v than 2Gb cards
Moving slightly above 3.3v seems to help with some cards (but is not a sure-fire cure)
Once you hit 3.4v, increasing further doesn't help with any more cards from the sample

Drilling down on one of the Sandisk 2Gb cards that needs more than 3.3v, it works at 3.38v or above, and not at 3.35v or below. So less than 0.1v is making the difference here.

I have a Samsung 1Gb and it works fine. I bought a 5 pack on eBay, just in case the card stops working.

Hi,
Recently I bought a WTV020-SD-20SS module from http://emartee.com/product/41928/MP3%20SD%20Card%20Sound%20Module. But it is not behaving properly.When I gave command wtv020sd16p.asyncPlayVoice( 0) or wtv020sd16p.asyncPlayVoice(2) it does not play any sound. Again if I give wtv020sd16p.asyncPlayVoice(1) or wtv020sd16p.asyncPlayVoice(3) or wtv020sd16p.asyncPlayVoice(5) it play both 0002.ad4 and 0003. ad4 alternatively. I tried changing the mask HEX value (eg. unsiggned int mask = 0xFFFF) in the .cpp file it again behave differently.
Previously I was using WTV020-SD-16 p module from Sparkfun and it was working properly with the library.

What I feel is that , probably the timing or the mask value is not correct for WTV020-SD-20SS module. Can you help in resolving the issue?

-neel

Has anyone been able to get the volume command working properly with this device? According to the spec, commands 0xfff0 through 0xfff7 should set one of eight volume levels, but only mute (0xfff0) and full volume (0xfff7) work properly. Intermediate values cause the audio to become very choppy, randomly changing volume, like maybe the ADPCM can't sync up? This happens with this library (if I change, say, VOLUME_MIN from 0xfff0 to 0xfff3 and call mute()) as well as an interrupt-based one I'm working on.

I'm using 32Kb/s ADPCM files from the UsbRecorder utility.

Joe

Has anyone been able to get the volume command working properly with this device? According to the spec, commands 0xfff0 through 0xfff7 should set one of eight volume levels, but only mute (0xfff0) and full volume (0xfff7) work properly. Intermediate values cause the audio to become very choppy, randomly changing volume, like maybe the ADPCM can't sync up? This happens with this library (if I change, say, VOLUME_MIN from 0xfff0 to 0xfff3 and call mute()) as well as an interrupt-based one I'm working on.

I'm using 32Kb/s ADPCM files from the UsbRecorder utility.

Joe

I modified the library to increase and decrease the volume, and it works great. I added three new functions to the library. Hope these help.

Wtv020sd16p.cpp (2.74 KB)

Wtv020sd16p.h (717 Bytes)

keywords.txt (566 Bytes)