Go Down

Topic: Arduino library for WTV020-SD-16P audio module (Read 113 times) previous topic - next topic

hart

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


lu9jmg

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!

hart

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

hart


djole_ru

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

Go Up