Add Voice /Audio to projects using WTV020SD

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.

RECOMMENDED READ  Converting UNIX timestamp to seconds, minutes, hours, days, weeks, month, years, decades ago

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.

connections

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 .

#include 

#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.
{
  int i,j;
  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.

main()
{
  DDRC=0b00011100;
  init_audio();
  send_audio(0005);
  delays(5);
        send_audio(0xFFFF); //stop playing
  send_audio(0001);
  while(1);

}

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

 

Dost Muhammad Shah

Dost Muhammad specializing in Embedded Design, Firmware development, PCB designing , testing and prototyping. He enjoys sharing his experience with others .Get in touch with Dost on Twitter or via Contact form

 

2 thoughts on “Add Voice /Audio to projects using WTV020SD

  1. what will be the design of EVM for atmega 32 microcontroller…. using 16*2 Lcd?…..Do i need to change anything in the code? that u have given?
    I have tried this 'code and design' for atmega 32 with LMO16L but it didn't work….. so what should i do??

Leave a Reply