Welcome to our 9th blog post! In this update we are going to guide you through the process to play .wav files on the MKR1000. The components we have used are -


  1. Arduino MKR1000
  2. PAM 8403 Amplifier (5V with Potentiometer)
  3. Speaker (4 Ohms, 3 Watts)
  4. Jumper cables


Speaker 3 diameter 4 ohm 3 watt 7961087309

                                       Speaker (8 Ohms, 3 Watts)                                                                                                                                                                      PAM 8403 Amplifier


The library designed for SAMD boards is called AudioZero. This library enables an Arduino Zero or MKR1000 board to play back .wav files from a storage device like an SD card. More information can be found on https://github.com/arduino-libraries/AudioZero


Pin diagram -


After connection -



















Code -


#include <SD.h>
#include <SPI.h>
#include <AudioZero.h>

void setup()
  // debug output at 115200 baud
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  Serial.print("Initializing SD card...");

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    while (1);
  Serial.println("initialization done.");

  // 44100kHz stereo => 88200 sample rate

void loop()
  int count = 0;

  // open wave file from sdcard
  File myFile = SD.open("a.wav");
  if (!myFile) {
    // if the file't opden, print an error and stop
    Serial.println("error opening test.wav");
    while (true);

  // until the file is not finished  

  Serial.println("End of file. Thank you for listening!");
  //while (true) ;


Demonstration -


Stay tuned for our next blog!