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

it seems it's working fine, also sound quality
what diode did u use and where did u soldered?
Logged

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

1N4007. Connected in series as you will do with two power supplies to add its volts.



5V entering to the + lead of the first diode and connecting the - lead of the second diode to the wtv.
Logged

Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

um, i think i am going to test again the board with 3volts pin and diodes
want to see if it will work better
Logged

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

I did not notice any difference in quality working at 5v or 3.3v.
Logged

Connecticut, USA
Offline Offline
Full Member
***
Karma: 6
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

It's all about the skills

UK
Offline Offline
Newbie
*
Karma: 2
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
/*
 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();
  }
}

Logged

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

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

UK
Offline Offline
Newbie
*
Karma: 2
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Newbie
*
Karma: 2
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that solved it - thanks very much!
Logged

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

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

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

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

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

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

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

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

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

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
Logged

Connecticut, USA
Offline Offline
Full Member
***
Karma: 6
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1st page second post shows how to hook up the module.  smiley-wink
Logged

It's all about the skills

Pages: 1 2 3 [4] 5 6 ... 14   Go Up
Jump to: