Arduino controlling the WTV020SD-16P Evaluation kit
This article shows how you can test WTV020SD-16P module using Arduino and WTV020SD-16P evaluation DIY kit. If you have come to this page directly from a search engine, we recommend you to visit these pages to understand this project:
- About WTV020SD-16P evaluation kit
- Assembly tutorial
- Gallery- all the images of wtv020sd-16p evaluation kit
- Schematic of this kit
- How to use WTV020SD-16P module
Connecting the WTV020SD-16P evaluation kit to Arduino:
You can see there is a 6 pin female header for connecting the kit to Arduino.
- 5V connects to 5V pin of Arduino
- RST connects to Digital Pin 2 of Arduino
- P04 connects to Digital Pin 3 of Arduino
- P05 connects to Digital Pin 4 of Arduino
- P06 connects to Digital Pin 5 of Arduino
- GND connects to GND pin of Arduino
After connecting the kit to Arduino, load some AD4 format files on to your MicroSD card. You can Download the AD4 audio sample files. And, then stack the WTV020SD-16P module over the stackable header of the kit. Please note that the LM386 Audio amplifier module and the connected speaker are optional. The speaker connected directly to the kit is sufficient to hear the audio. But, the Audio amplifier module amplifies the sound and you can hear it more clearly.
Upload the following sketch to Arduino:
/* | |
Example: Control a WTV020-SD-16P evaluation board to play voices using WTV020SD-16P | |
module. | |
www.buildcircuit.com | |
Released into the public domain. | |
*/ | |
#include <Wtv020sd16p.h> | |
int resetPin = 2; // The pin number of the reset pin. | |
//Connect to RST pin of evaluation board. This connects to Pin 1 in wtv020sd-16P module. | |
int clockPin = 3; // The pin number of the clock pin. | |
//Connect to P04 pin of evaluation board. This connects to Pin 7 in wtv020sd-16P module | |
int dataPin = 4; // The pin number of the data pin. | |
//Connect to P05 pin of evaluation board. This connects to Pin 10 in wtv020sd-16P module. | |
int busyPin = 5; // The pin number of the busy pin. | |
//Connect to P06 pin of evaluation board. This connects to Pin 15 in wtv020sd-16P module. | |
/* | |
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() { | |
wtv020sd16p.asyncPlayVoice(0); // plays song 0, 0000.AD4 | |
delay(8000); // play time duration | |
wtv020sd16p.stopVoice(); | |
wtv020sd16p.asyncPlayVoice(1); // plays song 1, 0001.ad4 | |
delay(8000); // play time duration | |
wtv020sd16p.stopVoice(); | |
wtv020sd16p.asyncPlayVoice(2); // plays song 2, 0002.ad4 | |
delay(8000); // play time duration | |
wtv020sd16p.stopVoice(); | |
wtv020sd16p.asyncPlayVoice(3); // plays song 2, 0003.ad4 | |
delay(8000); // play time duration | |
wtv020sd16p.stopVoice(); | |
// you can add more songs likewise | |
} | |
//- See more at: http://www.buildcircuit.com/example-1-using-wtv020sd-16p-music-module-with-arduino/#sthash.v2lPgRtU.dpuf |
The output of the project:
When you upload the sketch to your Arduino, the kit starts playing music one after another. After all the songs are played, it loops back to the first one. Download the AD4 audio sample files.
– See more at: http://www.buildcircuit.com/arduino-controlling-the-wtv020sd-16p-evaluation-kit/#sthash.V9gJ52Md.dpuf
Related documents: