Arduino Forum

Using Arduino => Audio => Topic started by: the-rebel-agent on Aug 02, 2012, 08:26 pm

Title: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Aug 02, 2012, 08:26 pm
WTV020-SD-16P audio module:

(http://images.hellotrade.com/data/0/J/MY-1201704/IMG_0049_250x250.jpg)

This is my first contribution for the Arduino community. With this library you will be able to play wav or ad4 files easily. Will be adding new method or features in the future. Built this cause I need it for my Arduino project.

Code: [Select]
/*
Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
 //Initializes the module.
 wtv020sd16p.reset();
}

void loop() {
 //Plays synchronously an audio file. Busy pin is used for this method.
 wtv020sd16p.playVoice(0);
 //Plays asynchronously an audio file.
 wtv020sd16p.asyncPlayVoice(1);
 //Plays audio file number 1 during 2 seconds.
 delay(5000);
 //Pauses audio file number 1 during 2 seconds.  
 wtv020sd16p.pauseVoice();
 delay(5000);
 //Resumes audio file number 1 during 2 seconds.
 wtv020sd16p.pauseVoice();
 delay(5000);  
 //Stops current audio file playing.
 wtv020sd16p.stopVoice();
 //Plays synchronously an audio file. Busy pin is used for this method.  
 wtv020sd16p.asyncPlayVoice(2);
 delay(2000);  
 //Mutes audio file number 2 during 2 seconds.
 wtv020sd16p.mute();
 delay(2000);
 //Unmutes audio file number 2 during 2 seconds.
 wtv020sd16p.unmute();
 delay(2000);    
 //Stops current audio file playing.
 wtv020sd16p.stopVoice();
}


Unzip Wtv020sd16p.zip and copy Its content into the Arduino library IDE folder. If you have any question or request, please don't hesitate in contact me.

Update: August 6th.
Added pause, stop, mute and unmute method as well updated the example program. Hope this helps.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 05, 2012, 03:55 am
Hi the-rebel-agent,

Hats off for sharing your experience :)

I am going to play with the same module but decided to ask and get the pin diagram confirmed. I found the following application circuit for this device.

(http://i303.photobucket.com/albums/nn135/chathusrilanka/Arduino%20Forum/Schematic.jpg)

I believe the following is the way of identifying the pins. Can you please confirm? :)

(http://i303.photobucket.com/albums/nn135/chathusrilanka/Arduino%20Forum/PinConfig.jpg)

/Chathuranga

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Aug 05, 2012, 05:33 am
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Aug 07, 2012, 04:36 am
Updated the library. You can read about changes in post # one.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 07, 2012, 07:00 am
Nice Stuff :)

I will add my findings etc when I continue with my experiments. I am about to start :)

The Datasheet says the maximum supported size of the Card is 1GB. Is that so or could you be able to use a card with higher capacity? I cannot imagine a reason of limiting the size at 1 GB because generally the address spaces are larger than that..  :~
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 07, 2012, 05:57 pm
Bravo, Tested library and worked fine.. :)

And answering my previous question, I tested this with a 2GB SanDisk MicroSD card successfully. In other words there is no limitation of 1GB.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Aug 07, 2012, 07:42 pm
Weird, I tested a 2gb genuine Kingston and did not work. 2gb for ad4 files is a waste of space anyway.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 07, 2012, 08:44 pm
Yes. That's true. But here in my country it is really difficult to find a Micro SD with a capacity less than 2GB. :(

My Prototype didn't work with 1GB Unbranded micro SD card. But in the case of this audio module we have no way to check where the error is. If it is simply in SD card, then you may lose hours for troubleshooting.

But as far as I see, the sd cards that fail on this module cannot be read using SdFat or Arduino SD library. In summary if you can read an SD card using SD library then it should work on this audio module as well.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: gregtom6 on Aug 17, 2012, 05:15 pm
Hy all!

Where can I order this thing?
I have found mini SD card modules, and it said: 8?Two module types of WTV020-SD-20S and WTV020-SD-16P
What is the difference between them? Will this library work for both?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Aug 17, 2012, 06:27 pm
You can buy the same one here:
http://www.ebay.com/itm/160806790230?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

and I do believe this library will work with both.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 21, 2012, 08:40 am

You can buy the same one here:
http://www.ebay.com/itm/160806790230?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

and I do believe this library will work with both.


The only difference is the chip packaging. (DIP 16 and SOP 20) There are no functional difference between two sub-models. So the-rebel-agent's library should work perfectly with both the types. If you need more details on the difference of the package (I don't think you need  :P) you can find it on http://letsmakerobots.com/files/WTV020_manual_V1.3.pdf (http://letsmakerobots.com/files/WTV020_manual_V1.3.pdf)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: tas_tig3r on Aug 24, 2012, 01:02 am
Hi everyone!

I bought one of these on ebay, trying to use as sound module for portal gun replica. I wired up as data sheet suggests, connected to my arduino lilypad, and tested. No sound from piezo speaker, busy led flash 2 or 3 times then full on constantly.

I'am using a Sandisk 1gb micro-SD, has anyone tested one of these to see if they work?

Thanks in advance!

-tas

(let me know if you would like video/pictures of setup, i can provide later)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Aug 27, 2012, 08:00 am

Hi everyone!

I bought one of these on ebay, trying to use as sound module for portal gun replica. I wired up as data sheet suggests, connected to my arduino lilypad, and tested. No sound from piezo speaker, busy led flash 2 or 3 times then full on constantly.

I'am using a Sandisk 1gb micro-SD, has anyone tested one of these to see if they work?

Thanks in advance!

-tas

(let me know if you would like video/pictures of setup, i can provide later)


Are these things correct?

1. Did you convert your files to AD4 format?
2. Is the naming convention of the files correct?
2. Do you know your SD card is "supported"?

I am successful in using a SanDisk 2GB so I believe your sandisk 1Gb should work without any trouble. The best way to verify this is to use a SD shield or Ethernet shield just to verify your MicroSD.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: tas_tig3r on Aug 27, 2012, 11:53 am
Hey.

1: Yes the files were converted. Just to make sure I downloaded the test file made (and tested) by another user on these forums.
2: As far as I am aware, I just needed to copy the files named 0000.ad4, 0001.ad4, etc to the SDcard root dir?
3: Ok. If the file tree is correct, then I will try a different card.

I don't have a shield to test it with, as money is tight at the moment, and I've never needed one. Please let me know about the file tree if you can, as I can't find any info about it on the web. Cheers!

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: mohitpundir on Aug 28, 2012, 08:40 am
Hey everyone,

I've been working on the WTV020-SD-MINI for about 1 week but to no avail. After reading up almost everything posted on the web and utilizing all the files that were shared which proved to be working, I'm still not getting any sound except a few bleeps when the busy pin's LED blinks. I'm currently using a 1GB Samsung uSD card and I think that it is the culprit.

I will be changing this uSD card to a Sandisk soon and hope it will work, fingers crossed  :smiley-roll-sweat:
Will get back to you guys soon after changing the uSD.

mohit
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: tas_tig3r on Aug 29, 2012, 11:19 am
Ok! I got it working! Turns out it was the SD card. Cheers for the help everyone!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: rogue9607 on Sep 02, 2012, 06:06 pm
I've been working with a Somo-14D recently on a lightsaber project.  I got it generally working until I realized that it couldn't do gapless playback.  The gap was very small, but very noticeable when going from a swing directly into a hum.

Do you know if this module can do gapless playback?  I know the two units are similar, I just don't know how similar.

Thanks!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: foxbau on Sep 06, 2012, 03:17 pm
I  just got from China a board : V1.5 / 2012.01.12", and "5v  / 3.3v

The only successfully way to format my Nokia mirco SD 512 MB
was win / cmd(Admin) / diskpart .
( http://www.chip.de/bildergalerie/Windows-To-Go-So-laeuft-Windows-8-auf-USB-Sticks-und-Festplatten-Galerie_54926063.html (http://www.chip.de/bildergalerie/Windows-To-Go-So-laeuft-Windows-8-auf-USB-Sticks-und-Festplatten-Galerie_54926063.html))

Up to now I run the board stand alone.
OK Files:
- 000X.ad4
- 000x.wav   freq 12.000 Mono and -1dB

It is possible to run MP3 im stand alone modus ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: zargnut on Sep 09, 2012, 01:40 am
Likewise... I have been trying to get this to work and have not heard a peek in testing.

I am using the sparkfun board pictured below. https://www.sparkfun.com/products/11125
1gb sandisk microSD
1 sound file on the card at 72kb.
FAT formatted on windows 7
File is named 0.ad4, and located in the root directory

I have tried wiring it up directly to 3v power, to the 3.3v and Vcc pads and touching the reset and play pins to ground... nothing

I tried using the arduino with this library as well, and have not seen any data on the serial monitor, nor any reaction from the board.

Would anyone with experience getting this to work consider writing an idiot helper post detailing exactly how to configure the board, leads, arduino code/libraries to get a hello world equivalent file to play?

Is there anyway to isolate whether the SD card is the problem vs a user error in wiring and configuring?

thanks
dan

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: MoShang on Sep 11, 2012, 07:18 pm
Hey guys,

Just a big thank you to the-rebel-agent for the library. I'm totally new to the arduino and electronics, but managed to get my module up and running with very little problems. I sourced my module from the e-bay link provided earlier in this thread and changed the solder-jumper to  5v. Everything seems to be working as it should.  :D 
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Sn4ke on Sep 29, 2012, 08:23 pm
Thanks for this library ! I managed to get my module working. I used a noname 2GD card.

However, if i call the playVoice() or asyncPlayVoice() function once, nothing happen. I have to call the function several times to make the module work.

Another problem is that the playback stops 10 ou 20s after the beginning. I tried with 8bits 22050Hz and 8bits 11025Hz.

Has anyone succeeded in playing a long file ?

Thanks !
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 03, 2012, 03:12 pm
Thank You very much the-rebel-age for this library and example.
It works great.
And thanks chathuranga for the schematic you posted, it helped.
I have 1.5v module from the link you gave.
I use these 2gb micro SD card for all my Arduino modules that need micro SD(ethernet, tft lcd, etc.).
http://www.amazon.com/gp/product/B000VOU91U/ref=oh_details_o01_s00_i00 (http://www.amazon.com/gp/product/B000VOU91U/ref=oh_details_o01_s00_i00) and they work great.
Also, for others if you don't want the sounds looping put all the code you need from the void loop part of the sketch in the void setup part(leaving void loop empty or commented out), then you have full control through the module buttons.
This is all you need for setup and loop for simple playback/stop and select.
Quote
//Initializes the module.
void setup() {
 wtv020sd16p.reset();
}
void loop() {
}


Thanks again!!!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: batchku on Oct 06, 2012, 09:22 pm
Hello all,
I'd like to put together a tutorial for my students for audio-from-arduino.
Would those who have succeeded with this board please tell me
1)  what code they used? (the original library posted by the-rebel-agent is the winner?)
2)  what is the proper hook-up of pins (i.e. circuit diagram).  the one posted by chathuranga  works?

thanks in advance,

ali
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: lokeras on Oct 10, 2012, 04:20 pm
I am having problems with this module, i cant change the song that sounds every time it sounds the 0000 sound

Any idea??
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Caritusm on Oct 10, 2012, 11:55 pm
Hi the-rebel-agent,
I have the Arduino 1.0.1 Software, and when I try to verify  your code the following errors appear:


WTV020.c: In function 'reset_WTV20':
WTV020.c:17: error: 'PB2' undeclared (first use in this function)
WTV020.c:17: error: (Each undeclared identifier is reported only once
WTV020.c:17: error: for each function it appears in.)
WTV020.c: In function 'send':
WTV020.c:25: error: 'PB1' undeclared (first use in this function)
WTV020.c:28: error: 'for' loop initial declaration used outside C99 mode
WTV020.c:33: error: 'PB0' undeclared (first use in this function)


I'm new to the use of Arduino, so any help will be welcomed.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 12, 2012, 02:30 pm
Caritusm, make sure you have put the Wtv020sd16p folder in the Arduino IDE library.
Wtv020sd16p.h MUST be present for the code to work.  ;)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: kariloy on Oct 14, 2012, 03:39 am

Bravo, Tested library and worked fine.. :)

And answering my previous question, I tested this with a 2GB SanDisk MicroSD card successfully. In other words there is no limitation of 1GB.


EDIT: SUCCESS, FINALLY!
I booted my computer in my windows partition and used this tool:
https://www.sdcard.org/downloads/formatter_3/
to format my SD cards [Overwrite Formatting Option], I've only tried the SanDisk & Kingston but I assume the other one works too!

So the issue with the SD cards may just be [I speculate] nuances on the different implementations of available formatting tools (previously I was using gparted).

-------------------------------

Alas, [previously] I am [was] not being so lucky.

I've tried with 3 different 2Gb microSD cards:
- SanDisk, Kingston & unbranded
- Formatted them all with FAT16 filesystem (and even tried to make a partition smaller than 1Gb)
- Used several .ad4 files "fished" from these foruns and lately official sample ad4 files from the 4D website

Connections:
Module pin 1 --> arduino pin 2 (reset)
module pin 4,5 --> speaker (tested 3 variants: 8ohm/0.25watts; 16ohm/0.3watts; unbranded earphones)
module pin 7 --> arduino pin 3 (clock)
module pin 8 --> GND
module pin 10 --> arduino pin 4 (data)
module pin 15 --> arduino pin 5 (busy) + led setup (replaced 470 ohm resistor w/ 390 ohm resistor)
module pin 16 --> VCC (both +3.3V and +5V after changing the jumper)

the module I bought was the one in the link the rebel provided... using his library, his sample code...

... and all I got is the a tiny short "switching" noise when the LED blinks, if I hold the speaker to my ear...

So, according to your own experience can't you detect any flaw in my setup? Or is it just another case of the microSD card Russian roulette?

P.S. - I'm all out of microSD cards to try and I don't have an SD shield.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: vanduino on Nov 01, 2012, 06:32 am
Where is the link to a library download? I can't find it in this thread.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: chathuranga on Nov 01, 2012, 06:36 am

Where is the link to a library download? I can't find it in this thread.


It is attached to the very first post of this thread. You can see it only if you are logged in.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: vanduino on Nov 01, 2012, 07:15 am
OK, I changed browsers and found the link. Thanks for the good work.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 05, 2012, 06:27 pm
Hey, thank you very much guys for your greetings. I am really pleased that my little piece of source code did something useful. I have been out of this forum but I am back. First of all, when you have a problem with this sound module, 90% of the times, blame the uSD card. IT is VERY pesky about them. Later, could be the wired, and If everything else did not work, just replace the module.

About the gap, It depends entirely on the software and the module. It seems that needs 20 [ms] to switch between tracks. That's the gap you heard. I have been trying to fix that, but seems impossible given the hardware. I also moved the pin from 3.3 to 5 in one of my modules ( I have 2 of them) and did not work. Put 2 diodes, as recommended and worked, but no so fine. Any other moved the pin and got fine results?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: robopaul on Nov 06, 2012, 02:30 am
I can't find the zip file can give me that. :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 06, 2012, 03:34 am
It is attached at the very first post. You have to be logged to see it.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: robopaul on Nov 06, 2012, 07:09 pm
Oh ok THANKS got it
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 06, 2012, 07:26 pm
Just let me know If you need anything else. Always a pleasure to help.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dmsherazi on Nov 12, 2012, 08:39 am


FAT formatted on windows 7
File is named 0.ad4, and located in the root directory






use the sd card formatter utility, and rename the file as 0000.ad4

first try to use the ad4 files that have been tested by others , it will help u
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Malcom X on Nov 13, 2012, 09:25 am
Hello, congratulations for the work.
You can select a track between the files on the sd.
Create a sort of mp3 trigger.

:) :) :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 16, 2012, 12:52 pm
Hey guys, anyone using it at 5V? Cause I moved the soldered pin from 3.3 to 5 and could not get it to work. Quite erratically. I did not use any diode cause I believe they are soldered in the pcb board. Any idea?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 18, 2012, 04:34 pm
Posted a new library here http://arduino.cc/forum/index.php/topic,133013.new.html#new for an audio amplifier that works with this audio module.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dmsherazi on Nov 19, 2012, 07:56 am
I am running it on 5V supply without changing the jumper , and using 2 diodes.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 19, 2012, 01:32 pm

I am running it on 5V supply without changing the jumper , and using 2 diodes.

So, your board is working fine, cause I tried that setup and could not make it work. Functionality was erratically.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 19, 2012, 01:59 pm
You are abs right. Tried that with my two modules and did work. Maybe I tried that in the past with the defective one I had. Good!
Title: Warning. Switching module to 5V seems to have destroyed the SD Card :-(
Post by: synergie7 on Nov 26, 2012, 09:42 am
Just a note in case anyone else tries this.

I bought one of these modules on eBay and following some instructions from someone on YouTube, I resoldered the jump link to set the voltage to 5V instead of 3.3V (there are 3 solder pads and you join 2 of them).

I did this because I could not get the module to make any sounds, even though the (busy) LED was flashing as if it was receiving commands etc.

Anyway. Following switching the module to 5V, it still didn't work, but when I tried to re-load the AD4 files, the SD card was no longer readable.

So it looks like the module may work on 5V, but not all SD cards (well not mine).
Hence I'd not advise anyone to try this unless the know their SD card is 5V tolerant.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 26, 2012, 08:10 pm
Well, I don't think any micro sd card works at 5V. So, basically If does not work, It is not weird. If you need your wtv working at 5V, interconnect the diodes 4007 and go back that soldered pin to 3.3v.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Nov 26, 2012, 08:34 pm
Here you have the wtv working at 5V with two diodes:

http://www.youtube.com/watch?v=IpUpi0OmHHI
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: onesky on Dec 01, 2012, 01:59 pm
it seems it's working fine, also sound quality
what diode did u use and where did u soldered?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Dec 01, 2012, 05:00 pm
1N4007. Connected in series as you will do with two power supplies to add its volts.

(http://www.eleinmec.com/figures/029_02.gif)

5V entering to the + lead of the first diode and connecting the - lead of the second diode to the wtv.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: onesky on Dec 02, 2012, 01:09 am
um, i think i am going to test again the board with 3volts pin and diodes
want to see if it will work better
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Dec 02, 2012, 05:07 pm
I did not notice any difference in quality working at 5v or 3.3v.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Dec 17, 2012, 03:07 am
By placing the two diodes in series with the 5v supply your dropping the voltage at the module input to 3.8v.
Essentially just feeding the module .5v over the recommended 3.3v.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: hart on Dec 23, 2012, 12:31 am
I'm using an Arduino Uno to drive one of these boards (http://www.embeddedadventures.com/soundout_wtv020_module_mod-1007.html) based on the same chipset - the library works in as much as a single file play results in audio being played, however, when I try to queue up files in my code (to announce different digits, words, etc, like a talking clock, for example), the busyPin detection does not seem to be working.

I added a couple of lines of code to the playVoice() function to light up the on-board LED (pin13) when the busy loop was waiting but even on a four second audio file, the LED doesn't come on, indicating that I'm not getting the right busyPin status somehow... I've tried two modules (I had a spare) but so far no luck...  I have to resort to putting delays between playouts (commented out below to demonstrate the problem) but no luck.  each audio file is simply the spoken words "one", "two", etc, with 100msec of silence before/after the word.

any ideas appreciated!

Code: [Select]
/*
Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

int ledPin = 13;

const int buttonPin = 8;     // the number of the pushbutton pin
int buttonState = 0;         // variable for reading the pushbutton status


/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
  //Initializes the module.
  wtv020sd16p.reset();
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);   
  wtv020sd16p.unmute();

  pinMode(13, OUTPUT);
//  digitalWrite (13, HIGH);
digitalWrite(13, LOW);

}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {   
 
  //Plays synchronously an audio file. Busy pin is used for this method.
//  delay(25);   
//  wtv020sd16p.setVolume(7);
  wtv020sd16p.playVoice(1);
//  delay(5000);
  wtv020sd16p.playVoice(2);
//  delay(5000);
  wtv020sd16p.playVoice(3);
//  delay(5000);
  wtv020sd16p.playVoice(4);
//  delay(5000);
  //  wtv020sd16p.mute();
  }
}

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: lu9jmg on Dec 23, 2012, 05:17 pm
Busy pin is not always detected when using synchronous playback (playVoice), so add a delay of 50 ms before the detection of busyPin.
Add delay(50) in the line 42 of Wtv020sd16p.cpp

Good Luck!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: hart on Dec 24, 2012, 03:36 am
i lu9jmg,

thank you for the suggestion - that makes perfect sense - the vendor made a similar suggestion overnight (emailed from o/s while on vacation, that's service)!  I'll give it a go after Christmas is over - my wife is mad at me for spending too much time on this as it is right now :-)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: hart on Dec 26, 2012, 12:47 am
that solved it - thanks very much!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: djole_ru on Dec 26, 2012, 03:21 pm
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!!!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ac2013 on Dec 31, 2012, 03:44 am
Hi, thank you for sharing the library!
I've got questions that I'm hoping someone here can answer one or more of them.  They're not specifically about use with the library, but any answer about either the modules themselves or what has been done with them with or without the library and an external MCU would be greatly appreciated!

1) This is a simple question that I hope that most anyone should be able to answer.  The module claims to support some modes of playback where the playback will begin when the module is first powered on, and other modes where the playback is triggered by the binary level of particular I/O pins.  I would like to be able to power off the module and have it begin playing automatically very soon after power turned on in some possible modes.  I would like sound to begin playing less than one second after the module's power is first turned on, preferably much less than 1 second delay before playing begins.  Is this possible?  When you have an audio file that is abruptly loud at the very start of the file will you begin hearing playback within milliseconds or less than 1 second later from switching power on to the module?  I am concerned that it may behave differently / much more slower after power is applied versus the short delay that is achievable when power has been already on for a long while and the playback is triggered by an I/O action.  Some comment on a module seller's page suggested there was some configuration that could be changed having something to do with a busy line and some coding that would make a version 1.1 module play back without an added delay but there was no clarity as to what was meant there and whether the delay affected initial power on or track switching or pause/play switching or whatever.  My main concern is auto-playing from power-on in any particular configuration..

2) Earlier in this thread "sn4ke" stated an inability to play long files and said that his/her playback stopped after 10 or 20 seconds whatever they tried.  Is this a limitation of the modules?  I was hoping to be able to play long files perhaps 30 minutes or 1 hour long with one of these modules.  Is it possible?  I have seen no explicit specification to confirm or deny that this is possible.
Has anyone successfully played a single file (other than infinite looping a short file) more than several minutes in duration?  30 minutes or more?

3) I see from the module specifications that it has a very low quiescent power consumption in the microamps range, but it never specifies what quiescent state is other than the SD card being absent and it never specifies the amount of current used during other cases like "playback paused", "powered on, but playback stopped / not yet triggered by I/O command", "track playback finished and not looping", etc.  I see there is some serial command to turn on/off the amplifier as well as configurations to pause / stop playback, but I have no idea how much power the module will consume when powered on but not playing in such cases.  Does the module automatically go to low power quiescent mode whenever it is not playing a sound such as in "pause" or "stopped" mode?  What sort of current draw do you see when playing and when playback is not happening in various states?  What current reduction do you see when you send the turn off amplifier command and playback is not happening?  Does the SD card also go into low power or turned off state when the module is not playing in some mode?

4) How is the audio quality in AD4 or WAV mode at the maximum possible sample rate?  I am not expecting "hi fi" CD quality but I wonder if it is pretty good for sounds which might be of a relatively quiet and subtle nature such as natural sound effects like perhaps the ocean, bird calls, river water flowing, soft speech or soft song that sort of thing.  I'm hoping for something better than "telephone quality" 8kHz/PCM but obviously not as good as a CD.  How would you rate it?

5) I see there is a 16 pin DIP version of the WTV chip though I still haven't worked out whether it is compatible with being hooked to a SD card to play like the 20 pin variant of the chip in the WTV-020-SD module can.  I guess there is some firmware on the WTV chip itself that affects its configuration / version but I haven't gotten into it much.  I was just thinking of designing a custom PCB with just the chip and a SD card instead of the module and wasn't sure if either the 16pin or 20 pin chips would work and what other considerations there may be.  The data sheet I've seen isn't that clear.   Who makes the chip itself anyway?  Got a web link?

6) What's the lowest cost host board for these modules you might use if you're going to want to use it with something like an AVR/ATMEGA MCU, maybe a small rechargeable battery, voltage regulator, etc. in any larger quantity of units?  The arduino's I've seen are a little large physically and costly in the case of needing dozens or hundreds of units and of course still aren't quite plug and play in interfacing to a module like this.

One comment about the use of diodes like 1n400x to convert 5V to 3.3V compatible power supplies and for logic levels.  It is a horrible idea, speaking as a professional electrical engineer.  For power supplies you should use a regulator like the LM317 or any of a wide number of LDO or DC-DC switching regulators to convert 5V to a stable 3.3V level, not just a couple diodes.  For logic signals I would suggest using something like a 3.3kohm series resistor followed by the anode of a signal diode like 1N914 / 1N4148 whose cathode is connected to the 3.3V positive power supply if you are not going to use a logic level conversion chip.  Many cases exist where the series diodes will still allow the output side voltage to climb too high and maybe damage the 5V intolerant 3.3V nominal circuitry unless the 3.3V circuitry has a consistently high current draw so that enough voltage will always drop across the series diodes to cause them to have the correct voltage drop.

Thanks in advance!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Jan 03, 2013, 04:19 pm

Busy pin is not always detected when using synchronous playback (playVoice), so add a delay of 50 ms before the detection of busyPin.
Add delay(50) in the line 42 of Wtv020sd16p.cpp

Good Luck!

I think that could solve the problem, but according to the manual, only 20 ms will do the job. I will test it and add that to the library, so nobody have to add code.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Jan 03, 2013, 04:19 pm

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!!!

You can't. It is hardwired on those modules.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: marklawrence on Jan 06, 2013, 07:55 am
SIR I JUST WANT TO ASK THE CONNECTIONS OF PINS OF THE WTV020 TO THE ARDUINO OF YOUR SAMPLE PROGRAM..

AND THE CONNECTIONS OF THE SPEAKER IN WTV020 MODULE OF YOUR SAMPLE PROGRAM.. THANKS...

SCHEMATICS SIR PLEASE.. :smiley-eek:
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Jan 06, 2013, 02:50 pm
1st page second post shows how to hook up the module.  ;)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: marklawrence on Jan 06, 2013, 04:01 pm
MAY I ASK SIR WHAT SHOULD I DO FOR THE P02,P03 AND P07 CONNECTIONS?

MY CIRCUIT DONT WORK.. AND THERE SEEMS TO HAVE AN ERROR IN THE PROGRAM? THANKS!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Jan 09, 2013, 12:40 am
For the pins you mention:
1. You can hook them up to buttons like the schematic shows, for manual control of tracks.
2. You can leave them disconnected and unused (maybe use 0.1uf ceramic cap to grnd).

As for the program you are using and what you are trying to accomplish, you must post that if you want help with it.

And please stop SHOUTING.   ;)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Balisto on Jan 10, 2013, 12:55 pm
i cant get my own soundfiles to work with this module.
Can anyone tell me the exact settings to convert an mp3 into an ad4 file?
Must the mp3 mono? Which sampletype? Bitrate and so on must the source mp3 or wav??
the original sample files works fine!!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roan861 on Jan 14, 2013, 12:58 pm
Hey.
I can't download library in this topic.
Link isn't working:
"Error 503 Service Unavailable"
Where can i download this Library?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ericspags on Jan 14, 2013, 08:37 pm
I'm having the same issue, can anyone that has it re-upload the library?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Jan 15, 2013, 05:18 pm
Will re-upload the library this night from home.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roan861 on Jan 19, 2013, 12:21 pm
And what about re-upload?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Jan 19, 2013, 03:11 pm
Edited fist post. Hope this helps.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ericspags on Jan 19, 2013, 10:38 pm
Unfortunately I still cannot access the library, clicking the link still pulls up the same error page.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Jan 30, 2013, 07:59 pm
Hi Rebel, (and all the readers aswell...  ;) )

I downloaded right now the library and when unpacked I see TWO identical files.

One of them named: Wtv020sd16p.cpp
Another one named: Wtv020sd16p.cpp~
Both them 2183bytes.

Is that correct??

Gracias,
Rafa.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: purgedsoul on Feb 01, 2013, 05:52 am
I think it's okay, the Wtv020sd16p.cpp~ might just be a temporary file that was not deleted.

Thanks to Rebel for the Library! I got it to work on my module, after trying several SD-Cards. Talk about this thing is picky with SD-Cards.

Does anyone have any idea on how to interrupt the currently playing voice, and play another one when a button is pressed?

I tried modifying rebels playVoice function into:

Code: [Select]

void Wtv020sd16p::playSound(int voiceNumber){ 
if (_busyPinState==HIGH) {
  sendCommand(STOP);
}
else {
sendCommand(voiceNumber);
}
  _busyPinState=digitalRead(_busyPin);
  while(_busyPinState==HIGH){
    _busyPinState=digitalRead(_busyPin);
}
}


it checks for the busy pin's state, if it is HIGH, send the STOP command, and then play the voice.

Unfortunately it does not work. Or i'm just not doing it right.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 01, 2013, 06:46 pm
Why not use .stopVoice method?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 01, 2013, 06:48 pm
For those wondering how this audio module works with music, here you have an example:

http://www.youtube.com/watch?v=_RGRAhex7Zs

By the way, everything is now working with 3.3v. I just bought a new Mini Pro working at 8Mhz 3.3V, downloaded the same program I did for the previous Arduino and tada, worked out like a charm.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xl97 on Feb 01, 2013, 10:59 pm
nice job!..

the only difference should be the audio files you use now.. (making sure it for a 8MHz instead of 16Mhz)  :)

now you just gotta merge everything together (Arduino, Amp, SD card) into one awesome, tiny board!!!  :)

this is gonna go great for the "V" project. :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 02, 2013, 12:30 am
As a matter of fact, audio files are the same rate. There's no need in change them.
And yes, if will be a great project for the v community
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xl97 on Feb 02, 2013, 02:26 am
no need to change them? and they play same 'rate/speed'?   awesome!..

glad things finally came together..

good luck!.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: purgedsoul on Feb 02, 2013, 06:56 am

Why not use .stopVoice method?


Thank you for the reply.

I tried that too.

Even tried using pin change interrupts, thought maybe it just the delay in reading the digitalRead status for the pins.

Basically, what I wanted to achieve, is that whenever a button is pressed, it will interrupt the currently playing sound clip and play the sound clip associated with the button that was pressed (Even if it was the same button).

Here's the code I'm using:
I'm using the pinchangeint library.

Code: [Select]

/*
Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>
#include <PinChangeInt.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

#define BUTTON01  7
#define BUTTON02  8

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void playSound01(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(0);
}

void playSound02(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(1);

void setup() {
  //Initializes the module.

  pinMode(BUTTON01, INPUT);
  digitalWrite(BUTTON01, HIGH);
  PCintPort::attachInterrupt(BUTTON01, &playSound01, RISING);
 
  pinMode(BUTTON02, INPUT);
  digitalWrite(BUTTON02, HIGH);
  PCintPort::attachInterrupt(BUTTON02, &playSound02, RISING);
 
  wtv020sd16p.reset();
}

void loop() {

}
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 02, 2013, 04:02 pm

no need to change them? and they play same 'rate/speed'?   awesome!..

glad things finally came together..

good luck!.

There is no need cause the Arduino is not managing WTV clock. Only clock provided from Arduino is to control the commands you send to it.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 02, 2013, 04:04 pm


Why not use .stopVoice method?


Thank you for the reply.

I tried that too.

Even tried using pin change interrupts, thought maybe it just the delay in reading the digitalRead status for the pins.

Basically, what I wanted to achieve, is that whenever a button is pressed, it will interrupt the currently playing sound clip and play the sound clip associated with the button that was pressed (Even if it was the same button).

Here's the code I'm using:
I'm using the pinchangeint library.

Code: [Select]

/*
Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>
#include <PinChangeInt.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

#define BUTTON01  7
#define BUTTON02  8

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void playSound01(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(0);
}

void playSound02(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(1);

void setup() {
  //Initializes the module.

  pinMode(BUTTON01, INPUT);
  digitalWrite(BUTTON01, HIGH);
  PCintPort::attachInterrupt(BUTTON01, &playSound01, RISING);
 
  pinMode(BUTTON02, INPUT);
  digitalWrite(BUTTON02, HIGH);
  PCintPort::attachInterrupt(BUTTON02, &playSound02, RISING);
 
  wtv020sd16p.reset();
}

void loop() {

}


Weird, cause If you check my previous video, that's what I am doing. Music is playing, I hit the trigger and plays a new sound. Even the fire selector plays it own sound. It should be there something wrong in the source code, not in the module.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: purgedsoul on Feb 03, 2013, 01:23 am
can you post the code you used on the previous video? So i can try it on my board. I don't want to rule out another SD-Card problem, cause I have already tried several cards, before I got it to make a sound.   :0 this thing is pesky with sd-cards. =(

Also, I tried playing a voice and have it loop, well, it can't do gapless loop.

@xl97: your board looks good, do you sell them cause I'm interested.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 03, 2013, 03:12 am
Shared it on gallery section. Look for v laser gun.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: purgedsoul on Feb 03, 2013, 03:28 am
Thanks! Got it.  XD This should keep me busy.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: purgedsoul on Feb 03, 2013, 07:08 am
Well, it was definitely my code.

Anyone got ideas how to have this play a pseudo-gapless/seamless loop? Or this is just the limitation of this sound module.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 07, 2013, 10:46 pm
Module limitation. It is a 20ms delay.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roan861 on Feb 10, 2013, 05:49 am
My module (v1.5) plays sounds only about 0.25sec from each file.
I have used library from this post (synch and asynch playing). SD card is 64MB FAT16.
I have downloaded ad4 and wav-files from this topic. http://arduino.cc/forum/index.php?topic=110924.0 (http://arduino.cc/forum/index.php?topic=110924.0)
Help me.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: DerekD on Feb 11, 2013, 04:21 am
I had a similar problem with it only playing the first blip of the file.  Here's what worked for me.
First, I had to use asyncPlayVoice, then add a delay equal or longer to the length of the file being played.  This keeps the busy led on while the file is playing.  I don't think I ever got PlayVoice to work, and it wouldn't play a file named 0000, the first one it would play was 0001.

My test program only played one file repeatedly, the delay just kept the loop from repeating and interrupting and restarting playing the file.  I think I'll add a millis reading like the blink without delay example so the delay does not stop the program from running anything else waiting for the file to finish playing.  This might get messy if there are a lot of files with different lengths.  Unfortunately, I just fried my module tonight by absentmindedly hooking it up to 5V!  Time to order a few more.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 11, 2013, 04:11 pm

My module (v1.5) plays sounds only about 0.25sec from each file.
I have used library from this post (synch and asynch playing). SD card is 64MB FAT16.
I have downloaded ad4 and wav-files from this topic. http://arduino.cc/forum/index.php?topic=110924.0 (http://arduino.cc/forum/index.php?topic=110924.0)
Help me.

It seems to me that your sd card is not supported
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Feb 11, 2013, 04:12 pm

I had a similar problem with it only playing the first blip of the file.  Here's what worked for me.
First, I had to use asyncPlayVoice, then add a delay equal or longer to the length of the file being played.  This keeps the busy led on while the file is playing.  I don't think I ever got PlayVoice to work, and it wouldn't play a file named 0000, the first one it would play was 0001.

My test program only played one file repeatedly, the delay just kept the loop from repeating and interrupting and restarting playing the file.  I think I'll add a millis reading like the blink without delay example so the delay does not stop the program from running anything else waiting for the file to finish playing.  This might get messy if there are a lot of files with different lengths.  Unfortunately, I just fried my module tonight by absentmindedly hooking it up to 5V!  Time to order a few more.

Syncplay usually works better with long audio files.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GaryY on Feb 16, 2013, 08:42 pm
For easy testing , load the microSD with sample .AD4 files provided in other links. Make sure to format the uSD to 16bit .  Power WTV020 pin 16 & 8.   I would just touch pin 9 or pin 13 to ground for playing the file. Touch pin 1 to reset the chip. The audio output is very low power. I used a speaker from a cell phone to pins 4 & 5 and held it really close to my ear to hear it. Once you get some confidence the sound files are working, you can add a LM386 amplifier, or I bought a 12V 15W amp module on ebay for $6.  After that can build on more controls functions. I also found the WTV020 cant really do MP3 mode unless you specifically buy it that way. Strangely I can force the WTV020 to operate like MP3 mode by interfacing with TTL gates or dry relay contact for a trigger. Using optocouplers or soliud state relays just didnt cut the cheese.
http://arduino.cc/forum/index.php/topic,115411.0.html  more info here
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sopejonan on Feb 19, 2013, 09:14 am
Hello:

I've been playing with rhe sound module i bouught in sparkfun. I've allready been able to make it work with a 2gb sd. As i use an arduino UNO i atached two serial diodes between the arduino and the module. I firstly conected the way i tough i was the correct one but it didn't work.
I made a test making it work as an mp3 and seen that it played sounds i conected the cables "upsidedown". the diagram i'm now using is the one seen in the image. I wanted to ask if this is normal as until what i know the diodes are not in the correct way like this...but is the way it works...if someone has an explanation...

(http://img687.imageshack.us/img687/3296/diagramau.jpg)

thanks a lot!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ntmcguff on Feb 22, 2013, 09:30 pm
You do not use the diodes in the signal lines from the arduino to the RST/Din/Dclk lines. You need them in the vcc+ to the sound module to reduce the voltage to 3.3 vdc.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sopejonan on Feb 25, 2013, 10:20 am
Even not needing them for the signals i don't think it is a good idea to use 5v signals for a 3.3V working peripheral no? I'm not sure of it as the datasheet of this chip is the worst i've ever seen...there is a lot of information missing there.

Although not needing the diodes for signal i've use the the way shown in the image i posted...and i can't understand the reason for them to work with that polarization...if someone could explain the reason i'll be very pleased

thanks a lot!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ntmcguff on Feb 25, 2013, 10:06 pm
Here is my example of a Star Wars Blaster with 8 RGB LEDs, 3 74HC595 shift registers and the WTV020-SD-16P sound card. The sound files are from onesky.

74HC595 shift registers wiring: http://www.arduino.cc/en/Tutorial/ShiftOut (http://www.arduino.cc/en/Tutorial/ShiftOut)

http://www.youtube.com/watch?v=CinD3UZLXz0

Code: [Select]

//  Name    : Blaster4                                          //
//  Author  : Norman McGuffey                                   //
//  Date    : 16 Feb 2013                                       //
//  Version : 1.0                                               //
//  Notes   : Code for using 3 74HC595 Shift Registers with     //
//          : 8 - 5mm Superbright CC RGB LEDs on E-11 Blaster   //
//          : Sound using WTV020-SD-16P microSD audio module    //

int resetPin2 = 2;  // Pin D2 connected to WTV20 /Reset (Pin 1)
int clockPin2 = 3;  // Pin D3 connected to WTV20 P04 (clock)(Pin 7)
int dataPin2 = 4;   // Pin D4 connected to WTV20 P05 (data)(Pin 10)
int button1Pin = 6; // Pin D6 connected to Trigger Switch
int button2Pin = 7; // Pin D7 connected to Select Switch
int latchPin = 8;   // Pin D8 connected to ST_CP (PIN 12)of 74HC595
int dataPin = 11;   // Pin D11 connected to DS (PIN 14) of 74HC595
int clockPin = 12;  // Pin D12 connected to SH_CP (PIN 11)of 74HC595
int LEDPin = 13;    // Pin D13 connected to LED
int button1State = 0;
int button2State = 0;
int button2Count = 1;

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

byte dataRED;
byte dataGREEN;
byte dataBLUE;
int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
int dataArrayBLUE[] = {0,0,0,0,0,0,4,32,0};


void setup() {
 pinMode(clockPin2, OUTPUT);
 pinMode(dataPin2, OUTPUT);
 pinMode(resetPin2, OUTPUT);
 pinMode(LEDPin, OUTPUT);
 
 digitalWrite(clockPin2, HIGH);
 digitalWrite(dataPin2, LOW);

 pinMode(latchPin, OUTPUT);
 pinMode(button1Pin, INPUT);
 pinMode(button2Pin, INPUT);
 
 digitalWrite(resetPin2, HIGH);
 delay(100);
 digitalWrite(resetPin2, LOW);
 delay(10);
 digitalWrite(resetPin2, HIGH);
 delay(100);
 delay(500);
 sendCommand(0xFFF6);

 digitalWrite(LEDPin, HIGH);
 delay(50);
 digitalWrite(LEDPin, LOW);
 
 Serial.begin(9600);

}

void loop() {

 button2State = digitalRead(button2Pin);
 if (button2State == HIGH) {
   sendCommand(0x000);
   button2Count = button2Count +1;
   if (button2Count > 5) {
     button2Count = 1;
   }
   for (int x=0; x < button2Count; x++){
      digitalWrite(LEDPin, HIGH);
      delay(100);
      digitalWrite(LEDPin, LOW);
      delay(200);
   }
   delay(500);
   }
 
 button1State = digitalRead(button1Pin);
 
 if (button1State == HIGH) {    
  switch (button2Count) {
  case 1:
     { // Color = Red
     sendCommand(0x001);
     int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
     int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
     int dataArrayBLUE[] = {32,32,32,32,32,32,36,32,0};
     for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(60);}
      break;}
 case 2:
      { // Color = Blue
      sendCommand(0x002);
      int dataArrayRED[] = {4,32,0,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,1,8,64,0,0,0,0};
      int dataArrayBLUE[] = {128,128,128,128,128,130,144,128,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(100);}
      break;}
   case 3:
      { // Color = Green
      sendCommand(0x003);
      int dataArrayRED[] = {2,16,128,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,4,32,0,0,0,0};
      int dataArrayBLUE[] = {64,64,64,64,64,65,72,64,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(90);}
      break;}
   case 4:
      { // Color = Purple
      sendCommand(0x004);
      int dataArrayRED[] = {5,40,64,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,1,10,80,128,0,0,0};
      int dataArrayBLUE[] = {160,160,160,160,160,162,180,160,0};
        for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(90);}
      break;}
   case 5:
      { // Color = Orange
      sendCommand(0x005);
      int dataArrayRED[] = {3,24,192,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,6,48,128,0,0,0};
      int dataArrayBLUE[] = {96,96,96,96,96,97,108,96,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(75);}
      break;}
  }
 }
}

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {

 int i=0;
 int pinState;
 pinMode(myClockPin, OUTPUT);
 pinMode(myDataPin, OUTPUT);

 digitalWrite(myDataPin, 0);
 digitalWrite(myClockPin, 0);
 
 for (i=7; i>=0; i--)  {
   digitalWrite(myClockPin, 0);
   
   if ( myDataOut & (1<<i) ) {
     pinState= 1;
   }
   else {
     pinState= 0;
   }
   digitalWrite(myDataPin, pinState);
   digitalWrite(myClockPin, 1);
   digitalWrite(myDataPin, 0);
 }
   digitalWrite(myClockPin, 0);
}

void blinkAll_3Bytes(int n, int d) {
 digitalWrite(latchPin, 0);
 shiftOut(dataPin, clockPin, 0);
 shiftOut(dataPin, clockPin, 0);
 digitalWrite(latchPin, 1);
 delay(200);
 for (int x = 0; x < n; x++) {
   digitalWrite(latchPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 1);
   digitalWrite(latchPin, 1);
   delay(50);
   digitalWrite(latchPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   digitalWrite(latchPin, 1);
   delay(200);
 }
}
void sendCommand(int addr)
{
 digitalWrite(clockPin2, LOW);
 delay(2);
 for (int i=15; i>=0; i--)
 {
   delayMicroseconds(200);
   if((addr>>i)&0x0001 >0)
     {
       digitalWrite(dataPin2, HIGH);
      }
   else
      {
        digitalWrite(dataPin2, LOW);
      }
   delayMicroseconds(200);
   digitalWrite(clockPin2, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(dataPin2, LOW);
   else
   digitalWrite(dataPin2, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(clockPin2, LOW);
   else
   digitalWrite(clockPin2, HIGH);
 }
 delay(30);
}
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Waytronic-Jasmine on Feb 28, 2013, 04:12 am

Hi the-rebel-agent,

Hats off for sharing your experience :)

I am going to play with the same module but decided to ask and get the pin diagram confirmed. I found the following application circuit for this device.

(http://i303.photobucket.com/albums/nn135/chathusrilanka/Arduino%20Forum/Schematic.jpg)

I believe the following is the way of identifying the pins. Can you please confirm? :)

(http://i303.photobucket.com/albums/nn135/chathusrilanka/Arduino%20Forum/PinConfig.jpg)

/Chathuranga



Yes, the way of identifying the pins is right----waytronic -Jasmine. Manufacturer of WTV020-SD module
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Waytronic-Jasmine on Feb 28, 2013, 07:35 am

Nice Stuff :)

I will add my findings etc when I continue with my experiments. I am about to start :)

The Datasheet says the maximum supported size of the Card is 1GB. Is that so or could you be able to use a card with higher capacity? I cannot imagine a reason of limiting the size at 1 GB because generally the address spaces are larger than that..  :~


acctually it can support 2 GB,we have tested 2GB TF card,same use with 1GB TF card.some times manual will have something wrong,and we will revise them when we discover them.and welcome every one to help us point out them.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Waytronic-Jasmine on Feb 28, 2013, 07:36 am

I  just got from China a board : V1.5 / 2012.01.12", and "5v  / 3.3v

The only successfully way to format my Nokia mirco SD 512 MB
was win / cmd(Admin) / diskpart .
( http://www.chip.de/bildergalerie/Windows-To-Go-So-laeuft-Windows-8-auf-USB-Sticks-und-Festplatten-Galerie_54926063.html (http://www.chip.de/bildergalerie/Windows-To-Go-So-laeuft-Windows-8-auf-USB-Sticks-und-Festplatten-Galerie_54926063.html))

Up to now I run the board stand alone.
OK Files:
- 000X.ad4
- 000x.wav   freq 12.000 Mono and -1dB

It is possible to run MP3 im stand alone modus ?


WTV020-SD module only can play WAV and AD4 file
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Waytronic-Jasmine on Feb 28, 2013, 07:49 am

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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Waytronic-Jasmine on Feb 28, 2013, 08:05 am

I've been working with a Somo-14D recently on a lightsaber project.  I got it generally working until I realized that it couldn't do gapless playback.  The gap was very small, but very noticeable when going from a swing directly into a hum.

Do you know if this module can do gapless playback?  I know the two units are similar, I just don't know how similar.

Thanks!


yes,it is same.it use same main control chip( WTV020 chip) and same program.

about gapless playback,WTV020-SD 16P can not do that,SD card response need some time,and main control can not do so fast communicate with SD card.

How long does your sound,maybe you can try SPI flash solution,it will response faster than SD card.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Mar 04, 2013, 07:39 pm

Shared it on gallery section. Look for v laser gun.


Sorry for this silly question.... but,   I'm unable to find the files.

Any ideas where have they gone ??

Gracias,
Rafa.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Mar 04, 2013, 09:05 pm
http://arduino.cc/forum/index.php/topic,110328.msg1113991.html#msg1113991
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Mar 05, 2013, 05:11 pm
Got them... Thanks Sir!.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Mar 05, 2013, 05:23 pm
For the experiences I've read about this module....
Could it be possible to Sumarize your experiences and configuration??
(I'm getting frustrated because of wrong SDs -I've already checked 4-)

Jumper : 3.3 or 5 v
SD: Brand, Size, Format...
AD4 files: Speed, Rate, etc...


I think this will be a really usefull way to help new users for this module to be sucessful on their attemps.

NOTE:
And... Why not have that information populated under its own topic. "Audio players", "WTV020-SD-16P"
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ntmcguff on Mar 05, 2013, 05:59 pm
EA3BIL,

I am running my WTV020-SD-16P at 3.3 vdc powered from the arduino 5vdc with with 2 diodes to drop the voltage to 3.3 vdc on the vcc+ line.

I am using a Sandisk 1gb MicroSD card formatted to FAT16. You can go up to a 2gb card.

The speed and rate of the A4D files are listed in the earlier posts.

All the information you need should be contained in this series of posts. Go back to the first post and start reading. This is how I got mine to work.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: onesky on Mar 05, 2013, 09:04 pm

Here is my example of a Star Wars Blaster with 8 RGB LEDs, 3 74HC595 shift registers and the WTV020-SD-16P sound card. The sound files are from onesky.

74HC595 shift registers wiring: http://www.arduino.cc/en/Tutorial/ShiftOut (http://www.arduino.cc/en/Tutorial/ShiftOut)

http://www.youtube.com/watch?v=CinD3UZLXz0

Code: [Select]

//  Name    : Blaster4                                          //
//  Author  : Norman McGuffey                                   //
//  Date    : 16 Feb 2013                                       //
//  Version : 1.0                                               //
//  Notes   : Code for using 3 74HC595 Shift Registers with     //
//          : 8 - 5mm Superbright CC RGB LEDs on E-11 Blaster   //
//          : Sound using WTV020-SD-16P microSD audio module    //

int resetPin2 = 2;  // Pin D2 connected to WTV20 /Reset (Pin 1)
int clockPin2 = 3;  // Pin D3 connected to WTV20 P04 (clock)(Pin 7)
int dataPin2 = 4;   // Pin D4 connected to WTV20 P05 (data)(Pin 10)
int button1Pin = 6; // Pin D6 connected to Trigger Switch
int button2Pin = 7; // Pin D7 connected to Select Switch
int latchPin = 8;   // Pin D8 connected to ST_CP (PIN 12)of 74HC595
int dataPin = 11;   // Pin D11 connected to DS (PIN 14) of 74HC595
int clockPin = 12;  // Pin D12 connected to SH_CP (PIN 11)of 74HC595
int LEDPin = 13;    // Pin D13 connected to LED
int button1State = 0;
int button2State = 0;
int button2Count = 1;

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

byte dataRED;
byte dataGREEN;
byte dataBLUE;
int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
int dataArrayBLUE[] = {0,0,0,0,0,0,4,32,0};


void setup() {
 pinMode(clockPin2, OUTPUT);
 pinMode(dataPin2, OUTPUT);
 pinMode(resetPin2, OUTPUT);
 pinMode(LEDPin, OUTPUT);
 
 digitalWrite(clockPin2, HIGH);
 digitalWrite(dataPin2, LOW);

 pinMode(latchPin, OUTPUT);
 pinMode(button1Pin, INPUT);
 pinMode(button2Pin, INPUT);
 
 digitalWrite(resetPin2, HIGH);
 delay(100);
 digitalWrite(resetPin2, LOW);
 delay(10);
 digitalWrite(resetPin2, HIGH);
 delay(100);
 delay(500);
 sendCommand(0xFFF6);

 digitalWrite(LEDPin, HIGH);
 delay(50);
 digitalWrite(LEDPin, LOW);
 
 Serial.begin(9600);

}

void loop() {

 button2State = digitalRead(button2Pin);
 if (button2State == HIGH) {
   sendCommand(0x000);
   button2Count = button2Count +1;
   if (button2Count > 5) {
     button2Count = 1;
   }
   for (int x=0; x < button2Count; x++){
      digitalWrite(LEDPin, HIGH);
      delay(100);
      digitalWrite(LEDPin, LOW);
      delay(200);
   }
   delay(500);
   }
 
 button1State = digitalRead(button1Pin);
 
 if (button1State == HIGH) {    
  switch (button2Count) {
  case 1:
     { // Color = Red
     sendCommand(0x001);
     int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
     int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
     int dataArrayBLUE[] = {32,32,32,32,32,32,36,32,0};
     for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(60);}
      break;}
 case 2:
      { // Color = Blue
      sendCommand(0x002);
      int dataArrayRED[] = {4,32,0,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,1,8,64,0,0,0,0};
      int dataArrayBLUE[] = {128,128,128,128,128,130,144,128,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(100);}
      break;}
   case 3:
      { // Color = Green
      sendCommand(0x003);
      int dataArrayRED[] = {2,16,128,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,4,32,0,0,0,0};
      int dataArrayBLUE[] = {64,64,64,64,64,65,72,64,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(90);}
      break;}
   case 4:
      { // Color = Purple
      sendCommand(0x004);
      int dataArrayRED[] = {5,40,64,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,1,10,80,128,0,0,0};
      int dataArrayBLUE[] = {160,160,160,160,160,162,180,160,0};
        for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(90);}
      break;}
   case 5:
      { // Color = Orange
      sendCommand(0x005);
      int dataArrayRED[] = {3,24,192,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,6,48,128,0,0,0};
      int dataArrayBLUE[] = {96,96,96,96,96,97,108,96,0};
      for (int j = 0; j < 9; j++) {
        dataRED = dataArrayRED[j];
        dataGREEN = dataArrayGREEN[j];
        dataBLUE = dataArrayBLUE[j];
        digitalWrite(latchPin, 0);
        shiftOut(dataPin, clockPin, dataBLUE);
        shiftOut(dataPin, clockPin, dataGREEN);  
        shiftOut(dataPin, clockPin, dataRED);
        digitalWrite(latchPin, 1);
        delay(75);}
      break;}
  }
 }
}

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {

 int i=0;
 int pinState;
 pinMode(myClockPin, OUTPUT);
 pinMode(myDataPin, OUTPUT);

 digitalWrite(myDataPin, 0);
 digitalWrite(myClockPin, 0);
 
 for (i=7; i>=0; i--)  {
   digitalWrite(myClockPin, 0);
   
   if ( myDataOut & (1<<i) ) {
     pinState= 1;
   }
   else {
     pinState= 0;
   }
   digitalWrite(myDataPin, pinState);
   digitalWrite(myClockPin, 1);
   digitalWrite(myDataPin, 0);
 }
   digitalWrite(myClockPin, 0);
}

void blinkAll_3Bytes(int n, int d) {
 digitalWrite(latchPin, 0);
 shiftOut(dataPin, clockPin, 0);
 shiftOut(dataPin, clockPin, 0);
 digitalWrite(latchPin, 1);
 delay(200);
 for (int x = 0; x < n; x++) {
   digitalWrite(latchPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 1);
   digitalWrite(latchPin, 1);
   delay(50);
   digitalWrite(latchPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   shiftOut(dataPin, clockPin, 0);
   digitalWrite(latchPin, 1);
   delay(200);
 }
}
void sendCommand(int addr)
{
 digitalWrite(clockPin2, LOW);
 delay(2);
 for (int i=15; i>=0; i--)
 {
   delayMicroseconds(200);
   if((addr>>i)&0x0001 >0)
     {
       digitalWrite(dataPin2, HIGH);
      }
   else
      {
        digitalWrite(dataPin2, LOW);
      }
   delayMicroseconds(200);
   digitalWrite(clockPin2, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(dataPin2, LOW);
   else
   digitalWrite(dataPin2, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(clockPin2, LOW);
   else
   digitalWrite(clockPin2, HIGH);
 }
 delay(30);
}



very well!
did you post your video in whitearmor forum too?
http://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/page__st__120
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ntmcguff on Mar 05, 2013, 10:10 pm
onesky,

I posted on whitearmour forum in a new topic here:
http://www.whitearmor.net/forum/topic/23198-another-arduind-e-11-blaster-setup/
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Mar 11, 2013, 05:32 pm
Sorry I originally wrote in Spanish  ( Maybe it was because of frustration  =(  )

In English now...

I'm so sorry to tell you about none of two modules is working at all.   =(

I used THREE completelly NEW SD Kingston cards I got from:
(  http://www.ebay.es/itm/221194347559?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649 )

Also a 1Gb Sandisk SD SanDisk from:
( http://www.ebay.es/itm/160983521327?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649  )

On the TWO modules I got from:
( http://www.ebay.es/itm/150916490980?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649  )
(v.1.5 powered 3.3v from Arduino Leonardo power output).

...and nothing on the speaker, not even a single click.

I think I'll move my project to a different device (maybe the one from SparkFun).
Current ones make me feel NO confidence on them at all.

NOTE:
The TWO modules, Kingston and Sandisk SDs are available to you for running tests, just let me know...


Ciao,
Rafa.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Mar 19, 2013, 11:15 pm
..and then there are two of us.

I also got two modules.  Tried 5 different 1GB/2GB cards. Tried both 3.3 and 5V.
Cards formatted FAT16 with SD's utilitie (and others)
Example-files copied one by one.. and in 'bulk'. Tried renaming files to 0.ad4 .. 00.ad4  and 000.ad4 - NOTHING!
Verified with osc.scope that timing for reset , clk and dta is exactly according to datasheet.
NO sound - (not even a tiny litte 'pip')

--busy-line show some kind of life as it  drops for a while  after sending commands.

... Time to trash this shit ? or is there a "magic" SD-card out there?

I had better luck to make a player with shiftregister 74xx595 and a R2R net.
This plays 8bits PCM files at speeds ut to 16Ksamples/sec. (interruptdriven)
Audacity converts to my req. format without a problem.

knut, Narvik, Norway

EDIT 29.3.
I am waiting for new memory cards 128K and 256K.
(since they are not to be found in Norway, they will cross the globe..)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Mar 21, 2013, 02:43 am
And again, this module is VERY PESKY about the uSD card that reads. I tried a lot of them until got one that did work.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ntmcguff on Mar 21, 2013, 05:33 pm
EA3BIL and knut_ny,

Have you tried the module as a stand alone and not connected to the arduino?

The module only likes SanDisk MicroSD cards. It is a little tricky getting the microSD card into the slot properly. You have to open up the card slot and place it into position. You can not just slide it in from the end.

Mine was not working with the arduino and I tried it in stand alone and got it to work. Reference wiring diagram in the previous posts. I then was successful in getting it to work with the arduino.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: EA3BIL on Mar 27, 2013, 04:57 pm
ntmcguff,

I noticed about how tricky is to get the card correctly positioned on it...

Yes I did try to run it on StandAlone mode (aka mp3 player), same results, no sound at all (remember two modules tested, etc...)

I finally made the decision and moved to SparkFun WTV020-SD module.
(at least this one works on StandAlone mode with ALL sd's)...


I'll keep you all up-to-date about the results on using Rebel's library with it.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fabian089 on Mar 31, 2013, 10:07 pm
hello guys

first post for me...

ive been trying to get the module working for some time today... and finally got it making sounds.
thx for all the information in this post, was very helpful!

except for the issue ive faced! Everything was hooked up correctly, formatted the sd-card (SanDisk 64mb) in fat16.. etc..

But nothing happened..  I only noticed that the busyPin-LED was glowing all the time... first i thought this might be normal, but it is not!
Even if it did react to buttons ive pressed or code changes iv made! But at that point of trying i didnt know that it aint normal, so i started looking for the problem:
   - formated the SD-card x-times
   - soldered the jumper to 5v tested, and then again back to 3.3v
   - destroyed a in ear headphone to get the speaker
   - took differend .ad4 files
   - hooked everthing up again
   - used different code snippets
   - readed every post ive found
   -....

As a last desperated try i was just pressing slighty against the bottom side(between pin 8 and 9) of the sd-card, while it was mounted into the slot.
AND, some reaction, the busyPin-LED was turning off.. as i pressed some buttons i noticed sounds...!
Finally it worked for me.. :)

So my conclusion is, that the SD-card might not have decent contact to the module, even if it looks fitted!

Hopefully this might help someone... like your posts helped me!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: rulicos on Apr 09, 2013, 12:31 am
Necesito una ayuda, he visto que el creador de la libreria es argentino asi que lo escribire en español para explicarme mejor y luego lo intentare traducir.

Compre este modulo:

http://www.ebay.co.uk/itm/310629013078?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
http://letsmakerobots.com/files/WTV020_manual_V1.3.pdf

Doy por hecho que es el mismo que usan todos ustedes. Estoy intentando conectarlo de manera aislada (el punto 8.8 del datasheet)solo vcc, gnd, el led de estado, reset  ,play/stop y el altavoz.
Cuando arranca parpadea el led y se mantiene encendido, el reset parece que funciona pero cuando le doy al play se escucha como ruido y se apaga el led, y un 1-2 seg mas tarde deja de sonar y se enciende el led. Se que el modulo es muy especial con las sd, he probado 4: una kingston y una scandisk de 2gb, una de 256mb y una de 4 gb tracens y con cada unos de se escucha un tipo de ruido diferente. He probado con varios altavoces y buzers, los grandes son de 8 ohmnios y 3w y 1w respectivamente.
Tambien he probado con diferentes audios, algunos ejemplos que habeis puesto aqui y otros de youtube

Otra cosa que necesito que me expliquies que es eso de los modos que viene en el datasheet. Parecen distintas formas de conectarlo pero no entiendo como el boton play/stop puede estar en diferentes pines en cada modo y sin que haya que configurarlo con algun jumper.

In english:

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
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: samar_mohammed on Apr 10, 2013, 08:26 am
hi
thanx 4 adding this library it seems that it is going to help us sooo much in our project  XD
but i need to learn more and understand more things about this library
i bought this https://www.sparkfun.com/products/11125 (https://www.sparkfun.com/products/11125)
i need to control playing the content of the sd card using arduino
for example play song 1 when some action happens or song 2 when other action happens
could u help me ^___^
i will be sooo thankful :)  :smiley-red:
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jlpniewski on May 04, 2013, 10:29 pm
Hi,
I may be being thick here but can anybody send me a download link for this library.

Thanks :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: perhof on May 04, 2013, 10:52 pm
It's attached to the first post on the first page of this thread.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fungus on May 05, 2013, 01:16 pm

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:

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dc_ou on May 12, 2013, 05:24 am
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
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on May 14, 2013, 05:55 am

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!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on May 14, 2013, 07:27 am


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":
http://www.ebay.com/itm/U-disk-audio-player-SD-card-voice-module-MP3-Sound-module-WTV020-SD-16P-Arduino/310629013078?_trksid=p2045573.m2042&_trkparms=aid%3D111000%26algo%3DREC.CURRENT%26ao%3D1%26asc%3D27%26meid%3D7644561902605214505%26pid%3D100033%26prg%3D1011%26rk%3D2%26sd%3D271024886800%26

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?


Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Kehkashan on Jun 02, 2013, 01:50 pm
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Nixoid on Jun 08, 2013, 06:24 am
http://youtu.be/lv_ZVD8ahcc
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Kehkashan on Jun 08, 2013, 08:59 pm
Kindly explain in English. I don't understand the language
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jun 12, 2013, 02:28 pm
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ScottG on Jun 14, 2013, 02:54 pm
I've got the Sparkfun breakout board (http://www.sparkfun.com/products/11125) 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 (http://www.sparkfun.com/products/11125) from a Sparkfun user in the breakout board comments, but neither helped.  Here's my sketch:

Code: [Select]

#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
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: marco_c on Jun 15, 2013, 07:59 am
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).

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: edryan on Jun 15, 2013, 08:30 pm
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?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Arkestra on Jun 30, 2013, 06:52 pm
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!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Arkestra on Jul 01, 2013, 03:47 pm
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Jul 01, 2013, 04:59 pm
Faster card might drain more current but only if you run it faster.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Arkestra on Jul 02, 2013, 11:43 pm
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 02, 2013, 11:53 pm
I have a Samsung 1Gb and it works fine. I bought a 5 pack on eBay, just in case the card stops working.
Title: Re: Arduino library for WTV020-SD-20SS, Library for 16p is not working
Post by: neelarnab on Jul 22, 2013, 10:51 am
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
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jmknapp on Jul 23, 2013, 02:55 pm
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
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 23, 2013, 05:45 pm
Quote
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.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jmknapp on Jul 29, 2013, 04:08 pm

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.


Thanks. Didn't help unfortunately--I still get very choppy volume when trying to modify the volume. Here's scope trace of what's supposed to be a constant 440 Hz tone, after a call to volume(3):

(http://i187.photobucket.com/albums/x269/jmknapp/wtvvol_zpsafb6648c.jpg)

Turns out that it only happens with 32 Kb/s ADPCM files (created by the UsbRecorder v1.3 tool). Setting the volume with 24 Kb/s or lower sampling rate files works fine, even though 32 KB/s file play fine at full volume. Weird. Anyway, the solution is to use 24 Kb/s max.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ovaltineo on Aug 30, 2013, 12:58 am
I'm a bit confused with the busy light. According to the specs, the busy pin goes low when the module is playing a voice.  Since one pin of the busy light is tied to Vcc, the light should turn on when playing a voice. So, how come the library is checking for a HIGH?  Also, it has been posted that the light turns off when playing a voice.  So is the specification document wrong, ie busy pin goes high when playing a voice? I'm still waiting for a Sandisk card coz mine doesn't work.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ScottG on Aug 30, 2013, 01:03 am
The busy pin goes high when sound is playing.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ovaltineo on Aug 30, 2013, 11:55 pm
Thanks - whoever wrote that specification document should be shot.  Anyway, I feel stupid because my micro SD card was working all along.  Problem was that I was simply sliding the card into the slot - like what you do with the big SD cards and some micro slots with press-to-eject. Turns out I have to open the latch, put the card in, then close and lock the latch  :smiley-red:.  So now I have 2 Sandisk cards coming which I don't need.  I might have to buy 2 more modules so I can use them  :smiley-mr-green:.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Aug 31, 2013, 01:44 am
That's silly. SD cards are as good as flash drives for storing backup PC files. They take less space and many of the full size ones have a write-protect tab which I have yet to see on a USB flash stick.

They're removable media, the new paper. I have AVI movies on some.

Especially micro-SD, you can get cheap USB adapters for those. Otherwise you need a media reader. They go great in phones to cameras to MP3 players to whatever if you get the right size, I even had a camera and MP3 player that took full size SD cards.

Get the micro-SD's with full-size adapters and you can turn an adapter into an SD reader for Arduino by soldering right to the tabs. Hardest part is the 5V to 3.3V leveling which you can get plenty of help with right here and learn maybe 3 or 4 ways to do that cheap!


Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fgmarshall on Sep 02, 2013, 10:01 pm
New to this - but I seem to be progressing.

1) You need >3.5V for the module from a source that can give 100mA while it talks without dropping out.
2) WAV files play OK. I have a set of numbers that are very clear, others seem distorted. Will work on that.
3) NB! as delivered 2 of the pins were dry solder jointed to the card!!!!! - Scratch off the paint round the pin and resolder.
4) An old Sandisk 2GB worked for a while off the Arduino 3V - today it stopped.
5) New identical Sandisks also failed on the Arduino supply - but all OK now on the beefy supply
6) Kingston 2GB failed on any power supply
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fgmarshall on Sep 03, 2013, 09:33 pm
Further to my last post.

I tried to use an emitter follower transistor power supply but it was not steady enough.

I now use an LM350 variable supply with 6.5 volts in and 3.55 volts out.
Google the data sheet - I have 120 ohms across the 1/2 pins and 227 ohms from pin 1 to earth (on a 350 ohm variable potentiometer).
On a 'scope it is rock solid 3.55 volts. At a bit below 3.4 volts it stops talking.

I record WAV files in Audacity on my Mac and the signal is up to 0.7 on the scale.
I need numbers - you can speak several then "record selection as wav" to cut them out one  by one.

Why bother with .ad4 files and the Somo tool?

Many thanks to all who got us this far!

NB! you have to slide back then flip open the lid on the micro SD card holder - you can't just push the card in like on most holders.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Sep 04, 2013, 01:20 am
You can run 5V through 2 diodes to get 3.6V. If the 5V drops a bit you get less, it's up to the amps the power supply can deliver and how hungry the device is. VS10xx docs I remember (just a DSP example) gave a max draw at 800 mA, Arduino max out is 200 Ma. I'd give it an Amp just for that.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fgmarshall on Sep 10, 2013, 07:58 pm
I tried the 2 diode trick but on the 'scope the volts were all over the place between talking and not talking
I have put some notes here -

http://www.sunspot.co.uk/Projects/Arduino/speaking-vario/Arduino-Vario-WTV020.html (http://www.sunspot.co.uk/Projects/Arduino/speaking-vario/Arduino-Vario-WTV020.html)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Sep 10, 2013, 08:19 pm
Would a bypass cap on the audio module help?
Title: Arduino library for WTV020-SD-16P audio module
Post by: mr_haiko on Sep 12, 2013, 11:55 am
Hi

Can anyone help me!!!
Is it possible to change operating mode of WTV020SD-16p module? I read the datasheet several time but there is nothing mentioned about mode selection. And also i can't get the current mode.
Actually for this module i don't use arduino module so I want to make code for AVR microcontroller  manually (without using Arduino functions).
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Sep 12, 2013, 06:05 pm

Hi

Can anyone help me!!!
Is it possible to change operating mode of WTV020SD-16p module? I read the datasheet several time but there is nothing mentioned about mode selection. And also i can't get the current mode.
Actually for this module i don't use arduino module so I want to make code for AVR microcontroller  manually (without using Arduino functions).


I don't know that module.

But just checking, you do know that Arduino code works on stand-alone AVR chips? The board has the USB interface and some bits but that is all, it is for development even though it often gets used in hobby level end products.

Here are projects that use V-USB to access USB directly from even small AVR's:
http://www.obdev.at/products/vusb/projects.html
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Sep 12, 2013, 07:57 pm

Hi

Can anyone help me!!!
Is it possible to change operating mode of WTV020SD-16p module? I read the datasheet several time but there is nothing mentioned about mode selection. And also i can't get the current mode.
Actually for this module i don't use arduino module so I want to make code for AVR microcontroller  manually (without using Arduino functions).


What operating mode? It can be controlled from either the Arduino, or manually from tact buttons.
Look at this page WTV020SD-16P (http://www.instructables.com/id/How-to-use-WTV020SD-16P-with-Arduino/). There is also a downloadable PDF on that page in the top left of the screen.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: the-rebel-agent on Sep 12, 2013, 09:41 pm
Good to see that there is interest in this small device after all this time. :P
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ohc200 on Sep 16, 2013, 09:22 am
How exact serial timing is for this chip ?.
I have ordered these modules from 2 different placies and none is working via serial commands.
AD4 format audio files used in 2GB cards and I/O keys are working.
Controlled serial via LPT port with Windows XP, so timing is what it is, quite slow thoug.
Next connecting to PIC18F252 (not arduido..) so I'm sure that timing is ok.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: fgmarshall on Sep 17, 2013, 06:04 pm
As far as I can see the reset function is only called at start-up time.

I had not connected the reset wire and all seems fine.
I think the board resets when the power goes on.

So I can save a pin!
And I do not need to monitor the busy line - save another pin!

But how do I modify the .cpp and .h files to free these pins for my main program?

I guess I can just change

WTV20SDBreakout::WTV20SDBreakout(int resetPin,int clockPin,int dataPin,int busyPin)
to
WTV20SDBreakout::WTV20SDBreakout(int clockPin,int dataPin)
and delete all other references to the pins?

Or will something go wrong in the board firmware....
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: mr_haiko on Sep 26, 2013, 11:24 pm
I would like to give a question related to WTV020SD-16P.
I follow of all steps I can't understand is the module in mp3 mode or may be in another mode, also after power on if i pull down Play On/Off pin
the busy pin goes to high a few second and returns to low even the music in SD card is quite long. Could anybody give me any advice?
For example after power on in which mode is the module?
I need to use mp3 mode how can i set this mode?
Best regards,
Haik.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Sep 27, 2013, 12:56 am
This is my setup for using tact buttons. I appologise if the picture is too big, it is an HD shot.
Here is the pin layout.
 
                                         
    2->|RESET           U           VDD|
         |AUDIO-L             BUSY/P06|<-5         
         |NC                              NC|
         |SPK+                 NEXT/P02|
         |SPK-                  PREV/P03|
         |NC                              NC|
    3->|P04/CLK/VOL+      VOL-/P05|<-4
         |GND                   PLAY/P07|
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: michaelsngws on Sep 27, 2013, 09:19 am
Hi guys,

I have no knowledge of electronics, and this is one of my very earliest attempts at playing with this, so please bear with me, I might need things explained slowly.

I am trying to get one of these WTV020-SD-mini V1.5 to work but so far failed to get any sound. Currently trying to troubleshoot by trying a variety of Micro SD cards. Like everyone else, I am finding it hard to find sub 2gb SD cards these days.

2 questions:

1) I understand that there are different versions of this module, 2 Line controlled and Button controlled, etc. Is there a way to visually identify what version it is? Since I bought it off a vendor on AliExpress, I am not completely sure which version I got.

2) Can this module output audio through 32ohm 0.1W speakers? I've got one of those and a 32ohm 0.2W speakers I found at give-away prices at a hardware shop. I tested them with the simple Arduino buzzer sound sketch and they work, just wondering if they work with this module.

Thanks!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Sep 27, 2013, 09:46 am
Is your module the same one as in my picture? The module I have can be controlled from the arduino too, from certain pins. See my pin layout.
I don't know if it can drive that speaker directly, so it would probably be wise to get an amplifier.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: michaelsngws on Sep 28, 2013, 03:09 am
Yes, HazardsMind, the module looks exactly like the one in your picture.

I have wired it like yours and several other diagrams floating around on the web. I have hooked up a "Busy" LED and have noticed that the frequency of the "Busy" light flickering is different when the module does not have an SD card, and when it has a 128mb SD card inside. It also flickers slightly differently when I insert a 2gb SD card. This leads me to conclude that it does actually detect the SD card.

Just reading up a bit about speakers, and my guess is that mine have too high impedence. Will be ordering or looking for lower ones.

This process of elimination is quite annoying. :D
Title: Update! I have sound!
Post by: michaelsngws on Sep 28, 2013, 08:02 am
Weee, I have sound!

What I did, in my attempt to troubleshoot was to hook up the module to the Arduino Starter kit piezo buzzer to test if it was a problem with my speaker. And lo and behold, while I didn't get music, I got a very soft clicking sound when I paired it with my 128mb Nokia branded sd card, but not from my 2gb sd cards. Well, at least that eliminated the possibility that my WTV module was bad.

So I went in search of a speaker: I got the speaker out of an old Gameboy Color (forgive me, the screen was already melted). A quick Google and I found out it was 8ohm 0.1w.

My conclusion that I arrived at for my module is this:

1) My 128mb Nokia branded micro sd card work. Neither my Kingston nor no-name (that came with a Nokia phone) 2gb sd card works.
2) The 128mb sd card works at 3.3v. It also works with 5v through 2x N4007 diodes (again from the Arduino starter kit) in parallel. Neither 2gb works at either voltages.
3) The speaker from the Gameboy Color 8ohm 0.1w works. My previous ones 32ohm 0.1w did not. I think the datasheet mentioned 8ohm 0.5w as a limit. I have ordered some to see if they work.

My sound module is now playing the-rebel-agent's Star Wars music! Weee!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Sep 28, 2013, 08:16 am
Glad to hear it works now.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Sep 28, 2013, 02:20 pm
You can try getting a set of ear buds at a dollar store and soldering direct to the plug. The wires will be so thin it takes special work to connect but the plug is easy enough.

If you can get a plug that you can solder to the wires with, pop that into a set of powered speakers. OTOH there's an amplifier chip with number 386 in the name that can give you 20x to 200x boost....

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Sep 28, 2013, 07:46 pm
Quote
OTOH there's an amplifier chip with number 386 in the name that can give you 20x to 200x boost....


@michaelsngws:
GoForSmoke is correct and that chip is also in the picture, just follow the yellow wire.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Sep 28, 2013, 10:25 pm
I got a few from Yourduino at 5 for 75 cents,
http://yourduino.com/sunshop2/index.php?l=product_detail&p=312

Circuit and datasheet are here,
http://arduino-info.wikispaces.com/Popular-ICs

but I had to wait until I got enough other parts to justify the shipping, ended up spending $30-some. Everything came back but be aware that whoever makes the chips has the names and info molded into the top instead of painted on. One one hand the label won't rub off, OTOH it's hard for old eyes to read even with a magnifier! I haven't tried but maybe painting the top with whiteout and then scraping will leave the stuff in the grooves. It's that or I crank up the printer-scanner at 600 DPI to see which chips I want off the foam!

But hey, at those prices I get more for my dollar even with the shipping. Not just chips, but support with full explanations.

No, I'm not part of Yourduino or related or in the same state as anyone from Yourduino. I just like the deals so far.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: hills603 on Oct 01, 2013, 11:28 pm
Hi, maybe i'm being dim, (i'm still a novice when it comes to using arduino, But i have downloaded the zip file and copied it to the arduino libraries folder, open it in the editor and when trying to upload it, or even verify it, I get an error. Im sing an arduino uno, if that makes a diffrence. It says:

It always Highlight this line of the script:

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

and always says the following:

'Wtv020sd16p' does not name a type

Wtv020sd16pExample:21: error: 'Wtv020sd16p' does not name a type
Wtv020sd16pExample.ino: In function 'void setup()':
Wtv020sd16pExample:25: error: 'wtv020sd16p' was not declared in this scope
Wtv020sd16pExample.ino: In function 'void loop()':
Wtv020sd16pExample:30: error: 'wtv020sd16p' was not declared in this scope


What / where have I gone wrong???
Any help most appreciated, many thanks,
Andy :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Oct 02, 2013, 12:16 am
You may need to change #include <Wprogram.h> to #include <Arduino.h> in the .h and/or .cpp file. To do this you will need a text editor like notepad or notepad++, save it then recompile sketch.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Oct 03, 2013, 04:08 am

You may need to change #include <Wprogram.h> to #include <Arduino.h> in the .h and/or .cpp file. To do this you will need a text editor like notepad or notepad++, save it then recompile sketch.


Another thing I've found to work is to Select All and Copy the sketch then start a new sketch in the newer IDE and Paste to that. There may still be some editing needed, of course.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Oct 03, 2013, 07:52 pm
Not saying that's wrong to do, but some of the older sketches don't know to look for either Wprogram.h or Arduino.h, some are just set for Wprogram.h.

I always check anyways.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Oct 03, 2013, 08:11 pm
Start a new sketch, it will already include the files that match the IDE version. Paste in the old sketch as a text copy from clipboard. Debug. Repeat until no bugs. There will be differences and one or more might or might not matter. Usually simple sketches just run the same for me.

You can #include <Arduino.h> //  just to be sure whichever way you load the sketch

To what extent does the compiler not include unused functions, etc? IIRC if you only use one function in <string.h> then the rest don't get compiled. If nothing calls <Wprogram.h> then it won't be in the final image.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dregalia on Oct 05, 2013, 06:33 pm
Hey guys, maybe someone here can help.

I'm using an arduino pro mini.  I have everything wired, and I'm getting sound, however I'm getting some funky behavior.  Right after it plays a sound, it locks up.  (I'm using the example from buildcircuits.com... btw, their schematic has the grounds in the wrong place on the bottom of their breadboard).  When I play a sound, the whole thing locks up.  

I tried isolating it to a subroutine, and setup up println to debug it all:
Code: [Select]

void PlayVoiceOne() {
       Serial.println("amp on start ");
       digitalWrite(AMPpin, HIGH);
       delay(1000);
       Serial.println("amp on complete ");
       //delay(50);
       Serial.println("play start");
       wtv020sd16p.playVoice(1);
       // this is where it locks up
       Serial.println("play done");
       //delay(100);
       //wtv020sd16p.stopVoice();
       Serial.println("amp off start");
       digitalWrite(AMPpin, LOW);
       Serial.println("amp off end");
}

Eventually it releases the process, but it even interrupts the void loop(),  but I can't figure out why it is freezing.  I have the latest version of the library.   Any thoughts or ideas would be appreciated.  BTW, i'm using the PAM8803 amp inline with this.

~Doc

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 05, 2013, 08:44 pm
The sound to play only plays during the delay period then you tell it to stop:
Code: [Select]
wtv020sd16p.playVoice(1);
       // this is where it locks up
        Serial.println("play done");
        //delay(100);
        //wtv020sd16p.stopVoice();

100 milliseconds is extremely short of  a time.  ;)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dregalia on Oct 05, 2013, 10:36 pm
Those lines are commented out.  The delay was only in there from something else i was trying out.  You can ignore them.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 06, 2013, 12:46 am
Even with that being so you are turning off the amp pin immediately after you start the sound.
You will need a delay to play the sound before turning the amp pin low.
Post the whole code so to see what is happening in full.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dregalia on Oct 06, 2013, 04:17 am
I think you're confusing playVoice with asyncPlayVoice.  I appreciate your insight tho, I thought of that already, including giving it a few ms to clear...  But I've tried quite a few different delays, and ideas, which is why i'm coming here for advice.  

I can skip the amp completely, and it still locks up.  I'm also using some of the different .wav and .ad4 files from onesky's other post.  


Okay, I understand what you were talking about.  If i'm not using the library, and I'm just using straight serial commands, then what you're saying makes perfect sense, whereas the library kind of takes care of that for me.  I have abandoned the library, and i'm just using the straight serial commands to make this work.  Everything seems to be working as expected.

Sorry 'bout that.  I just had to do some more reading.  Now the best part is to read up on file formats, and trying to get them to work with this chip. 

~D
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Oct 06, 2013, 04:31 am

The sound to play only plays during the delay period then you tell it to stop:
Code: [Select]
wtv020sd16p.playVoice(1);
      // this is where it locks up
       Serial.println("play done");
       //delay(100);
       //wtv020sd16p.stopVoice();

100 milliseconds is extremely short of  a time.  ;)


1,600,000 cycles Arduino time.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 06, 2013, 01:35 pm
@ GoForSmoke I guess 100 milliseconds is a while in cycles.
Don't blink you'll miss it!
Wikipedia:
Quote
The average length of a blink is 100-400 milliseconds.


@JustDoc Could you post your whole code?
We can only help by what info you give.
With the code you posted
Code: [Select]
void PlayVoiceOne() {
       Serial.println("amp on start ");
       digitalWrite(AMPpin, HIGH);
       delay(1000);
       Serial.println("amp on complete ");
       //delay(50);
       Serial.println("play start");
       wtv020sd16p.playVoice(1);
      // this is where it locks up
       Serial.println("play done");
       //delay(100);
       //wtv020sd16p.stopVoice();
       Serial.println("amp off start");
       digitalWrite(AMPpin, LOW);
       Serial.println("amp off end");
}

The problem LOOKS to be that you are shutting the amp off as soon as the sound starts.
But you say it "locks up" even without the amp.
Explain a bit better what you mean by "locks up".
You said
Quote
Right after it plays a sound, it locks up.

Does it completely play the sound? Or just start to?
If it plays a bit then "locks up" maybe you should read this:
http://forum.arduino.cc/index.php?topic=115411.0 (http://forum.arduino.cc/index.php?topic=115411.0)
Scroll down to where fungus talks about supplying 3.6v to the module.
Here is a schematic showing how to get the 3.6v:
http://forum.arduino.cc/index.php?action=dlattach;topic=115411.0;attach=42690;image (http://forum.arduino.cc/index.php?action=dlattach;topic=115411.0;attach=42690;image)
How are you wired up? Can you show a pic of the connections?
Did you connect it like shown in the second post of this thread?
Aside from your  //comments which would lead to error  and the fact that you are turning the amp off immediately after the sound starts your function looks ok.
How are you wired up? Can you show a pic of the connections?

edit:Also try this:
Code: [Select]
void PlayVoiceOne() {
        Serial.println("amp on start ");
        digitalWrite(AMPpin, HIGH);
        delay(1000);
        Serial.println("amp on complete ");
        Serial.println("play start");
       wtv020sd16p.playVoice(0); // Added this
       wtv020sd16p.asyncPlayVoice(1);
       // this is where it locks up
        Serial.println("play done");
        Serial.println("amp off start");
        digitalWrite(AMPpin, LOW);
        Serial.println("amp off end");
}


This sketch plays track 1 start through finish for me I just tried it:
Code: [Select]

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
*/
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
  //Initializes the module.
  wtv020sd16p.reset();
  delay(100); // needed after reset
  wtv020sd16p.playVoice(0);
  //Plays asynchronously an audio file.
  wtv020sd16p.asyncPlayVoice(1);
}

void loop() {
// Nothing here
}

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: dregalia on Oct 06, 2013, 11:05 pm
Elac,

Sorry, I kinda scrapped everything yesterday and started over from scratch.  I completely understand what you are talking about now.  What was happening is this, When I said it would 'lock up' I meant that it would play the sound, and then it would 'hang' for a very long time.  (I put LED indicators before each one of the commands as well as serial print to kinda debug it).   The code has a lot of other stuff in there, most of it crap that I was playing with, and I kind of made the decision if i was going to clean all of the junk code and comments out of it, I might as well start over from scratch.

~Doc
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: elac on Oct 06, 2013, 11:15 pm
Ok, sometimes a fresh start is the best.
Good luck.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ljbeng on Oct 11, 2013, 08:01 pm
I have a problem with this library the way it is written:
Code: [Select]

void Wtv020sd16p::sendCommand(unsigned int command) {
  //Start bit Low level pulse.
  digitalWrite(_clockPin, LOW);
  delay(2);
  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {
    //Clock low level pulse.
    digitalWrite(_clockPin, LOW);
    delayMicroseconds(50);
    //Write data setup.
    if (command & mask) {
      digitalWrite(_dataPin, HIGH);
    }
    else {
      digitalWrite(_dataPin, LOW);
    }
    //Write data hold.
    delayMicroseconds(50);
    //Clock high level pulse.
    digitalWrite(_clockPin, HIGH);
    delayMicroseconds(100);

   //HERE IS MY PROBLEM
    if (mask>0x0001){
      //Stop bit high level pulse.
      delay(2);     
    }


  }
  //Busy active high from last data bit latch.
  delay(20);
}

Won't mask be > 0x0001 for all 16 loops?  Won't it delay 2ms + 100us for every pulse to the chip?

Also the data sheet shows the busy line drooping low when the voice goes high.  Why is the library looping while busy is high and waiting for busy to go low in the playVoice routine?

Code: [Select]

void Wtv020sd16p::playVoice(int voiceNumber){ 
  sendCommand(voiceNumber);
  _busyPinState=digitalRead(_busyPin);
  while(_busyPinState==HIGH){
    _busyPinState=digitalRead(_busyPin);
  }
}

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Oct 12, 2013, 05:03 am

I have a problem with this library the way it is written:
Code: [Select]

  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {

Won't mask be > 0x0001 for all 16 loops? 


It will start at 0x8000 (high bit set) and work down one bit per loop.
Things like this you can test in a sketch that only has code in setup() to test the one thing you want to see.

It's not the most efficient code with those delays. Do you want to rewrite it?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ljbeng on Oct 12, 2013, 06:50 am
I see that but look at the last few lines before the for loop is repeated....
Code: [Select]

    delayMicroseconds(100);

   //HERE IS MY PROBLEM
    if (mask>0x0001){
      //Stop bit high level pulse.
      delay(2);     
    }



the delay(2) will be executed on each loop.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ljbeng on Oct 12, 2013, 06:56 am
I did have to rewrite this code... in assembly (for an older product with an obsolete ISD chip) .  I only call the delay(2) on the last loop when mask==0x0001...(but in assembly)

Code: [Select]

;*******Clocks in commands to the sparkfun wave player
clockcmmd setb a3
setb pdisd
clrb a4
mov temp3,#2 ;wait 2ms
call waitms
mov count,#8
:rrh clrb a4
call wait50us ;50 us delay
movb a3,commandh.7
call wait50us ;50 us delay
setb a4
call wait50us ;50 us delay
call wait50us ;50 us delay
rl commandh
djnz count,:rrh
mov count,#8
:rrl clrb a4
call wait50us ;50 us delay
movb a3,commandl.7
call wait50us ;50 us delay
setb a4
call wait50us ;50 us delay
call wait50us ;50 us delay
rl commandl
djnz count,:rrl
setb a3
mov temp3,#2 ;wait 2ms
call waitms
ret
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Oct 12, 2013, 07:34 am
RL, is that rotate left? I thought it was ROL or RCL (rotate left with carry)
Do you have a complete ASM cheat sheet?

Edited:
Never mind, RL is rotate accumulator left.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Oct 12, 2013, 12:06 pm

I see that but look at the last few lines before the for loop is repeated....
Code: [Select]

    delayMicroseconds(100);

   //HERE IS MY PROBLEM
    if (mask>0x0001){
      //Stop bit high level pulse.
      delay(2);     
    }



the delay(2) will be executed on each loop.


I don't know what this hardware needs but to do the same as your assembly for a different chip example only needs the 
if (mask>0x0001){
to be
if (mask == 0x0001){

The comment says it's for a stop bit so maybe check where stop bits are needed?

It would be nicer if instead of delays the library let go of the code and pick back up when the time was right but that would be a Major Rewrite rather than a small tweak.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Schuppeste on Oct 31, 2013, 09:52 pm
If I have only one PlayVoice() call in my script .. I hear nothing .. The Example works without voice Play (0) ..

Can i use Play Voice (0); Play Voice (1) Play Voice (2);

I thought to play voice wait until the song is finished.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Megaionstorm on Nov 11, 2013, 06:05 pm
Has the library the ability to play wav-files ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: MacZap on Nov 19, 2013, 08:23 pm

Has the library the ability to play wav-files ?


Yes, but not stereo wav files
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Peintre on Jan 08, 2014, 02:19 am
thanks for this library. it works great.

and i can confirm that 16-bit mono wav files work with the WTV020-SD-16P.

just one question: what's the difference between playVoice() and asyncPlayVoice()?

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: begin1 on Jan 14, 2014, 06:45 am
Hello, I'm a beginner. could this device be controlled by a 4x4 keypad membrane instead of switch. In every key from the keypad it will play different wav files. Thanks in advance
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: alexw2150 on Jan 20, 2014, 09:14 pm
maybe you can try SPI flash solution,it will response faster than SD card.

Is anyone aware of how to use the SPI interface for the WTV020-SD-16P audio module to put .ad4 files onto the on-board 64mb flash memory?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sibianul on Jan 30, 2014, 06:58 pm
Hello guys,

a friend of mine asked me if I can make something play very fast, a few times / second. A very short sound track to be played a few times / second, he wanted to be able to modify the repeat frequency. I don't have yet an audio module to test out the library, and I want to ask you

Is there any lag after the command to play a track ? can a very short track be played multiple times in a second ?

Thank you
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: skoubri on Feb 10, 2014, 08:09 am
Trying with my module with no luck.. for two days now!...

Read all the thread and today i tested four SDs with ethernet shield.. the two of them (2GB) worked fine... the other two (4GB, 1GB) are not working...

The one of the two (2GB) is Kingston . Tried various formats but no luck... the unit is complete silent.. Only the LED after some seconds stay lit...

I am just wondering.. is there any other module maybe more "serious" out there to produce sound with arduino and especially with no gaps at loops?

Thanks in advance!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sibianul on Feb 12, 2014, 02:50 pm
... especially with no gaps at loops? ...


Please can you elaborate, this is what I'm curious too, but so far I can;t test as I don;t have any siund module .. is there any gap when looping a sound (even if the sound is very short) ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Feb 12, 2014, 05:37 pm
I have had problems with theese chips. (still have)
I came over an idea (cant remember where) that 3,3V may be just to low to make this work.
A cellphone battery (3.6V) as powersupply had make it work as a standalone unit.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Feb 12, 2014, 06:55 pm

I have had problems with theese chips. (still have)
I came over an idea (cant remember where) that 3,3V may be just to low to make this work.
A cellphone battery (3.6V) as powersupply had make it work as a standalone unit.


If the 3.3V is low, check the 5V! You may have been dragging too much current through the board for its own good.
Check the power requirements of the module at full volume. If it needs more than 100mA then you probably should use external power, Arduino total should not exceed 200mA and best not to draw that much Through The Board.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: skoubri on Feb 14, 2014, 07:36 am
Yesterday arrived my second module as i have ordered some of them.. Identical to the first same type IC , etc...

It PLAYED just out of the box! Have the same behavior when plays(LED) so i think that the first one has something with audio output.. seems to play but not sound on the speaker or audio out pin.

But i am still looking for a "gapless" solution or the ability to have a long sound file and jumps into parts of it with no or very short delay...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: winterwolf on Feb 14, 2014, 07:43 pm
Hi guys
I'm having problems with my wtv020 sound module. It seems that the LED blinks a few times, then stop blinking. But there is no output sound can be detected from the speakers. I'm using a two types of SD cards which is SanDisk 2GB MicroSD and SD-C02G microSD/T-Flash Card  Toshiba. I've copied the AD4 files form circuitstoday into the SD cards, so i assume there is no problem with the files.  Your coorperation is truly appreaciated =D
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Schuppeste on Feb 23, 2014, 08:55 pm
Hardware Question,

how can i activate the 5-File keymode ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: boox44 on Mar 26, 2014, 04:46 pm
hi, i bought 1 module WTV020-SD Micro SD Card mp3 but i have few problem to make it work, i real all the posts and i have not found solution ...

i use this tutorial : http://www.buildcircuit.com/mp3-mode-circuit-wtv020sd-16p-tutorial/ , i use the 3.3v power of the arduino and gnd to make it work...

(http://farm9.staticflickr.com/8242/8545527186_733a1033bf.jpg)

First i use no name micro sd card 128mo and i try with a sandisk 2gb but the led don't  blink! do you know why?

i have a question, if the sd card is not compatible, the led blink or not with this schematic?

thanks for help
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Mar 26, 2014, 05:05 pm
I've go two of theese 'nonworking' modules. (crap)
Found one answer that made a difference. He increased voltage to 3.4..3.5V
That can be done feeding 5V through a copule of diodes (or a red LED ? )
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Mar 26, 2014, 05:10 pm

I've go two of theese 'nonworking' modules. (crap)
Found one answer that made a difference. He increased voltage to 3.4..3.5V
That can be done feeding 5V through a copule of diodes (or a red LED ? )


You can make a voltage divider and fine-tune the output voltage very close to what you want.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Mar 26, 2014, 05:14 pm
..I guess the sound module needs changing differents .. which means a resistive voltage divider is out of Q.
Better with seriel diodes.. Or a near empty cellphone battery
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: boox44 on Mar 26, 2014, 05:21 pm
today i'll try with a 3,6v cellphone battery...

but i read many tutorial where 3,3v is good to make it work....i don't know why...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Mar 26, 2014, 06:12 pm
If the circuit pulls more current than the source wants to give, you will get a voltage drop.
Even too many leds can take Arduino 5V down to 4.5V. At 16 MHz, any lower and it may get unstable.
So what happens when the sound chip and SD are both at full pull? A few 10th's of a volt may help.

I'm pretty sure that I can feed SD 3.7V and likely most other 3.3V devices as well.
FWIW, Arduino can take 5.5V too, but you probably shouldn't put 6V on VIN.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: boox44 on Mar 26, 2014, 11:25 pm
thanks for your help!

it's possible to make a voltage divider with 2 resistors and take ouput 5v of arduino?

i need 3,6v or 3,5v?

thanks
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Mar 27, 2014, 01:44 am
Resistors usually come in standard values, and I for one don't have all of those.
But they can be put together in serial and/or parallel to make almost any value.

Here is a link showing voltage divider and formula. That's a really good site, you might bookmark it.
http://electronicsclub.info/vdivider.htm

If R1 is 2000 ohms (2 1K's in series for me) and R2 is 4700 ohms the Vo would be 3.5V.

Notice that Voutput = Vsource x ( R2 / ( R1 + R2 ))
( R2 / ( R1 + R2 )) gives the fraction of source voltage that output voltage will be independent of source.

I used 3 x 4.7K resistors to make a 1/3 drop by putting 2 in series to make R2 and the other to be R1.
My output voltage is 2/3 which for 5V is 3.3V. To get 3.5 I varied the ratio so that less goes straight to ground.

My output current runs through the 4.7K resistor so it will be less than if no divider is present but I don't need much current, it is for voltage-leveling a serial pin on a 3.3V chip to a 5V Arduino. I used 4.7K's so that less current would flow to ground than with lesser ohms.
That may be more resistance than you want, the 2K-4.7K example above is half as much. Still, you may need to play around to get just what you want/need.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Mar 27, 2014, 03:32 pm
resistor voltage devider wont do.  this circuit is not "constant current"
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Mar 27, 2014, 06:15 pm
Is there a maximum current specified for the WTV020-SD-16P?
If not then pick resistors that let at least the most current *required* by the module.

My UNO is supplied 500 mA at 5V by USB but it doesn't use 500 mA.
It is recommended to not draw more than 200 mA through the board and the UNO itself uses little more.

So is constant current required for this module? The Elec doc says 3.3V and nothing about limiting current.

Voltage divider does impede current because output current goes through a resistor. That is why you have to pick the resistors to allow enough current through to run your app.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: boox44 on Mar 29, 2014, 03:21 am
hi and thanks for your help

today i test with 5v arduino and 2 diodes 1n4001  in series but the led don't blink...
i don't use a speaker but a pair of earphone, i test it with no name sd card 128mo and a sandisk 2gb

i add led after the diodes and i connect it to VDD  to see if the module receive voltage and the led works, after i add led between GND of module and arduino gnd and the led works, i don't understand.

This module really sucks...tomorrow i receive a new module if it don't work i stop with it...

i saw an other possibility to play mp3 or wav with a cheap sd card module that i have, if you are interested:
http://apcmag.com/arduino-project-5-digital-audio-player.htm
and
http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio

bye

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Mar 29, 2014, 04:43 am
I have a VS1000 that works but for OGG files.
The MP3 to OGG converter is available at the VLSI-Solutions home site.
The module itself has onboard flash and a micro-SD slot and can be run through simple serial commands.
To get just 1 or 2 direct from the company to USA, there's a courier delivery fee that doubles the price so here you would want to find a supplier though I dunno who.

I have some Chinese modules that to get playing MP3 requires soldering 2 SMD pins together which I'm not good enough to even try.
http://www.bajdi.com/lcsoft-vs1053-mp3-module/

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: karlo on May 29, 2014, 10:55 am
I want to controle the volume by : 
wtv020sd16p.volume(0); // 0 to 7
or
wtv020sd16p.volume_up()     or down .  But it did not work.
Please help with code example.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Dogramaci on Jun 03, 2014, 07:55 pm

Hey.

1: Yes the files were converted. Just to make sure I downloaded the test file made (and tested) by another user on these forums.
2: As far as I am aware, I just needed to copy the files named 0000.ad4, 0001.ad4, etc to the SDcard root dir?
3: Ok. If the file tree is correct, then I will try a different card.

I don't have a shield to test it with, as money is tight at the moment, and I've never needed one. Please let me know about the file tree if you can, as I can't find any info about it on the web. Cheers!




I had the same problem. But all suddenly started to work when I plugged the module into 5V instead of 3.3V. The form advices you to plug the module into 3.3V but the voltage on the module itself indicates 5V.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: knut_ny on Jun 03, 2014, 11:45 pm
--there have been a lot of discussions regarding this (junk) item.
My (two) modules stared working when fed from 3.7V lion (phonebatteries).
Other replies suggest the same. 3V3 is too low voltage.
Try feeding 5V reduced by a couple of series silicon diodes
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Jun 04, 2014, 12:53 am
If your 3.3V device powers on 5VCC and has 3.4VDD, you can use that line with a good bit of resistor to pull up a pin that you have a diode on, blocking 5V level signal from an UNO. When the signal is low, it drains the pullup and when the signal is high, the pullup provides VDD to the pin.
Serial TX/RX idle state is HIGH to keep the lines from floating, the diode will prevent flow during idle and 0-bit times where with other voltage-levelers the 5V gets regulated some way that generally wastes more current and makes heat, the signal line at idle will need constant current loss. For RX/TX you only need to level shift RX, not TX.

Jack Christiansen showed me this one BTW. He said he saw it somewhere on a site.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jmmerino on Jun 10, 2014, 10:46 am
Hello everyone,

May be this is a silly question, but I'm a newbie so.. sorry in advance...
Can I have direct access to the SD card with the WTV020? I mean, read and write files directly with an SD card library like the SD.h...

I want to use this module for two things in my project:
1.- Play some music files
2.- Store some html files for a micro-webserver

Do you think that this is possible or I have to buy another SD card module to store the HTML files?

Thanks!

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Jun 10, 2014, 12:28 pm
You can make an SD adapter pretty cheaply. Google DIY SD card

If your Arduino is 3.3V then you don't have to do any voltage leveling, otherwise you will need a small handful of cheap parts for leveling.

The neatest voltage leveling I've seen uses 3.3V pullups on the SD adapter input pins and diodes on the same pins blocking 5V input. It only wastes a little power on one line.

When a 5V line is HIGH, the SD card reads 3.3V HIGH pullup because the diode blocks the 5V.
When a 5V line is LOW, it takes the pullup current away through the diode and the SD card reads LOW.
Feed the SD card VCC from a voltage divider and use that same line to power the pullups through 10k resistors.
That's 2 resistors for VCC and a resistor and diode for MOSI, SCK and SS.

However you wire it, there are oodles of voltage leveling circuits and chips, the code will be the same.
In your IDE under File->Examples->  you should find the SD examples and they should run.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roontoon on Jul 13, 2014, 12:05 am
Can this module be controlled totally by the arduino? If so what can be eliminated from the circuit? The project that I have in mind for it will require that it operate and change recordings via the arduino. Thanks!

d
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 13, 2014, 12:38 am
Basically anything that uses a button can be replaced by the arduino. Volume, next/prev song, pause/play.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roontoon on Jul 13, 2014, 03:42 am
What about the schematic? Does the module only need the three connections to the Arduino and the rest of the schematic  can be eliminated? Or do you need additional pins  on the Arduino. Thanks

d
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 13, 2014, 06:29 am
Take a look at the attachment below. On page 5, it gives you a layout of what each pin does, and if you look at pin P04 and P05, you will see a secondary function. P04 is the clock, and P05 is the data, so with that, you basically only need two pins to get it to work, but you also need to send the correct data too.

The library was made to send said data, and all you need to do is wire it correctly.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roontoon on Jul 14, 2014, 01:07 am
Thanks I'll give that a shot.

d
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roontoon on Jul 23, 2014, 10:25 pm
I am trying to get this working and I have a question re: schematic and sketch.  In the schematic it is showing only three pins on the arduino used. Pin 1 of the WTV020-SD-16P going to A3 on the Arduino, Pin 7 of the WTV020-SD-16P going to pin A4 of the Arduino, and Pin 10 of the WTV020-SD-16P going to pin 5 of the Arduino.

(http://i60.tinypic.com/34ecboh.jpg)

But in the sketch there are four pins defined. I wired it up as in the schematic but nothing is working.... What am I missing?

Code: [Select]

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.


Thanks

Dan
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 23, 2014, 10:46 pm
P06 is the busy pin (pin 5), it lets the arduino know when a audio file has ended.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: roontoon on Jul 23, 2014, 11:22 pm
I guess I am confused about the reset which is defined in the sketch as pin 2 but in the schematic it is A3. And A3 in the sketch is defined in the sketch as the clock pin not the reset. Not clear to me at all.

d
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Jul 23, 2014, 11:50 pm
The pins used in the diagram are just examples, it's the pins in the code you want to go by. Then again, you could always changes those too, but as long as you know which pin is what (clk,data,reset and busy) you can code it to work on any combination of arduino pins. Just note, if you plan on using the serial monitor, don't have anything in digital pins 0 & 1 , otherwise you may get incorrect results.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: McTristan on Jul 26, 2014, 09:39 pm
Hello All,

this is my first post so don't kill me for asking.

I've got my module working fine with a 2GB Transcend SD card connected to a 3.3V 8Mhz Arduino Pro Mini. It plays every sound on the SD card but I have a kind of funny behavior: whenever I play a file (synchronously or asynchronously - it doesn't matter) it will play 2 seconds, rewind and play the whole song.

It will always do this and with every file - play 2 to 3 seconds, rewind, play the whole file without a problem...

Any ideas?

P.S: Of course I'm using the library from the first post...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: McTristan on Jul 27, 2014, 03:54 pm
In case anyone wonders - I could solve the problem by applying the fixes mentioned here:

https://www.sparkfun.com/users/395251

Quote
insufficient delay after reset. In line 37, changing "delay(300);" to "delay(750);" worked for me;
if you rely on the playVoice() call: sendCommand() returns too soon, when the busy pin is not yet on. In line 94, tweaking "delay(20);" to "delay(50);" worked for me.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Jul 27, 2014, 04:02 pm
It might be better to watch the busy pin than to delay and assume readiness.
Best case with the delay is you wait every time longer than needed.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: McTristan on Jul 27, 2014, 06:34 pm
Yes you are right but for the time being this single delay in the beginning is the easiest way. The documentation is so weird and the findings in this and other forums so different I won't believe a single thing ...

I'm using a Transcend 2GB Micro SD card which is said, does not work most of the time. I've tested it with 2 1.5V AAA batteries as well and it is working for hours together with the 3.3V Arduino Mini Pro ... . All this should not work reading this forum and the documentation ;)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Jul 27, 2014, 10:08 pm
I know what you mean about the confusion.
A little extra time in initialization hardly impacts speed anyway.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 05:00 am
hello ... this is my first time to make an arduino project .........
I just want to ask if audio amplifier is necessary in this module? :D
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: McTristan on Aug 01, 2014, 08:30 am
I guess not, I've tested it with a couple of 8 Ohm speakers and they are loud enough.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: GoForSmoke on Aug 01, 2014, 08:46 am
You might be safe to feed it to amplified speakers but it would need resistors to feed as Line In to an amp.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 06:09 pm
thanks for the reply ...

After I made the connection in Arduino Uno,  format the 2 gb Sd card into Fat32, and covert my audio files into Ad4 file with 3200 sample rate, I still fail make this module work ...

I thought of adding audio amplifier because my module does not emit any sound ...
but the led connected to the busy pin blinks several times and later become stable at a specific time. and then it blinks again ...
what do you think is the problem in my module
can you suggest something to solve my problem....  :smiley-roll-sweat:
any suggestions is deeply appreciated   :D
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Aug 01, 2014, 06:30 pm
I haven't read the previous posts yet, but have you tried a WAV file?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 08:01 pm

I haven't read the previous posts yet, but have you tried a WAV file?


yes i tried it ... I notice that led blinks when the music is played and it become stable when the music ends. this is based on the duration of the music... did your module play wav file ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Aug 01, 2014, 08:04 pm
Yea, its weird, some play as WAVs and others as AD4

Added: Im using a Sandisk 1GB memory card fat32 format.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 08:09 pm
yes its true ... by the way ... do you think using an  8 ohms speaker with 0.5 w will work ? ...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Aug 01, 2014, 08:10 pm
I'm not sure what speakers it can handle, but it should be fine.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 08:14 pm
okay ... I hope that It will be fine I will look for another speaker and sd card ... did have some sample codes out there can I have it ? :D
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: HazardsMind on Aug 01, 2014, 08:16 pm
Im using the same code and library provided on page one of this thread.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 01, 2014, 08:21 pm
ok thanks a lot  XD .... 
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: xXtrenxzXx on Aug 03, 2014, 02:51 pm
at last I finally made it ... thanks to all suggestions  :smiley-mr-green:
it is tru ... sd card is the problem ... I bought san disk 2gb sd card and it works :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: pcesario on Aug 04, 2014, 01:54 am
Dear all, i tell you my experience with this great and cheap module and at the end, one problem i am having.
I plays ad4 ok, converted from mp3 using somotool.
Memory card was difficult to get one working finally checked two 2gb microsd one generic, the other one, kingston. And one generic 128mb microsd also worked, all of them fat formated.
I needed to play 2 short voice sounds one after the other, but could not get it with only one module, there was a gap (about 1 second) between each sound. So i used 2 modules conected to arduino Uno in diferent pins.

Problem: I cant get the amplifier output to work, when i connect the amp out to the amplifier,after inserting a 0.01uF between module output and amplifier input, i get a static noise in high volume and the voice sounds in a very low volume over the static.
Do you know which could be the problem?
Could I use the speaker out as amplifier input? Or I would damage the amp input?

Thanks!!!!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: himijendrix on Aug 11, 2014, 09:35 pm
I got it working, and directly connected the module to the Arduino 3,3V Output and the digital Pins set in the program. 
The SD Card is a cheap 64 mb from my cellphone formated to FAT.
The files are wave (Mono, 16 bit, 12 khz (16 khz didnt work and caused a "chopper"-like noise).

What I don't get is what the difference between
wtv020sd16p.asyncPlayVoice(0); and
wtv020sd16p.playVoice(0);
with both modes I can do things, blink Led's ... while the sound is playing. What is the difference?

I was hoping to be able to play two sounds at the same time, or at lease pause one sound, play the second an than continue.
But this isn't possible, right?

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Cynder on Sep 08, 2014, 11:37 am
?Hello,

I tried this tutorial but no sound are played in the B mode (with arduino) (two line serial mode).
I've used the arduino code and library indicate in this forum (the program run and the serial console indicate the sound should be played) but no sound.
I think the wtv020sd-16p module stay in mp3 mode and don't want run in two line serial mode.

The MP3 mode work properly on my wtv020sd-16p module (without arduino) (MP3 Mode). But not the two line serial mode of this tutorial...
I've verified all the wire...


Some idea of the issue of this problem ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Hagga on Oct 19, 2014, 09:38 pm
Hey guys!

I got this module last week and I have some issues with it.
When plugged in MP3 mode where I only use Arduino UNO to supply power it didn't work with 3.3V pin but played alright (with all the buttons working) with 5V which shouldn't happen. I am using 32ohm 0.25W speaker, maybe that's why? But then again, I plugged some earbuds to it and again it was only working with 5V connected to it.

When I connect the device in 2 pin mode, I only get a "click" sound when playVoice functions are being called, but get no music whatsoever(neither 3.3V or 5V plugged). I get a strong feeling that it's not receiving a right command and tries to play a file that doesn't exist. I have ad4 files names 0000, 0001, 0002 etc, I was using the test files and my own but to no avail...

I hope any of you have some more ideas :(

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: giulianomx on Oct 30, 2014, 08:08 am
Hi,

I got the Sparkfun WTV020SD and it plays sounds in stand alone mode but not when hooked up to the micro controller.

I don't think is a MicroSD card issue, otherwise it wouldn't work at all, right?

Thank you
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Serhat on Nov 13, 2014, 03:02 pm
Hi

I can playing  MP3 mode that wtv020 SD mini module.

http://www.ebay.com/itm/U-disk-audio-player-SD-card-voice-module-MP3-Sound-module-WTV020-SD-16P-Arduino-/310629013078?pt=LH_DefaultDomain_0&hash=item4852ee9656

(16 Pin module Pin1 is Ground,Pin8 is +VDD ,Pin3 and Pin4 is Speaker connections)

But I don't playing with software still

My project for blind people's color identifier and spoker device.First step is working and color sensor is recognize with arduino
But I am working nearly one month for that simple job

I am learning  I2C protocol in from that  china module
if you help me for code also you will help to blind peoples too.

in your codes:
if you random 1 to 10 values and if you show in serial monitor that value
and if you read that values sound (AD4 file) from SD cart I will  happy

Please help arduino pin connections too

Regards
 

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Serhat on Nov 15, 2014, 09:03 pm
I had try at first page library too
over 400 people see my last message but nobody don't say anything.

if a firm's have  product  it must be good support too.I had send an mail (not e-mail) to Sony Corporation 39 years ago I had receive  one page reply, after 15 day  .

Big firm's have big boss too.

Yes I don't know I2C protocol and C language  but I want learn and have not any sample code or tutorial that software for like in first message example

is very hard for a firm or I am asking very sopisticate Know-how question?



bye









Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: himijendrix on Nov 23, 2014, 04:47 pm
Some things I found out while playing with the WTV020SD:
- I didn't manage to play WAV files. Only AD4 (16kHz or 32kHz) did work.
- The module works at 5V for me with the jumper set.
- You better put a 0.1uF coupling capacitor at the Audio Output (Pin 2) to avoid loud "ticking" when switching between sounds.

- I need two delays. Without them it lock up or skips the track.

My idea is that without the first delay the busyPin is not completely HIGH and so the while() loop is skipped. I guess this is because its a 3.3V Output connected to the 5V Arduino Input.

The second delay might be needed because after finishing and closing one track it maybe needs some time to accept new commands...

Code: [Select]
  wtv020sd16p.asyncPlayVoice(1);
  delay(15);
  while (digitalRead(busyPin) == HIGH) {
    //do Stuff here
  }
  delay(10);


Do you also have these problems?

Unfortunately the WTV020SD Datasheet is really bad (probably a small Chinese manufacturer). So there are rather experiences than facts about this module...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: rysium on Dec 01, 2014, 08:47 am
First of all big thanks and kudos to Diego J. Arevalo for putting together the library.  It was a great starting point to play with WTV020-SD-16P audio module.  

However there are two thing incorrect in this cpp code:
1. at the end of each loop in "sendCommand" there is 2ms delay after each bit is sent.  This 2ms stop bit should be sent after entire message is sent
2. the timing does not account for digitalWrite taking about 5us so there are at least 15us added to each clock pulse.

Because of this problems the "sendCommand" takes over 50ms to execute.  It was not acceptable in for my solution where I needed to do precise timings on each sound clip (fishing boat sound for RC model).  I have corrected both issues and the "sendCommand" now takes absolute minimum required for transmitting 16 bits.  I have also added "setVolume" function and fix "unmute" function to restore the volume level from before "mute".

Anyway, here is the entire library attached (including updated example and three sample ad4 files used in the example).  

@ the-rebel-agent - feel free to update it in your first post in this thread if you wish.

Ryszard.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: enfix86 on Jan 08, 2015, 03:28 pm
Is it possible to stream audio generated from this module via bluetooth to my headset ?
Which other module I need ?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Goldenshuttle on Jan 19, 2015, 07:28 am
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 am doing a gift box which plays four different audio phrases(files) depending on the child how close he is to the box. I am using 4pin ultrasonic with Arduino Nano and WTV020..Can you pleae help me with the code
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: danf on Jan 21, 2015, 06:20 pm
I'm very impressed with this module and the library is great. I've tried it with a  TDA7297 10-50W Dual-Channel Power Amplifier Module (http://www.ebay.com/itm/310983755405?_trksid=p2059210.m2749.l2648&ssPageName=STRK%3AMEBIDX%3AIT) and the sound is great. I'd like to connect 2 of the WTV020's to the amp since it is stereo so I can play music on one and sound effects on the other at the same time, however there is only one gnd input and 2 + inputs. Is it safe to connect the speaker - from 2 WTV020's to the same gnd in on the amp? I had earlier tried connecting 2 WTV020's to the same speaker and ended up frying both, don't want to sacrifice any more.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: adamson on Jan 26, 2015, 04:45 pm
Hello. Anybody knows good source of vtw020sd v1.5? :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: danf on Jan 28, 2015, 06:13 pm
Hello. Anybody knows good source of vtw020sd v1.5? :)
I've been getting them on ebay, just search wtv020sd.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: JCBColorado on Jan 30, 2015, 03:06 pm
Hello, I am working on a project using this module. But I still can't make it work. Can somebody help me?

The SD I am using is a SanDisk 2GB FAT format
this is the code I am using and I attached the circuit I used.

Code: [Select]

#include <Wtv020sd16p.h>

int resetPin = 10;
int clockPin = 11;
int dataPin = 12;
int busyPin = 13;


Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {

  Serial.begin(9600);
 
  wtv020sd16p.reset();
  delay(100);
  Serial.println("START");
}

void loop() {
 Serial.println("song1");
  wtv020sd16p.playVoice(0);
Serial.println("song2");
  wtv020sd16p.asyncPlayVoice(1);
  delay(5000);
 Serial.println("pause1");
  wtv020sd16p.pauseVoice();
  delay(5000);
  Serial.println("pause2");
  wtv020sd16p.pauseVoice();
  delay(5000); 
  Serial.println("stop");
  wtv020sd16p.stopVoice();
 Serial.println("song3");
  wtv020sd16p.asyncPlayVoice(2);
  delay(2000);   
   Serial.println("mute");
  wtv020sd16p.mute();
  delay(2000);
   Serial.println("unmute");
  wtv020sd16p.unmute();
  delay(2000);   
  Serial.println("stop3");
  wtv020sd16p.stopVoice();
}

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: JoyMonkey on Jan 31, 2015, 03:41 pm
Apologies if this has already been mentioned, but with the module dated 2012.01.12 what does the 5V/3.3V solder jumper on the module actually do?
I understand that this module works best with about 3.6V, and that two IN4007 diodes can be used in series to bump 5V down to around that. If I solder the jumper over to 5V would these two external diodes still be needed? Or are they included on the module now?

(http://gif.datasheetbank.com/image/ETC/WTV020M01.gif)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jonrosales2004 on Jan 31, 2015, 05:54 pm
Hi, really good work on the code, do you know if there's a way to manage all the sounds with the arduino but be able to change the volume with two push buttons?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Domino60 on Feb 03, 2015, 07:42 pm
Hi, I just took an WTV020 and tried to make it work without an arduino, just plug and play.
(http://pix.my/Ey3E2j9u)
I follower internet tutorials like  this one
http://www.buildcircuit.com/how-to-use-wtv020sd-music-module-with-arduino/ (http://www.buildcircuit.com/how-to-use-wtv020sd-music-module-with-arduino/)

and i even downloaded their *.AD4 files.
I plugged a speaker 3.3v, GND and a led, tried to make it play with a button or just touching the pin 9 with GND and nothing, I changed SD Cards 1gb ,2gb..etc ever format them in FAT, FAT32, NTFS. I tried everything
theres no coming sound outside the speaker, I ever changed the polarities of the speaker. I pluged out the speaker and put a low voltage led in the speaker ping just to look if there is coming outside any kind of signal (blinking led) and nothing.

that WTV020 start piss me off because i took it for a project and it's pain in the a*s.

Is there another module that is ready Plug and play without any problems sd-cards, audio file format..etc ?

I need just a f**ing simple module that gonna play mp3, wav from a sdcard and that's it not to work on it 10 hours and have no results
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Olmer on Feb 05, 2015, 11:32 am
Hi! registered here because can't start the module during 2 last days. I think it is fake or failed the test samples. I buy it from here:  http://www.ebay.com/itm/310629013078?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

and second from here: http://www.aliexpress.com/item/WTV020-SD-Voice-Module-MP3-Sound-Module-U-disk-Audio-Payer-SD-Card-For-Arduinon-Free/1789995274.html

As we see on photo modules with that kind of inscription, but they send me modules with different inscriptions like this: http://www.aliexpress.com/item/1pieces-lot-XD-10-WTV020M01-WTV020-SD-voice-module-SD-card-voice-module-video-game-voice/1809251467.html

I noticed that all who start this module succesfully use this modules like in first two links, where  we see
"WTV020-SD-mini" instead "WTV020M01 V1.00".
Sorry for my english.


 
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Domino60 on Feb 06, 2015, 08:52 am
I came here for the same reason my WTV is not working maybe is damaged not sure.

Few questions :"

1) What's the maximum wattage speaker that i can use with this module without an amplifier?
2) Does the SanDisk SD-Cards work for this module?
3) They work only with *.AD4 format and if yes that's the details that i can use for example the Hz..etc?


I use a 3W speaker without an amplifier so i think that's why i can't hear the sound coming out so as in my "1)" question is what the max wat speaker i can use.

I hope i will get some answers.

Thanks
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: kiwisincebirth on Feb 24, 2015, 02:28 am
Problem and Solution:

When I first attempted to get a WTV020-SD-16P to work, I like many people had issues. I tried several board and several 1/2GB microSD cards, until eventually it worked, but not sure what the magic was, put it down to voodoo.

The Problem:

However a discovery (from a like minded builder) is that the SD Card Pin 6 (on the board) is not properly connected. The Spec (for Pin 6) says that it should be connected to GND, but it isn't!!! at least not in the boards that we tested. 

The solution:

The solution is to connect a wire from Pin6 of the SD Card socket to Pin 8 (GND) of the sound module. As I said I cannot take credit for discovering this. See this post showing the wire that was added.

http://www.tonymacx86.com/imac-mods/130197-mactester57s-imac-g5-17-a1058-model-7.html#post986109

And here is the same modification I did to my own board

https://www.dropbox.com/s/ncp4wbbuirimjem/IMG_3512.jpg?dl=0

The question is: Is this a design/production fault present in all boards? or just isolated to some boards?

Can anyone test their boards, by using a multimeter to check for continuity between Pin 6 (SD) and Pin 8 (module), and report back ?

If after making this modification can anyone report success with SD cards other than the limited once that are known to work ?

Thanks.




Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ozzie2005 on Feb 28, 2015, 08:11 pm
Problem and Solution:

When I first attempted to get a WTV020-SD-16P to work, I like many people had issues. I tried several board and several 1/2GB microSD cards, until eventually it worked, but not sure what the magic was, put it down to voodoo.

The Problem:

However a discovery (from a like minded builder) is that the SD Card Pin 6 (on the board) is not properly connected. The Spec (for Pin 6) says that it should be connected to GND, but it isn't!!! at least not in the boards that we tested. 

The solution:

The solution is to connect a wire from Pin6 of the SD Card socket to Pin 8 (GND) of the sound module. As I said I cannot take credit for discovering this. See this post showing the wire that was added.

http://www.tonymacx86.com/imac-mods/130197-mactester57s-imac-g5-17-a1058-model-7.html#post986109

And here is the same modification I did to my own board

https://www.dropbox.com/s/ncp4wbbuirimjem/IMG_3512.jpg?dl=0

The question is: Is this a design/production fault present in all boards? or just isolated to some boards?

Can anyone test their boards, by using a multimeter to check for continuity between Pin 6 (SD) and Pin 8 (module), and report back ?

If after making this modification can anyone report success with SD cards other than the limited once that are known to work ?

Thanks.





Hi kiwisincebirth,

So you think you fixed it after adding GND to the SD card or you are not sure what fixed it? Can you disconnect the GND wire and check if it still works?

thank you.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Domino60 on Mar 01, 2015, 03:39 am
Quote
So you think you fixed it after adding GND to the SD card or you are not sure what fixed it? Can you disconnect the GND wire and check if it still works?
I'd like to know that too because i spend many hours trying to make it ever get out a bip but nothing
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: husky1976 on Mar 01, 2015, 06:45 pm
For me, this module is playing the supplied audio files, as advertised, and it's working with a 2G SanDisk card formatted to FAT 16.  Doing the requisite RTFM, in the fragmented English pdf, it claims a DAC and a PWM output.  I see the analog on the speaker channel, but nowhere can I find or manage to generate the PWM that I'm looking for.

Anyone, anyone?

thanks,

gene
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: kiwisincebirth on Mar 02, 2015, 02:40 am
Hi kiwisincebirth,

So you think you fixed it after adding GND to the SD card or you are not sure what fixed it? Can you disconnect the GND wire and check if it still works?

thank you.
It is hard to remember how and when it was initially. I purchased a WTV module and a single (sands) 2GB SD card, and could not get it to work. I then purchased a second module, and a 1GB (sandisk) card. It was at this time I finally got it to work.

Then I soldered the wire, and now every combination of card and module work for me. I actually don't want to undo the soldered wire to re-test further, that would be a backward step (for me)

If someone was stuck in the position where they couldn't get it to work, if they tried this, then I was hoping for them to report back here. I don't have any other no-name SD cards (that I can find) to test it on. And also I have seen post saying that the SD can can be rendered inoperable (killed) by inserting into the module.

The issue that was discovered (no GND connection to the SD), should actually mean that the module could never work, somehow it manages to work with the Sandisk cards is an electrical miracle.

See also this post, where the information came from.

http://www.mikrocontroller.net/topic/345527#postform
<German Site - See Post in December 2014>

31 12 1GB
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jthefreak on Mar 06, 2015, 11:28 pm
Hi kiwisincebirth,

I just received my module last week, and sure enough, pin6 of the sd card was not gnd!
I added the mod wire, the the module works (stand alone)
I'm using a 1gig kingston micro sd.

I have another 2gig sd somewhere... I'll try that one out as well.
EDIT - I just tried a 2gig sandisk - works fine as well.
ps. using the 3.3v output from a MEGA for power in case anyone is interested.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Domokunchinta on Mar 10, 2015, 11:54 am
Hi Guys, to Mr. Rebel agent thank you for sharing this. To everyone, I will just ask if it can be control using serial monitor, as typing in serial monitor can make it play, pause, stop , next and prev, and if possible can this library or the module itself can be volume+ and volume- using serial monitor? Can you teach me the code? I'll appreciate your response. Thank you in advance   :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sharbon on Mar 12, 2015, 04:26 pm
Can I use wtv020-M01 instead of wtv020-sd-16P?
And what's the differece between wtv-sd-16P and wtv020-M01?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jksemple on Mar 14, 2015, 07:04 pm
I have several of these Chinese WTV020 modules. They all work just fine and none of them have a short between the module's GND pin and pin 6 of the SD card socket. I couldn't understand why they still work when there appears to be no GND connection to the SD card, so I've inspected the PCB with a magnifying glass and traced the connections.  It appears that pin 6 of the SD card goes through the board to the underside and connects to the collector of a surface mount NPN transistor labelled J3Y (or Y1 on one of mine).  The emitter is connected to GND and the base is connected via a 10k resistor to the BSY pin of the WTV chip.  So it looks like the SD card power is only applied when the BSY pin of the WTV chip goes high. The SD card is disabled when the BSY pin is low.

Shorting pin 6 to GND directly probably won't do any harm but it will cause the SD card to be powered when it doesnt need to be.  It certainly doesn't seem to be necessary to get these modules working. 

I have another WTV020 based module from Embedded Adventures where SD card pin 6 is connected directly to GND so modules vary.

If people have problems getting them to work there are other more likely problems to address:
- I found they are a little sensitive to the type of SD card used - they must be the old style SD cards not SDHC or SDXC so 2Gb is the max although you're unlikely to need more than a few MB.  Just one of 30 cards  I have would not work.
- The type of sound file is much more of an issue. They play WAV files quite happily but not if the bit rate is too high. I found they will reliably play mono sounds recorded in Audacity at 8kHz sampling rate which Windows Explorer shows as 128kbps. However they do play some sound effects that have higher sampling rates. I haven't worked out what the critical factor is.

Hope this helps

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jksemple on Mar 14, 2015, 07:08 pm
A further thought on my post above... As the SD card is being powered via a transistor it will see a voltage that is about 0.6v less than the voltage supplied to the module.  So if the module is powered with 3.3v the SD card will see about 2.7v.  This is the minimum voltage that the SD card spec says should work. This might be why some SD cards don't work so well and why some people have better results if they up the supply voltage a bit. It's also going to be important to make sure the supply voltage doesn't fade when the module draws higher currents. Providing a separate 3.3v regulated supply and a big smoothing capacitor across the module's supply pins will help.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ozzie2005 on Mar 28, 2015, 05:14 pm
It is hard to remember how and when it was initially. I purchased a WTV module and a single (sands) 2GB SD card, and could not get it to work. I then purchased a second module, and a 1GB (sandisk) card. It was at this time I finally got it to work.

Then I soldered the wire, and now every combination of card and module work for me. I actually don't want to undo the soldered wire to re-test further, that would be a backward step (for me)

If someone was stuck in the position where they couldn't get it to work, if they tried this, then I was hoping for them to report back here. I don't have any other no-name SD cards (that I can find) to test it on. And also I have seen post saying that the SD can can be rendered inoperable (killed) by inserting into the module.

The issue that was discovered (no GND connection to the SD), should actually mean that the module could never work, somehow it manages to work with the Sandisk cards is an electrical miracle.

See also this post, where the information came from.

http://www.mikrocontroller.net/topic/345527#postform
<German Site - See Post in December 2014>

31 12 1GB
Hi kiwisincebirth,

Sorry for the late reply. I did indeed find the missing ground as you suggested. I soldered the wire and at least I can hear music this time but not the complete song. It stops after approx. 20 seconds of starting playing the song. It partially works this way  for the following memory cards: one 2G Sandisk and one 2G Kingston cards. It does not work for another 2G sandisk card. They are all being formatted the same way and they all also use the same files. I have no idea what the problem is. I guess I would have to look for a similar module that plays some audio for Arduino.

thank you.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ardianet on Mar 29, 2015, 07:25 pm
Hi,
First of all, thanks for The-Rebel-Agent for writing up the library. I think most people using WTV020 with Arduino are using the library, including me. :)

Secondly, I want to share my experience with the module :
At first try my WTV020 (marked : WTV020M01, V1.00, 2012.01.12) didn't play or outputing any sound. Read from previous post that several WTV020 module playing only .wav file. So I took the .wav file from the 1st Medal-Of-Honor game.. still no sound played. So I re-check the wiring, and whallaa.. my jumper cable that connect to ground pin is a bit loss. After changing the cable, the module start playing choppy sound..  I try to convert it to .ad4... and now the module is playing the sound.

I'm using "generic" V-Gen 2GB Card. Here's the step :
- Rechecking the wires.
- Formatting my SDCARD with : SDFormatter (turn into FAT (only) Format)
- Coverting the .mp3 files to ad4 with : 4D-SOMO-TOOL , renamed the file with 000x.ad4
- Upload the exact code at the first page of this thread, hear the sounds.

Third, the problems :
1. I need to add delay(10) between played files to have complete sound. Is there a way to play the files  in sequent without using delay() command ? (using millis perhaps ??)

2. There are "Click" sound on every start & end of sound played. Any info how to remove that click sound ? is it because of the .mp3 to .ad4 convert process ? some say adding coupling transistor could vanishing the click sound, is it true ?


Regards
   
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: mweber on Apr 06, 2015, 10:52 pm
All those who are having difficulties, check out this wiki:
http://matthew-morris.com/wiki/index.php?title=Wtv020-SD-16P#Picaxe_Serial_Mode_Notes

I found it extremely useful.  In particular the timing modifications for the library also worked for me:
Give it 750msec after reset (not 300msec as in the spec sheet).  Library line 37.
Also, the BUSY line doesn't respond immediately, leading to playVoice starting, then stopping and restarting, after a reset.  The change to 50msec in line 94 fixes that.

I also found that calling   
wtv020sd16p.stopVoice()
after each playback (synchronous or asynchronous) is necessary for the next playback to reliably start.

My module says V1.00.  I am running it with a SanDisk 1 GB card.
I did not have to connect the SD card pin 6 to Ground.
At first, it didn't seem to be working in the stand-alone playback mode.  Briefly shorting the NEXT or PREV key seemingly unstuck it.  Maybe it has to do with the module remembering the file (voice) it previously played or something weird being in there as factory default.



Good luck,
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: black_angel1 on Apr 10, 2015, 12:01 pm
Hi all
I bought WTV020-SD-16P U-Disk Audio Player SD Card MP3 Voice Module
from one china web

i have kingstone 2GB Micro sd card

and its not working

the module is
WTV020M01 V1.00
2012.01.12

i was trying 5V and 3.3V same result

i conected the module to arduino mega like
(http://farm9.staticflickr.com/8093/8544386987_83055418c3.jpg)

i connected earphones to it and i can hear some noise by pushing the next / previous button
and some noise like is searching on the card
I think the problem is the sd card but maybe i am wrong
i dont have another sd card to compare
i just want to know if other people which have problem with the card have same experience

the SD card is formated to FAT(FAT16) and also tried to change the size to 1GB

sorry for my English
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ardianet on Apr 10, 2015, 03:41 pm
Hi all
I bought WTV020-SD-16P U-Disk Audio Player SD Card MP3 Voice Module
from one china web

i have kingstone 2GB Micro sd card

and its not working

the module is
WTV020M01 V1.00
2012.01.12

i was trying 5V and 3.3V same result

i conected the module to arduino mega like
(http://farm9.staticflickr.com/8093/8544386987_83055418c3.jpg)

i connected earphones to it and i can hear some noise by pushing the next / previous button
and some noise like is searching on the card
I think the problem is the sd card but maybe i am wrong
i dont have another sd card to compare
i just want to know if other people which have problem with the card have same experience

the SD card is formated to FAT(FAT16) and also tried to change the size to 1GB

sorry for my English
Hi,
I'm using MEGA 2560 too. But now I'm using it with (DIY) WTV020 shield on UNO.
My WTV020 is connected without Prev / Next Button & LED.
Just connect the (WTV020) : Pin 1 (Reset), Pin 4 & 5 (Speaker out), Pin 7 (Clock), Pin 8 (Ground), Pin 10 (Data), Pin 15 (Busy), Pin 16 (Vcc, 3.3V) to Arduino.

If there's no sound played, first re-check the wires, always re-check the wires.  ;)
For hearing the sound played I'm using 3-feet-female-connector (which 2 feet connected to pin 4 & 5, & 1 feet to GND).

Secondly check the file type (.wav / .ad4) & name (use 4-digit-3-type, ex. : 0001.ad4, 0002.ad4, 0510.ad4).

You could read my post at #270 for other supporting tools.

Regards
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: jthefreak on Apr 10, 2015, 03:43 pm
Hi kiwisincebirth,

Sorry for the late reply. I did indeed find the missing ground as you suggested. I soldered the wire and at least I can hear music this time but not the complete song. It stops after approx. 20 seconds of starting playing the song. It partially works this way  for the following memory cards: one 2G Sandisk and one 2G Kingston cards. It does not work for another 2G sandisk card. They are all being formatted the same way and they all also use the same files. I have no idea what the problem is. I guess I would have to look for a similar module that plays some audio for Arduino.

thank you.

Try reducing the level of your music before converting it to .ad4. I had the same problem, and believe I was overloading the very small amp in the wtv - I noticed the volume was higher in my music, compared to the example songs. I reduced the level in Audacity, and reconverted and it played fine.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Dr_Ugi on Apr 24, 2015, 04:17 pm
Hello all

Firstly:  A big "thank you" to the-rebel-agent and all who have contributed to this thread.  I have used and referred to many of the posts to make progress with these little devices so thanks to you all.

I have been putting together a small kids' project with these so I have had to find a system that works reliably rather than just as a one-off.  What I have found is as follows:



I have been using a v1.0 board at 3v3 for this testing.  Although I have largely tested SanDisk cards, I strongly suspect that the differing behavior suggests some to be fake so it is likely that other cards will behave the same way.  I will test some more shortly and report if I find any difference.

Cheers

Ugi

Update: Having tested several more cards, the same rule applies - unbranded flat-back cards all work but require P6-gnd.  The only exception so far is a genuine Samsung which was flat-back but worked without the ground short. Ugi
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sharbon on Apr 25, 2015, 09:35 pm
I have made a project with this mp3 module.. The sound is clearly good :)

https://www.youtube.com/watch?v=uNUr57VZXYM&feature=youtu.be
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: kolban on Jun 06, 2015, 01:29 am
Is there a GitHub or other open source repository for the library?  I understand it is available for download on the 1st page of this thread but would like to know if I am using the latest and greatest and GitHub is a great place for learning that kind of thing.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: nahueldiaz360 on Jun 10, 2015, 03:50 am
hello friend .. me you could leave a small example of the structure using the Arduino program in conjunction with WTV020 .. thanks greetings
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: joho65 on Jun 11, 2015, 04:26 pm
Hello!
First, I am German, so have only Tech-Speak English.
As I want to play with this (for a speaking Clock), I made any Investigations.
To avoid any Problems with Powersource, I made an reverse Engeneering on this Chip.
I want to know, how this Things go together. And I was share this to the Community.


On the PCB is a Place for an 5V to 3,3V Linearregulator, but not on Board.
I will take an MIC5205. Then You can drive this with 5V. I will do so.

The Transistor left make GND for the SD-Card, but only, when the BUSY -Signal is high!
That makes Sin for Energymanagement (Battery Live). But it can too have
Influences for the behavior of the SD-Card (Hard Reset). This can be useful for
the Timings in the Library.
greetings Jo
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Botyard on Jun 17, 2015, 03:41 am
Is this the proper way to use the code from the library to test the playback of audio track 0000.ad4...

Code: [Select]
void loop() {
  //Plays synchronously an audio file. Busy pin is used for this method.
    wtv020sd16p.playVoice(0);
}
}


It seems I have everything correct but my speaker is only outputting a strange sine wave type beep with a half second gap between playing, and the sound is very, very low. Without having to order a bunch of SD cards to test, does anyone know what's going on here?

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: webjoe on Jun 26, 2015, 04:24 pm
Hi,

I was wondering if this module can simultaneously play sounds

(eg 5 buttons with different sounds to be performed at the time we want,
as a simulation program of a multi track where a sound would play together with other

the ways of playing audio I've ever done with volume, Next, Previous, etc.

Tanks
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Jocke73 on Aug 14, 2015, 07:35 am
Hi,

also for me the fix to connect pin 6 to GND worked. The module now works fine with my no-name 2GB SD-card.

/Jocke
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Bamdad on Aug 25, 2015, 10:25 pm
hi
can anyone give me help?
I want to convert my mp3 files to ad4 for this thing... how can I???
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: ardianet on Aug 26, 2015, 12:35 am
hi
can anyone give me help?
I want to convert my mp3 files to ad4 for this thing... how can I???

You can use 4D-SOMO-TOOL.

Download it here :
http://www.4dsystems.com.au/downloads/Software/SOMO-14D%20Audio%20Converter/4D-SOMO-Tool.zip
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Caladonis on Sep 17, 2015, 02:40 pm
These little modules still are a great value and I find the very best way to get them working is get it to the bare minimums in stand alone mode without the arduino. If it wont play in stand alone, it wont work with the arduino. You only must have +3.3v, gnd, speaker and a ground point to use on the play (pin 9) and next/previous (pins 12 and 13). I'm not saying how long I worked because the SD card gets tight before it actually locks in place  :-[ 


My question is has anyone used two of these modules and being controlled by one arduino? I really don't want to go to a wav trigger card just so I can have two independent channels, one for background music/ ambiance sounds and one for triggered events/effects. Two of these with SD cards are still a fraction of the cost of a wav trigger that is overkill for my application.

Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Domino60 on Sep 18, 2015, 05:12 pm
The WTV020-SD-16P audio module it's waste of money, you need a lot of work to do making it work.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Goldenshuttle on Sep 27, 2015, 09:43 am
The WTV020-SD-16P audio module it's waste of money, you need a lot of work to do making it work.
I tend to agree with you. Wasted so much valuable time.
why they did not make it mp3.
who wants to waste time on AD4 and software and all this stuff?
waste of time and money..add 1$ extra and move to new modules..just to name:
LMD102
JQ6500
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Amator90 on Nov 21, 2015, 10:48 pm
I finally got this module work. Now I have another issue to solve. Could you please give me a hint how to play specific file? For example:
If condition X
then play song 0012.ad4

Thanks for any advice.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Tomasina on Dec 02, 2015, 12:24 pm
I finally got this module work. Now I have another issue to solve. Could you please give me a hint how to play specific file? For example:
If condition X
then play song 0012.ad4
wtv020sd16p.playVoice(11);
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: lalufendy on Jan 13, 2016, 08:05 am
WTV020-SD-16P audio module:

(http://images.hellotrade.com/data/0/J/MY-1201704/IMG_0049_250x250.jpg)

This is my first contribution for the Arduino community. With this library you will be able to play wav or ad4 files easily. Will be adding new method or features in the future. Built this cause I need it for my Arduino project.

Code: [Select]
/*
 Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
 Created by Diego J. Arevalo, August 6th, 2012.
 Released into the public domain.
 */

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

/*
Create an instance of the Wtv020sd16p class.
 1st parameter: Reset pin number.
 2nd parameter: Clock pin number.
 3rd parameter: Data pin number.
 4th parameter: Busy pin number.
 */
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
  //Initializes the module.
  wtv020sd16p.reset();
}

void loop() {
  //Plays synchronously an audio file. Busy pin is used for this method.
  wtv020sd16p.playVoice(0);
  //Plays asynchronously an audio file.
  wtv020sd16p.asyncPlayVoice(1);
  //Plays audio file number 1 during 2 seconds.
  delay(5000);
  //Pauses audio file number 1 during 2 seconds. 
  wtv020sd16p.pauseVoice();
  delay(5000);
  //Resumes audio file number 1 during 2 seconds.
  wtv020sd16p.pauseVoice();
  delay(5000); 
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
  //Plays synchronously an audio file. Busy pin is used for this method. 
  wtv020sd16p.asyncPlayVoice(2);
  delay(2000);   
  //Mutes audio file number 2 during 2 seconds.
  wtv020sd16p.mute();
  delay(2000);
  //Unmutes audio file number 2 during 2 seconds.
  wtv020sd16p.unmute();
  delay(2000);   
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
}


Unzip Wtv020sd16p.zip and copy Its content into the Arduino library IDE folder. If you have any question or request, please don't hesitate in contact me.

Update: August 6th.
Added pause, stop, mute and unmute method as well updated the example program. Hope this helps.
i am sorry, i am no expert speak english..
i have a question..

i want to handle file music(ad4) in wtv020 modul,,,,
my plan i want use capacitive sensor in arduino for playing music in wtv020...

can u help me..
example : if i touch sensor capacitive then song (001) is play...
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: katonafull on Jan 26, 2016, 07:31 am
The library or something isn't work aright for me with the WTV020-SD-16P audio module.
If i use this simple code and I use delay before the playing... the song starts playing, but after some seconds (1-2) it will restart:
But it does not have to be so.
I tried this with an other module too. The result is the same.

Code: [Select]
/*
Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
 //Initializes the module.
 wtv020sd16p.reset();
}

void loop() {
 //Plays synchronously an audio file. Busy pin is used for this method.
 wtv020sd16p.playVoice(0);

}



What are you think, what is the problem?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: kalata23 on Feb 09, 2016, 10:28 pm
Guys, I have that module WTV020m01.. I tried to turn it on with push buttons instead of arduino. It couldn't play .ad4 files, nor wav. I tried everything, lowering down the records volume and so on.. I tried to connect the 6-th SD CARD pin with 8-th of the module, it didn't work also. My SD card is 2GB, I dunno what is the manufacture, but THE SOLUTION WAS FORMATING THE SD-CARD INTO FAT(DEFAULT) FORMAT SYSTEM. When the module didn't work, the sd-card was in fat32 system, but after formating the card again in just FAT i worked perfectly.
I hope that works for most of you too.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: nishu123 on Feb 24, 2016, 01:21 pm
hi..how can we know wtv020m01 module is working or not?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Dr_Ugi on Mar 09, 2016, 12:58 am
Thanks again to all who contributed to this thread - I used the WTV module in a pong/invaders game project I did with my kids and some of their friends (see below).  Your comments on this thread were invaluable in making the sound work reliably for the kids:
(http://ugilabs.co.uk/Scrap/Inv.JPG)

See This Instructable (http://www.instructables.com/id/Handheld-Pong-Invaders-on-the-Cheap-Arduino-Compat/) if you're interested.  I know lots of well-respected posters here don't rate instructables, but the way to change that is to post some good ones!

Ugi
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Sleepingshorty on Mar 26, 2016, 10:37 pm
HI@all.

Thank you for the library. I added the function "setVolume" with Levels from 0 to 7 as it is written in the datasheet. It is working fine until I use a volume level of 4 or less.

Then the sound volume varies and there is some hiss.

Any idea?

Here is what I did:

Code: [Select]

//Volume 0 to 7
void Wtv020sd16p::setVolume(int volumeLevel){

  switch (volumeLevel){
 
  case 0:
  sendCommand(0xFFF0);
  break;
 
  case 1:
  sendCommand(0xFFF1);
  break;
 
  case 2:
  sendCommand(0xFFF2);
  break;
 
  case 3:
  sendCommand(0xFFF3);
  break;
 
  case 4:
  sendCommand(0xFFF4);
  break;
 
  case 5:
  sendCommand(0xFFF5);
  break;
 
  case 6:
  sendCommand(0xFFF6);
  break;
 
  case 7:
  sendCommand(0xFFF7);
  break;
 
  default:
  break;
  }


Thank you. :)
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Antsette on Apr 12, 2016, 10:34 pm
Is there a way for me to access and play a specific file via the arduino?

Is there a way for me to initiate a skip, or previous or such via the arduino?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: himijendrix on Apr 20, 2016, 11:00 pm
Good evening,

I have two older projects in which I used the WTV020 module and it always has been a nightmare.
I play rather big files with it (> 1 hour) and one important thing regarding sound quality is the decoding process. WAV Files (12 kHz, 16 bit) work and quality is okay BUT a loud periodic "pop/tick" sound will occur.

So it has to be AD4. Most people use the "UsbRecorder" recorder Software and honestly I didn't find any alternative for this. Audacity can encode to ADPCM (which is what the AD4 file is encoded to) but the only result you get is noise and very distorted audio. Maybe it's a problem with the header file.

Best practice for me is:
1) convert to 12 or 16kHz, 16bit Mono WAV
2) normalize it to -4 dB, which seems to fix the problem that sometimes the audio starts to hang -->
But that still has to be investigated further. I read about it in other posts.
2) convert to AD4 using the USBRecorder

When using 32kHz as sample rate either the AD4 Encoder seems to produce errors or the WTV020 has a problem with 32kHz. Volume starts to change randomly and audio distorts.

other useful things (most have already been mentioned here):
- delay(1000); after wtv020sd16p.reset();
- delay(xxx) before reading the busy Pin (LOW == playing file). The delay time also depends on your hardware layout.
- Low Pass Filter (~100nF/~100ohm) and coupling capacitor (~1uF) on the audio output

the SD is a samsung 2gb...

Ciao!
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: scrato on May 12, 2016, 12:30 am
Hi, am trying to figure out why I can't make this happen with arduino. I can play songs when I bring GND on PLAY/PAUSE (in fact it is, PLAY/RESTART), but with arduino library I really can't do anything. I even found some code for AVR, and that one also doesn't work. I am pretty sure I missed something obvious, some quick action that makes serial connection active or something...
I connect sparkfun wtv020sd with schematic from datasheet, but i am not sure in anything anymore.
 :smiley-eek-blue:
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: himijendrix on Sep 26, 2016, 10:04 pm
@scrato
It is almost impossible to help you, when you don't provide any understandable information (schematic, code ...). Read through the previous posts, try adding a delay after wtv020sd16p.asyncPlayVoice(xxx);


Here is a good report on using the module (in German) and even an alternative AD4 converter.
http://makeithappend.org/de/archives/2247
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Torzomborz on Oct 16, 2016, 12:08 pm
@himijendrix

I am trying to develop a coffee vending machine for nespresso coffee capsules. Previously I was selling these capsules for colleagues using a honesty box, unfortunately  it did not fulfill its purpose so now I am going to use a light sensor for a box with a lid, a plush figure and a "Cat Steal Money Coin Saving Box" together. The plush figure is going to scream and say some bad sort of things about cheating and stealing if people open the box without paying. Unfortunately the hidden speaker in the plush figure was not loud enough so I decided to use the pin 2 of WTV020-SD-16P module with a LM386 Audio Amplifier.

I had a click sound every time when a sound file was played and stopped but that one is sorted with a coupling capacitor, however I still have some annoying noise when the sound files start to play for a few seconds and a chopper like noise in the background all the time. Both things are bad enough not to accept this setup.

When you talk about the

"- Low Pass Filter (~100nF/~100ohm) and coupling capacitor (~1uF) on the audio output"

do you mean the pin 2?

How are "low pass filter" and the "coupling capacitor" applied exactly? Do you have a schematic? A hand made one would do.

Thank you.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: himijendrix on Oct 20, 2016, 09:08 pm
Hi,
I think i know this chopper-sound ;)

Last time I used this converter (scroll down the page) and it worked much better than before.
http://makeithappend.org/de/archives/2247
It applies some normalization and converts it to the best possible format.
There is also has another arduino-sketch for controlling the the wtv020.

At first I also used an pam8403 (small digital amplifier) but it resulted in very loud background noise and this chopper-sound. I tried pin 2 and also the speaker output pin 4/5. I also tried to lower its input impedance by using small resistors in parallel, but it did not help.

In the end I just connected the speaker to the speaker output of the wtv020 and it worked fine, without noise.
You can try a low pass (something like 100nF/220ohm) but I think it won't help.
Maybe it's Nestlés bad Karma that's after you ;)

Actually I would never again use this module. It's cheap but all the wasted time is not worth it.

If you have a really short sound, you could also try an Arduino+PCMaudio.
http://playground.arduino.cc/Code/PCMAudio

Once I used a sound module like this, which worked very well and sounded great:
http://www.elv.de/mp3-sound-modul-msm-2-komplettbausatz.html

For small budged projects you could try one of these (I did not try them yet!):
http://www.ebay.de/itm/291646253469?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

JQ6500 which has an inbuilt (small) memory accessible by just connecting it to USB.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: drosenstein on Oct 29, 2016, 09:30 am
I finally got this to work with my Arduino and wanted to try to save the rest of the world some trouble:

1. I had no success with anything bigger than a 1GB MicroSD card, which is max size according to the data sheet.
2. Nothing worked until I formatted the SD card with SDFormatter.  No idea why - this blew my mind.
3. I found a way to export directly from Audacity with the following settings:
Mono file
Project Rate 16000 Hz (lower left corner)
File > Export Audio...
File type: Other uncompressed files
Format options
Header: WAV (Microsoft)
Encoding: Unsigned 8-Bit PCM
Save your file as 0###.wav   where ### is 000 to 511

Good luck
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Gregor6712 on Nov 13, 2016, 07:57 pm
Hello,

I have a Setup with a Leonardo and a 20x4 LCD Screen and some analog and digital Inputs/outputs . This all works fine. Now I want to add the WTV020 - sound module for sound generating.

I have wired everything as described. I have tried to enter the code for the WTV020 into my sketch, but this does not work.

Without changing anything on the hardware I can:

- run my sketch which drives the LCD and everything is fine

OR

- run Your sketch and the WTV020 runs fine

But I can never combine both. As soon as I enter this line:

 Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

my LCD does not work. I assume this is some Kind of interference in the I2C bus?

Some help would be appreciated.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Gregor6712 on Nov 14, 2016, 03:23 pm
I did solved the Problem by replacing the Pins for the Sound module. Now it´s 8-11 and everything works fine.
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: Torzomborz on Nov 29, 2016, 11:31 am
2. Nothing worked until I formatted the SD card with SDFormatter.  No idea why - this blew my mind.

    See Dr_Ugi's post about it: http://www.instructables.com/id/Handheld-Pong-Invaders-on-the-Cheap-Arduino-Compat/step6/Prep-Set-up-the-Sound-Module-and-SD-Card/

3. I found a way to export directly from Audacity with the following settings:
Mono file
Project Rate 16000 Hz (lower left corner)
File > Export Audio...
File type: Other uncompressed files
Format options
Header: WAV (Microsoft)
Encoding: Unsigned 8-Bit PCM
Save your file as 0###.wav   where ### is 000 to 511

   What do you mean exactly by "I found a way to export directly from Audacity"? What is the background of your finding?


Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: freebird4446 on Dec 23, 2016, 04:38 am
My wtv020 will play .ad4 sample files from online perfectly for the full length of the audio file. When I play converted files, it will only play some of them for 5-6 seconds, and other for ~10 seconds, but not until the end of the clip. Has anyone resolved this?
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: sha310 on Feb 24, 2017, 09:42 am
hai did anyone have use this type of audio sound breakout (https://www.sparkfun.com/products/11125)?

could you help me on the connection with arduino uno r3
thanks for ur help in advance
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: stardust on Mar 12, 2017, 02:53 pm
I still have some annoying noise when the sound files start to play for a few seconds and a chopper like noise in the background all the time.
Hi,

has anybody found a good solution for the chopper noise? In my setup I have the same noise, when I try to use an LM386 with the Audio-L connect or or when I try to match the SPK+ pin to the LM386.

But when using a speaker directly connected to SPK+/-, there is no such noise... Seems to be related to the nature of the symmetric output...

My recent (working) solution is: 10 uF from SPK+ to a line transformer, 10 uF from SPK- to the other primary lead of the transformer. A shunt resistor in parallel. The secondary winding leads connected to gnd and a 10k Pot/LM386 respectively.

SPK+ ---||-----S II S---10k POT---LM
                        |    S II S       |
           Shunt []   S II S       |
                        |    S II S       |
SPK- ---||-----S II S ---GND----GND


But I am curious to hear about other solutions...

Greetz
Stardust
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: nothinghere on Apr 14, 2017, 11:40 am
Hi,

i got this strange noise with every ad4 file i try to play.
Tried nearly every conversion tool and settings i found.
Even the sample sounds from a few sounds didn't work.

First it plays 2-3 sec. normal and than the noise appears.
At sec. 5 you hear it starts normal and instant changes to the hum noise.

Maybe anyone had the same problem and could help.


WTV Hum Noise - Video (http://sendvid.com/r3urv640)


thanks
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: mick2004 on May 03, 2017, 06:38 pm
Hello,

I am new in this discussion board.
I have one question :

How to read name audio file by this library ?
This function is possible ?

Best Regards
Title: Re: Arduino library for WTV020-SD-16P audio module
Post by: DorinDXN on May 10, 2017, 04:09 pm
Hi all, nice to meet you :)
I just registered to post here after I found this:

---8<--------------------------------

There is also a clone of this (SOMO-4D) called the WTV020-SD-16P. Both of the modules use the same decoder chip. The chip has different "modes" that are programmed one time only, usually when purchased, and it cannot be changed. Most people will want to control the module with a micro-controller. In this case you need one programmed in "serial mode." There is also "MP3 mode," "loop mode," and two "key modes," None will communicate in the two-wire serial protocol. This is important to note upon purchase.

---8<--------------------------------

if is true, that could explain why some modules works only in MP3 mode, mine included :(

cheers,
Dorin