# Adafruit Audio BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/122/655/medium800/adafruit_products_5769-06.jpg?1689598188)

Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to turn many QT Py boards into powerful audio play projects that are super small!

![](https://cdn-learn.adafruit.com/assets/assets/000/122/656/medium800/adafruit_products_5769-05.jpg?1689598491)

We call this the **Adafruit Audio BFF** - a "Best Friend Forever". When you were a kid, you may have learned about the "buddy" system; well, this product is kinda like that! A board that will watch your QT Py's back and give it more capabilities.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/657/medium800/adafruit_products_5769-02.jpg?1689598747)

This PCB is designed to fit onto the back of any QT Py or Xiao board, it can be soldered into place or use pin and socket headers to make it removable. Onboard is a MAX98357 audio amplifier and picoblade-compatible connector for plugging in a 4 or 8 ohm speaker. We use **A1** for the audio data, **A2** for wordselect clock, and **A3** for bitclock. The SD card connects over the SPI port: **MOSI** , **MISO** and **SCK** plus **A0** for card select.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/658/medium800/adafruit_products_5769-04.jpg?1689598833)

This pinout will work with ESP32&nbsp;series, nRF52840, and RP2040 chipset boards. It won't work with the [ATSAMD21 'original 'QT Py because those pins on the SAMD21 are not I2S capable](https://learn.adafruit.com/adafruit-qt-py/pinouts). However, you could cut and rewire the traces to connect to the I2S pads if desired - personally, we recommend just upgrading to an RP2040 QT Py instead.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/659/medium800/adafruit_products_5769-03.jpg?1689598883)

We include some header that you can solder to your QT Py. [You can also pick up an Itsy Bitsy short female header kit to make it removable but compact](https://www.adafruit.com/product/4174), you'll just need to trim down the headers to 7 pins long.

- Comes as an assembled and tested PCB
- For any QT Py or Xiao boards
- [Contains a MAX98357 3 Watt audio amplifier](https://www.adafruit.com/product/3006) pre-configured for 'stereo' mix output and 9 dB gain which will work great for any project.
- Use any micro SD card that supports SPI mode with one CS pin.
- [Connect to the speaker output with a picoblade-compatible 2-pin cable](https://www.adafruit.com/product/3922). [We recommend this 3W 4 ohm speaker](https://www.adafruit.com/product/3968)
- There are various Arduino / CircuitPython / MicroPython libraries can be used to talk to the SD card and I2S amplifier.

**Speaker, microSD memory card, and QT Py are not included**.

# Adafruit Audio BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/122/660/medium800/adafruit_products_dbl.jpg?1689599282)

Info: This breakout is meant to be used with a QT Py or Xiao form factor board. Using with other form factor boards may be difficult.

## I2S Amplifier

- The grey square located towards the top right of the BFF is the **MAX98357**** &nbsp;I2S amplifier chip**. It supports digital audio.

## Default I2S Pins

These pins are compatible with ESP32-series, nRF52840 and RP2040 microcontroller boards.

- **A1** - This is used for audio data, or **DAT**.
- **A2** - This is used for wordselect clock, or **LR**.
- **A3** - This is used for bitclock, or **BCLK**.

Warning: 

## Default SD Card Pins

The SD Card is connected to the default SPI pins on the QT Py. **SDCS** is connected to pin **A0**.

- **MO** - This is the SPI MOSI ( **M** icrocontroller&nbsp; **O** ut /&nbsp; **S** erial&nbsp; **I** n) pin. It is used to send data from the microcontroller to the SD card. It is connected to the default **MOSI** pin on the QT Py.
- **MI** -&nbsp;This is the SPI MISO ( **M** icrocontroller&nbsp; **I** n /&nbsp; **S** erial&nbsp; **O** ut) pin. It's used for sending data from the SD card to the microcontroller. It is connected to the default **MISO** pin on the QT Py.
- **SCK** - This is the SPI clock input pin. It is connected to the default **SCK** pin on the QT Py.
- **A0** - This is the SD chip select pin ( **SDCS** ).

## I2S Gain Jumper

On the back of the board, towards the top, are the I2S gain jumper pads. They are outlined in white on the board silk and are labeled **Gain**. The default gain for the amplifier is 9 dB.

- To set the gain to 6 dB, solder the center jumper, labeled **9** , to the jumper above labeled **6**. This connects the **GAIN** pin on the I2S amplifier to **5V**.
- To set the gain to 12 dB, solder the center jumper, labeled **9** , to the right jumper below labeled **12**. This connects the **GAIN** pin on the I2S amplifier to **GND**.

## Speaker Connector

- This **two-pin PicoBlade-compatible speaker**  **connector** , located at the center of the front of the BFF, is meant for plugging in **a 4-8Ω, 3W-or-less speaker**.
- To connect a speaker with bare wires, you'll want to pick up [this cable](https://www.adafruit.com/product/3922).
- If you need a speaker, [this speaker](https://www.adafruit.com/product/3968) is an excellent place to start.

## micro SD Card Slot

- On the front of the board, towards the bottom, is the micro SD card slot. You can use any micro SD card that supports&nbsp;SPI mode with one CS pin.

# Adafruit Audio BFF

## CircuitPython

Warning: 

[Follow these steps to create the /sd directory](https://learn.adafruit.com/adafruit-memento-camera-board/circuitpython-memento-starter-projects)
It's easy to use the **Audio BFF** with CircuitPython, the builtin&nbsp;`audiobusio`&nbsp;module and the [Adafruit\_CircuitPython\_SD](https://github.com/adafruit/Adafruit_CircuitPython_SD) module. These modules allow you to easily write Python code that lets you read from an attached SD card and play audio.

## micro SD Card Prep

There are five **.wav** audio files available for download below in a .zip file. After downloading the .zip file, extract the contents:

- **adabot.wav**
- **hello.wav**
- **interesting.wav**
- **uhoh.wav**
- **whhaatt.wav**

Then, drag and drop the five **.wav** files onto a micro SD card that you'll use with the Audio BFF.&nbsp;

[Audio_BFF_Example_.WAV_Files.zip](https://cdn-learn.adafruit.com/assets/assets/000/122/670/original/Audio_BFF_Example_.WAV_Files.zip?1689626006)
### 512MB micro SD Memory Card

[512MB micro SD Memory Card](https://www.adafruit.com/product/5252)
Add storage in a jiffy using this **512MB** microSD card. Preformatted to FAT32, so it works out of the packaging with our projects. Works great with any device in the Adafruit shop that uses microSD cards. Ideal for use with Feathers, data loggers, or small Linux SBCs (not good...

In Stock
[Buy Now](https://www.adafruit.com/product/5252)
[Related Guides to the Product](https://learn.adafruit.com/products/5252/guides)
![Angel shot of Small microSD card 512mb](https://cdn-shop.adafruit.com/640x480/5252-00.jpg)

## CircuitPython Microcontroller Wiring

Plug an Audio BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with plug headers into the Audio BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers,&nbsp;[check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

Then, plug in a speaker to the speaker input. Finally, insert the micro SD card with the audio files that you downloaded above into the micro SD card slot.

![adafruit_products_5769-06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/668/medium640/adafruit_products_5769-06.jpg?1689624365)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
### Mini Oval Speaker - 8 Ohm 1 Watt

[Mini Oval Speaker - 8 Ohm 1 Watt](https://www.adafruit.com/product/3923)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/3923)
[Related Guides to the Product](https://learn.adafruit.com/products/3923/guides)
![Small, black, oval speaker with Pico Blade connector.](https://cdn-shop.adafruit.com/640x480/3923-06.jpg)

## CircuitPython Usage

To use with CircuitPython, you need to first install the adafruit\_sdcard library, and its dependencies, into the **lib** folder on your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

Thankfully, we can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire lib folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folders and files:

- **/adafruit\_bus\_device**
- **adafruit\_sdcard.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/Audio_BFF.png )

## Example Code

Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Audio_BFF/code.py

In the code, the SD card is mounted and the available **.wav** files are added to an array and printed to the Serial Console. Then, when you press the **BOOT** button, a random audio file will play from the array. If you press the **BOOT** button while a file is playing, the file will stop.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/669/medium800/adafruit_products_cpSerial.png?1689624592)

Warning: If you encounter any errors, such as RuntimeError: Mount point directory missing or an OSError, make sure that you have created an /sd directory on your CIRCUITPY drive.

# Adafruit Audio BFF

## Python Docs

# Adafruit Audio BFF

## Arduino

Using the Audio BFF with Arduino involves plugging the breakout into your Arduino-compatible QT Py or Xiao form factor board, installing the [Adafruit WavePlayer library](https://github.com/adafruit/Adafruit_WavePlayer), and running the provided example code.

Warning: This example has been tested with the QT Py RP2040. A different chip family (ESP32, SAMD, etc) may require different example code.

## micro SD Card Prep

There are five **.wav** audio files available for download below in a .zip file. After downloading the .zip file, extract the contents:

- **adabot.wav**
- **hello.wav**
- **interesting.wav**
- **uhoh.wav**
- **whhaatt.wav**

Then, drag and drop the five **.wav** files onto a micro SD card that you'll use with the Audio BFF.

[Audio_BFF_Example_.WAV_Files.zip](https://cdn-learn.adafruit.com/assets/assets/000/122/670/original/Audio_BFF_Example_.WAV_Files.zip?1689626006)
### 512MB micro SD Memory Card

[512MB micro SD Memory Card](https://www.adafruit.com/product/5252)
Add storage in a jiffy using this **512MB** microSD card. Preformatted to FAT32, so it works out of the packaging with our projects. Works great with any device in the Adafruit shop that uses microSD cards. Ideal for use with Feathers, data loggers, or small Linux SBCs (not good...

In Stock
[Buy Now](https://www.adafruit.com/product/5252)
[Related Guides to the Product](https://learn.adafruit.com/products/5252/guides)
![Angel shot of Small microSD card 512mb](https://cdn-shop.adafruit.com/640x480/5252-00.jpg)

## Wiring

Plug an Audio BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with plug headers into the Audio BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers, [check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

Then, plug in a speaker to the speaker input. Finally, insert the micro SD card with the audio files that you downloaded above into the micro SD card slot.

![adafruit_products_5769-06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/671/medium640/adafruit_products_5769-06.jpg?1689626227)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
### Mini Oval Speaker - 8 Ohm 1 Watt

[Mini Oval Speaker - 8 Ohm 1 Watt](https://www.adafruit.com/product/3923)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/3923)
[Related Guides to the Product](https://learn.adafruit.com/products/3923/guides)
![Small, black, oval speaker with Pico Blade connector.](https://cdn-shop.adafruit.com/640x480/3923-06.jpg)

## Library Installation

You can install the **Adafruit WavePlayer** library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/672/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1689626382)

Click the&nbsp; **Manage Libraries ...** &nbsp;menu item, search for&nbsp; **Adafruit WavePlayer** &nbsp;and select the&nbsp; **Adafruit WavePlayer** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/122/673/medium800/adafruit_products_wavePlayerInstall.png?1689626419)

If asked about dependencies, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/122/674/medium800/adafruit_products_wavePlayerDepends.png?1689626489)

If the "Dependencies" window does not come up, then you already have the dependencies installed.

Warning: 

## Example Code
https://github.com/adafruit/Adafruit_WavePlayer/blob/master/examples/qtpy_audio_bff_example/qtpy_audio_bff_example.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/122/675/medium800/adafruit_products_arduinoSerial.png?1689626753)

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. Once the SD card is initialized, it will print to the Serial Monitor. You will hear the audio files play through the speaker. As they play, the file names will be printed to the Serial Monitor.

# Adafruit Audio BFF

## Arduino Docs

# Adafruit Audio BFF

## Downloads

## Files

- [MAX98357 Datasheet](https://cdn-shop.adafruit.com/product-files/3006/MAX98357A-MAX98357B.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-Audio-BFF-PCB)
- [3D files on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5769%20Audio%20BFF)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20Audio%20BFF.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/122/661/medium800/adafruit_products_schem.png?1689601469)

![](https://cdn-learn.adafruit.com/assets/assets/000/122/662/medium800/adafruit_products_fab.png?1689601492 dimensions are in inches)

## 3D Models
![](https://cdn-learn.adafruit.com/assets/assets/000/127/950/medium800/adafruit_products_5769_Audio_BFF.jpg?1708709885)


## Primary Products

### Adafruit Audio BFF Add-on for QT Py and Xiao

[Adafruit Audio BFF Add-on for QT Py and Xiao](https://www.adafruit.com/product/5769)
Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to turn many QT Py boards into powerful audio play projects that are super small!

This BFF comes with a MicroSD card slot that can address up to 64 GB of...

In Stock
[Buy Now](https://www.adafruit.com/product/5769)
[Related Guides to the Product](https://learn.adafruit.com/products/5769/guides)

## Featured Products

### Molex PicoBlade 2-pin Cable - 200mm

[Molex PicoBlade 2-pin Cable - 200mm](https://www.adafruit.com/product/3922)
When 0.1" is too big, and JST PH's too chunky, the ultra-slim "PicoBlade" is a reliable alternative. These are only 1.25mm pitch, but have a nice clicky connection.

This cable is nice and long, 200mm in fact. It's got both small form factor (won't take up a lot...

In Stock
[Buy Now](https://www.adafruit.com/product/3922)
[Related Guides to the Product](https://learn.adafruit.com/products/3922/guides)
### Speaker - 40mm Diameter - 4 Ohm 5 Watt

[Speaker - 40mm Diameter - 4 Ohm 5 Watt](https://www.adafruit.com/product/3968)
Hear the good news! This speaker&nbsp;is a great addition to any audio project where you need a&nbsp;4 Ohm impedance and 3W or less of power.

At **40mm diameter** it has a more square-ish shape, but a smaller face. Sound quality and volume are nicely sandwiched between our...

In Stock
[Buy Now](https://www.adafruit.com/product/3968)
[Related Guides to the Product](https://learn.adafruit.com/products/3968/guides)
### 512MB micro SD Memory Card

[512MB micro SD Memory Card](https://www.adafruit.com/product/5252)
Add storage in a jiffy using this **512MB** microSD card. Preformatted to FAT32, so it works out of the packaging with our projects. Works great with any device in the Adafruit shop that uses microSD cards. Ideal for use with Feathers, data loggers, or small Linux SBCs (not good...

In Stock
[Buy Now](https://www.adafruit.com/product/5252)
[Related Guides to the Product](https://learn.adafruit.com/products/5252/guides)

## Related Guides

- [No-Code Offline Data Logger with WipperSnapper](https://learn.adafruit.com/no-code-offline-data-logging-with-wippersnapper.md)
- [Audio Synthesis with CircuitPython synthio](https://learn.adafruit.com/audio-synthesis-with-circuitpython-synthio.md)
- [Adafruit RS232 Pal](https://learn.adafruit.com/adafruit-rs232-pal.md)
- [MIDI Controlled Robot Lyre with CircuitPython](https://learn.adafruit.com/midi-controlled-robot-lyre-with-circuitpython.md)
- [IoT Power Outlet with CircuitPython and Adafruit IO](https://learn.adafruit.com/adafruit-io-a-c-power-relay.md)
- [IoT Air Quality Sensor with Adafruit IO](https://learn.adafruit.com/diy-air-quality-monitor.md)
- [Adafruit nRF52 Pro Feather with Mynewt](https://learn.adafruit.com/adafruit-nrf52-pro-feather.md)
- [Adafruit Pixel Shifter](https://learn.adafruit.com/adafruit-pixel-shifter.md)
- [AR1100 Resistive Touch Screen Controller Guide](https://learn.adafruit.com/ar1100-resistive-touch-screen-controller-guide.md)
- [Multi-tasking with CircuitPython](https://learn.adafruit.com/multi-tasking-with-circuitpython.md)
- [Adafruit Stepper + DC Motor FeatherWing](https://learn.adafruit.com/adafruit-stepper-dc-motor-featherwing.md)
- [MacroPad Summer Olympics Hotkeys](https://learn.adafruit.com/macropad-olympic-hotkeys.md)
- [Tandy 1000 Keyboard to USB with CircuitPython](https://learn.adafruit.com/tandy-1000-keyboard-to-usb-with-circuitpython.md)
- [Adafruit Sensirion SHT40, SHT41 & SHT45 Temperature & Humidity Sensors](https://learn.adafruit.com/adafruit-sht40-temperature-humidity-sensor.md)
- [Smart Mirror with PyPortal](https://learn.adafruit.com/smart-mirror-with-pyportal.md)
