English
Español
PCBWAY PCB service

PCBWAY PCB service

PCBONLINE PCB service






WTV020-SD sound MODULE

Make it sound




What do we need?

All the prices are low due to China purchase. It's up to you wait or not.

1. One Arduino UNO (or any other) (4€-6€) LINK eBay
2. WTV020-SD MODULE (2€) LINK eBay
3. One 1w 8 ohm small speacker (1€) LINK eBay
4. LM386 amp(1€) LINK eBay
5. 1 x 1000uF, 3 x 100uF, 1 x 10uF, Electrolytic capacitors(1€) LINK eBay
6. 1 47nF ceramic capacitor(1€) LINK eBay
7. 10 ohm resistence(less 1€) LINK eBay
8. 10k ohm potentiometer(1€) LINK eBay
9. Wires, conectors, solder, soldering iron... (0€)

Un vídeo publicado por ELECTRONOOBS (@electronoobs) el



Into!

We are going to use a WTV020-SD module to play some ad4 sound files. To control the module we will use an arduino. The steps are:

- First connect the module to the arduino.
- Prepare the SD card
- Convert wav files to ad4 format and copy example files to the SD
- Inport wtV020 library in Arduino IDE and upload an example code
- Make a small amplifying circuit

STEP 1 - Arduino connections

This wtV020 module could work alone using some external push buttons to play, pause, next and previous track change. But it is a lot more intresting use it with a microcontroller for our projects. If you want to make a robot talk this should be the best and cheapper way.
These are the Arduino to the wtV020 module connections.

We can see the firt pin of the WTV020 module marked with the number 1. The pins are increasing counterclockwise so we'll have pin 16 in the other side of the module. The small groove in the module pcb always shows us the top part of it. Se we connect pin 1 of the module to digital pin 4 of the arduino. This is the reset pin. We connect pin 7 to digital pin 5 of the arduino. This will be the clock. Connect pin 10 and 15 from the module to digital pins 6 and 7 of the Arduino. This are the data and busy pins. Finally we connect 3.3 volts to pin 16 of the module and ground to pin 8. Remember, 5 volts could damage the module so be carefoul you only connect 3.3V as main power source. In this case the speacker output will be pin 4 and 5 of the wtv020 module.

STEP 2 - Prepare the SD card

It's not a fixed requierment but everybody recommends an micro - SD card of less than 2GB. First we have to format this card. Use a micro SD adapter or connect it to a pc using any device that will open it as an external storage. Once connected go to my computer and right click on the new device and click format. In the format settings choose FAT format, the default one. I've tried all the formats and this is the one that worked for me. But you could try the others if you want, maybe in your case the SD is different.

STEP 3 - Convert to ad4 sound files

Let's say we want to play a sound of our voice which was recorded as an MP3 or wav. The first thing we have to do is convert that file to a 16bits modo format or maybe record it directly with those settings. There are a lot of programs which could do that. I record my files with Adobe audition and I can export any file with a 16bits mono settings. You could use any free audio converter which have the option of exporting mono 16 bits files.

Now that you've got a 16 bits mono format sound you have to rename your file. Remember that the module only works with 0000.ad4, 0001.ad4, 0002.ad4 type of file names. So rename your file as 0000.wav. This will be first track of our SD card. If you want to ad more files just name the second 0001, the tird 0002, etc.
Now, I recommend you to create a new folder called "audio" for example in C:/ with all the user permissions. It has to be in C:/ because we will use "cmd" or comand prompt to convert our files.
Download the next AD4converter.zip file and copy the extracted file in this new "audio" folder. Copy your .wav file in the same directory as well.
You can download the AD4converter.zip here:

Now your folder should look something like this:

We have our "audio" folder inside C:/ directory and inside it is the AD4converter and our 0000.wav file.
Now go to start and type cmd and open comand prompt. Type cd .. to go back in the previous foldet till you get to C:/. Once in C:/ type CD audio and press enter in order to open the audio folder. Once in the auido folder type AD4converter -E4 0000.wav and press enter. This should convert the file and create a new 0000.ad4 file inside the audio folder.

Now you're done. Just copy the 0000.ad4 file on your pre formated micro SD card. Do the same steps for other files and fill your SD card with all the sounds that you desire.
You can download an .ad4 format example file here: . Copy this example file on your SD card in order to test that it works.

STEP 4 - Arduino code

First download the wtv020 library here: .
To install it just open Arduino IDE, go to sketch --> include library --> add .zip library and open the downloaded .zip file.



Now copy or download the code below and upload it to your Arduino. Download code sketch:


/*
 Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
 Created by ELECTRONOOBS, oct 14, 2016.
 */

#include "Wtv020sd16p.h"

int resetPin = 4;  // The pin number of the reset pin.
int clockPin = 5;  // The pin number of the clock pin.
int dataPin = 6;  // The pin number of the data pin.
int busyPin = 7;  // 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() {
  ///////////////////////////////////////////
  //This are all the functions for the WTV020 module
  //Use yours and delete the others
  //Each function is explained
  ///////////////////////////////////////////
  
  //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 5 seconds.
  delay(5000);
  //Pauses audio file number 1 during 5 seconds.  
  wtv020sd16p.pauseVoice();
  delay(5000);
  //Resumes audio file number 1 during 5 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();
}


 



Next page, STEP 5 - amplifier: