Arduino Wave Manual
Arduino Wave Manual
com
o m
.c
Introduction se
ou
We know that Ladyada designed an Arduino Wave Shield. It is a wonderful Arduino module. Arduino reads the .wave file in the SD
card then send to DAC chip, while the sound is generated. But the problem is, it is a little complicated to use this shied for beginners,
h
So we are thinking about designing a module, with a chip to do all the file system work. Arduino just need little code to control it.
Also, it should be cheap. Finally here comes this shield.
l
.e
w
w
w
Feature
Support SD card (Max 1GB)
www.elechouse.com
This module can directly drive 0.5W 8 ohm speaker via PWM output. We also add socket for earphone via DAC output. No matter
what your MCU is, you only need two wires to control this module. Code size is very small and very easy to be embedded into your
project code.
m
How to use it
In this document we will show you how simple to use this module.
o
SD card
.c
SD card has to be less than 1G, which is one of defects of this module. Considering it might be hard to buy SD card less than 1G in the
se
market, we will include a SD card along with this module if you choose the option.
Format the card to FAT system. Please refer to this link if you don’t know how to format it.
ou
File
This module could play AD4 and WAV file. You can convert MP3 file to AD4 or WAV. To create AD4 files, download this software. In
h
the package contains instruction showing how to use it. To create WAV file, you can refer to this document. We also supply audio
ec
sample.
Load voice files to root directory of SD card, and rename the files in this way: for WAV format voice, name in hex 0000.wav, 0001.wav,
l
0002.wav……; for ad4 format voice, name in hex 0000.ad4, 0001.ad4, 0002.ad4……. This module can play max 512 files.
.e
Connection
w
Just plug in this module in Arduino. It is compatible with all Arduino series. There are two audio output interfaces on this module:
w
o m
Connect speaker via PWM output interface:
.c
se
h ou
l ec
.e
w
w
w
m
Send the file name to play the audio. If you need to play file 0005.AD4, send data 0x0005.
o
To control voice volumn and others, send the following command:
.c
se
h ou
The default volume is the maximum. FFF0H is mute. Volume can be adjusted in play or stop status.
ec
Code
l
void setup() {
w
pinMode(RST, OUTPUT);
w
pinMode(CLK, OUTPUT);
pinMode(DAT, OUTPUT);
digitalWrite(RST, HIGH);
digitalWrite(CLK, HIGH);
digitalWrite(DAT, HIGH);
digitalWrite(RST, LOW);
delay(5);
digitalWrite(RST, HIGH);
delay(300);
}
void loop() {
send(0xfffe); // pause
delay(5000);
send(0xfffe); //play
while(1);
}
m
void send(int data) // This function is to send data to this module.
{
digitalWrite(CLK, LOW);
o
delay(2);
for (int i=15; i>=0; i--)
.c
{
delayMicroseconds(50);
if((data>>i)&0x0001 >0)
se
{
digitalWrite(DAT, HIGH);
}
else
ou
{
digitalWrite(DAT, LOW);
}
delayMicroseconds(50);
h
digitalWrite(CLK, HIGH);
delayMicroseconds(50);
ec
if(i>0)
digitalWrite(DAT, LOW);
else
l
digitalWrite(DAT, HIGH);
.e
delayMicroseconds(50);
if(i>0)
w
digitalWrite(CLK, LOW);
else
w
digitalWrite(CLK, HIGH);
}
w
delay(20);
}
Tips: the code is not optimized. Any improving work on the code is encouraged.
Upload the code to Arduino and then press RESTE button (the black on) on the module. You can also try the red buttons. They are
NEXT, Play/Pause and PREVIOUS.
Dimensions (Assemble)
L x W x H: 44mm x 51mm x 24mm
www.elechouse.com
o m
.c
Useful link se
ou
Buy Arduino Wave Module
Buy speaker
Sample audio file
h
AD4 software
ec
Test code
l
Revision History
Rev. Date Author Description
w
th
A Dec. 16 , 2011 Wilson Shen Initial version
th Corrected known defect of V1;
B April 27 , 2012 Wilson Shen
w
Appendix
Schematic
P6 C7 P1
SPK_P SPK_P
1 1
SPK_N
2 Cap 2
WTV020-SD-20S
47uF 3
D3 D2
1 11
A5 P01 Header 3
2 12
A4 P00 SD card GND
3 13
VCC D6 RESET 9
4 14 DATA2
D7 P11 P00 1
5 15 DATA3
m
P10 P01 2
6 16 CMD
SPK_P VCC C2 3
C3 7 17 VSS
SPK_N 4 SD
Cap 8 18 VCC VDD
P11 5
104 9 19 Cap CLK
6
10 20 VSS
o
104 P10 7
R1 DATA0
8
C4 Res3 DATA1
GND
Cap 15K
.c
102 GND
GND
P2 P3
se
VCC P4 P5 AREF D7
1 1
RST D6
R4 1 1 GND 2 2
U1 3V3 D5
1.5K 2 2 3 3
VCC 5V
GND
Vout
3 3 4 4
Vin
C5 D3
C6 4 4 5 5
Cap Pol1 D2
5 5 6 6
ou
2.2uF Cap A5 TX1
6 6 7 7
GND1
VCC2
5V 3
0.1uF A4 RX1
D1 8 8
GND GND ASM1117 GND
h
GND
ec
VCC
Button MAX809 Next Previous Play_Stop
RST D2 D3 D7
1 2 3 R2 1 2 1 2 1 2
RESET Q1
3 4 2 GND 3 4 3 4 3 4
1 Res3
Header 2X2 10K Header 2X2
l
Header 3 C1 NPN
GND GND Cap R3 D5 GND GND GND GND GND GND
.e
104
Res3
10K
w
GND
w
w