Audio Codec Breakout - WM8960 Hookup Guide

Pages
Contributors: QCPete, bboyho
Favorited Favorite 0

Introduction

The SparkFun Audio Codec Breakout - WM8960 is a low power, high quality stereo codec with 1W Stereo Class D speaker drivers and headphone drivers. The WM8960 acts as a stereo audio ADC and DAC, and communicates using I2S, a standard audio data protocol (not to be confused with I2C). This audio codec is chock full of features some of which includes advanced on-chip digital signal processing for automatic level control (ALC) for the line or microphone input, programmable gain amplifier (PGA), pop and click suppression, and its ability to configure I2S settings and analog audio path through software via I2C.

SparkFun Audio Codec Breakout - WM8960 (Qwiic)

SparkFun Audio Codec Breakout - WM8960 (Qwiic)

BOB-21250
$17.95
1
SparkFun Audio Codec Breakout - WM8960 with Headers (Qwiic)

SparkFun Audio Codec Breakout - WM8960 with Headers (Qwiic)

BOB-21772
$18.50

Required Materials

To follow along with this tutorial, you will need the following materials at a minimum. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary. Note that the wishlist does not include any microphones or speakers.

Arduino Microcontroller

You will need an Arduino microcontroller to configure the WM8960. We recommend the Espressif's ESP32 WROOM. For the scope of this tutorial, we will be using the IoT RedBoard ESP32 - Development Board since it already includes female headers on the board to connect jumper wires to the WM8960.

SparkFun Thing Plus - ESP32 WROOM (Micro-B)

SparkFun Thing Plus - ESP32 WROOM (Micro-B)

WRL-15663
$22.50
13
SparkFun Thing Plus - ESP32 WROOM (USB-C)

SparkFun Thing Plus - ESP32 WROOM (USB-C)

WRL-20168
$24.95
3
SparkFun IoT RedBoard - ESP32 Development Board

SparkFun IoT RedBoard - ESP32 Development Board

WRL-19177
$29.95
7

Differential Microphone Input

Below is a differential microphone from the catalog that you can connect as a differential microphone input. Note that you will need a resistor and the MICBIAS pin to connect to the eletret microphone.

Electret Microphone

Electret Microphone

COM-08635
$1.05

Single Ended Microphone Input

Below are a few electret and MEMS microphones from the catalog that you can connect as a single ended microphone input.

SparkFun Electret Microphone Breakout

SparkFun Electret Microphone Breakout

BOB-12758
$7.50
7
SparkFun Analog MEMS Microphone Breakout - SPH8878LR5H-1

SparkFun Analog MEMS Microphone Breakout - SPH8878LR5H-1

BOB-19389
$6.95
2
SparkFun Analog MEMS Microphone Breakout - ICS-40180

SparkFun Analog MEMS Microphone Breakout - ICS-40180

BOB-18011
$6.95

Differential Speaker Output

Below are a few speakers from the catalog that you could use as an output. You will want to choose differential speakers like the following listed below (not to be confused by the piezo buzzers). Note that some speakers may perform better than others at certain frequencies while others operate around a certain frequency range. Make sure to check out the speaker's datasheet when choosing a speaker.

Speaker - 0.5W (8 Ohm)

Speaker - 0.5W (8 Ohm)

COM-09151
$2.45
Thin Speaker - 0.5W

Thin Speaker - 0.5W

COM-15350
$1.05
Speaker - PCB Mount

Speaker - PCB Mount

COM-11089
$2.10
3
Through-Hole Speaker

Through-Hole Speaker

PRT-20660
$2.95

Note that some speakers may be rated as a higher wattage (more than what the Audio Codec's speaker driver can output). Higher wattage speakers will still play sound but they won't be fully powered.

Surface Transducer - Large

Surface Transducer - Large

COM-19102
$24.95
Wide Frequency Range Speaker - 3in. (Polypropylene Cone)

Wide Frequency Range Speaker - 3in. (Polypropylene Cone)

COM-18379
$11.95 $6.95

Audio Accessories

Depending on your setup, you may need an adapter or cable for the TRS audio connection for line level input or headphone output.

Audio Jack 3.5mm

Audio Jack 3.5mm

PRT-08032
$1.60
4
Audio Cable TRS - 1m

Audio Cable TRS - 1m

CAB-18983
$1.95
SparkFun Audio Jack Breakout

SparkFun Audio Jack Breakout

PRT-10588
$1.05
1

You can also use a TRRS breakout instead of the TRS breakout listed above. RING2 of the TRRS connector also connects to the TRS cable's sleeve. When wiring your circuit up, we recommend connecting to the sleeve in case you have a headphone with a TRRS connector.

SparkFun TRRS 3.5mm Jack Breakout

SparkFun TRRS 3.5mm Jack Breakout

BOB-11570
$4.50
6

Tools

You will need a soldering iron, solder, and general soldering accessories for a secure connection when using the plated through hole pads.

Soldering Iron - 60W (Adjustable Temperature)

Soldering Iron - 60W (Adjustable Temperature)

TOL-14456
$16.50
16
Solder Lead Free - 15-gram Tube

Solder Lead Free - 15-gram Tube

TOL-09163
$3.95
4

Prototyping Accessories

Depending on your setup, you may want to use IC hooks for a temporary connection. However, you will want to solder header pins to connect devices to the plated through holes for a secure connection. Note that you will need to breakaway the male header pins or cut the female header pins down to fit the two rows of 1x16 PTH on the breakout. Of course, you could also solder wire as well.

Breadboard - Self-Adhesive (White)

Breadboard - Self-Adhesive (White)

PRT-12002
$5.50
48
Break Away Headers - Straight

Break Away Headers - Straight

PRT-00116
$1.75
20
IC Hook with Pigtail

IC Hook with Pigtail

CAB-09741
$5.50
10
ESP32 Thing Stackable Header Set

ESP32 Thing Stackable Header Set

PRT-14311
$1.75
Jumper Wires Premium 6" M/M Pack of 10

Jumper Wires Premium 6" M/M Pack of 10

PRT-08431
$4.50
2

For users that are interested in adding an input to adjust volume or modes, you can add a trimpot and button to the setup. A few of the examples used in this tutorial use the trimpot to adjust. You will need to add a few lines of code if you want to toggle certain modes (i.e. 3D enhance, loopback, etc) or if you decided to use buttons to turn up or down the volume. For advanced users using their own differential microphones, you will need to add a 2.2kΩ resistor in series with each microphone. Other passives like capacitors may also be needed depending on your application.

Resistor Kit - 1/4W (500 total)

Resistor Kit - 1/4W (500 total)

COM-10969
$8.95
188
Trimpot 10K Ohm with Knob

Trimpot 10K Ohm with Knob

COM-09806
$1.05
6
Multicolor Buttons - 4-pack

Multicolor Buttons - 4-pack

PRT-14460
$1.75
Electrolytic Decoupling Capacitors - 100uF/25V

Electrolytic Decoupling Capacitors - 100uF/25V

COM-00096
$0.45

For those that want to take advantage of the Qwiic enabled devices, you'll want to grab a Qwiic cable.

SparkFun Qwiic Cable Kit

SparkFun Qwiic Cable Kit

KIT-15081
$8.95
21
Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50

Qwiic Cable - 500mm

PRT-14429
1 Retired
Qwiic Cable - Breadboard Jumper (4-pin)

Qwiic Cable - Breadboard Jumper (4-pin)

PRT-14425
$1.50

You Will Also Need

Depending on your setup, you will also need some sort of audio source. This can be from your smartphone or computer. Most of the examples listed in this tutorial will output the audio through the headphones. You will also need to have a pair of headphones with a 3.5mm TRS audio jack on the end.

  • Audio Source
    • MP3 Player
    • Bluetooth ® Audio Device (e.g. smartphone, computer, transmitter)
  • Headphones with 3.5mm TRS Audio Jack

Suggested Reading

If you aren't familiar with the MicroMod ecosystem, we recommend reading here for an overview if you decide to take advantage of the Qwiic connector.

Qwiic Connect System
Qwiic Connect System

If you aren’t familiar with the following concepts, we also recommend checking out a few of these tutorials before continuing. Make sure to check the respective hookup guides for your microcontroller to ensure that you are installing the correct USB-to-serial converter. You may also need to follow additional instructions that are not outlined in this tutorial to install the appropriate software.

How to Solder: Through-Hole Soldering

This tutorial covers everything you need to know about through-hole soldering.

Analog to Digital Conversion

The world is analog. Use analog to digital conversion to help digital devices interpret the world.

How to Use a Breadboard

Welcome to the wonderful world of breadboards. Here we will learn what a breadboard is and how to use one to build your very first circuit.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

SparkFun Serial Basic CH340C Hookup Guide

SparkFun Serial Basic Breakout takes advantage of USB-C and is an easy-to-use USB-to-Serial adapter based on the CH340C IC from WCH. With USB-C you can get up to three times the power delivery over the previous USB generation and has the convenient feature of being reversable.

Installing Board Definitions in the Arduino IDE

How do I install a custom Arduino board/core? It's easy! This tutorial will go over how to install an Arduino board definition using the Arduino Board Manager. We will also go over manually installing third-party cores, such as the board definitions required for many of the SparkFun development boards.

IoT RedBoard ESP32 Development Board Hookup Guide

Delve into the functionality-rich world of the IoT RedBoard ESP32 Development Board!