Adding sound to your projects is great, there can be several methods to do it. In this post i will show how we can use wtv020-sd module to get this task done. I wont go in detailed description of the module and will keep the post short and to the point. The module can be operated in a number of modes including pushbutton modes but the one we are going for is the 3 wire serial mode. its actually SDA,SCL and reset wires that we use. The module would play back the ad4 files stored on uSD Card. and spk+ and spk- pins can be connected directly to a speaker. More details about the module can be found in the datasheet and the webpage link.
The interface is simple. you only need to connect Supply , DI ,CLK and reset Pins to get it working although you may also connect some other pins also but this is what is really needed to get the module working.
The timing diagrams in the datasheet can be used to write the program. I will share the code I use for this module.
below is the code .
#define SCL 4 //serial clock
#define SDA 5 //serial data
#define RST 3 //audio module reset
/*=============================Delay functions starts==========================*/
void delayus(unsigned int usec) // Function to provide time delay in us.
for(i=0;i 0; mask >>= 1)
if (value & mask) PORTC|=(1<
Here is an example code to play file 0005.ad4 for 5 secs and then stops the file and start playing file 0001.ad4.
send_audio(0xFFFF); //stop playing
To convert your audio files to AD4 format you can use the tool provided by waytronics. Get the converter and Sample files from the zip file HERE