Pages: [1] 2 3 ... 16   Go Down
Author Topic: Arduino library for WTV020-SD-16P audio module  (Read 94951 times)
0 Members and 1 Guest are viewing this topic.
Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

WTV020-SD-16P audio module:



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:
/*
 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.

* Wtv020sd16p.zip (3.98 KB - downloaded 2318 times.)
« Last Edit: January 19, 2013, 09:11:33 am by the-rebel-agent » Logged

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

Hi the-rebel-agent,

Hats off for sharing your experience smiley

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.



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



/Chathuranga

« Last Edit: August 04, 2012, 08:57:07 pm by chathuranga » Logged

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Updated the library. You can read about changes in post # one.
Logged

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

Nice Stuff smiley

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

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..  smiley-confuse
« Last Edit: August 07, 2012, 12:08:29 am by chathuranga » Logged

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

Bravo, Tested library and worked fine.. smiley

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

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Weird, I tested a 2gb genuine Kingston and did not work. 2gb for ad4 files is a waste of space anyway.
Logged

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

Yes. That's true. But here in my country it is really difficult to find a Micro SD with a capacity less than 2GB. smiley-sad

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.
Logged

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

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?
Logged

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

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  smiley-razz) you can find it on http://letsmakerobots.com/files/WTV020_manual_V1.3.pdf
Logged

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

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)
Logged

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

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.
Logged

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

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!

« Last Edit: August 27, 2012, 05:07:54 am by tas_tig3r » Logged

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

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
Logged

Pages: [1] 2 3 ... 16   Go Up
Jump to: