# Adafruit I2S Amplifier BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/121/884/medium800/adafruit_products_I2SBFF_top.jpg?1686774181)

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 add an I2S 3 Watt amplifier, for high quality audio playback,&nbsp;that can fit on the back of your miniature dev board. It uses just three GPIO pins that do not intersect with the I2C/UART or SPI port.

![](https://cdn-learn.adafruit.com/assets/assets/000/121/885/medium800/adafruit_products_I2SBFF_back.jpg?1686774189)

We call this the&nbsp; **Adafruit I2S Amp BFF** &nbsp;- 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/121/886/medium800/adafruit_products_I2SBFF_top_angle.jpg?1686774206)

This PCB is designed to fit onto the back of any QT Py or Xiao&nbsp;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 plugigng in a 4 or 8 ohm speaker. We use A0 for the audio data, A1 for wordselect clock, and A2 for bitclock. This pinout will work with ESP32&nbsp;series, nRF52840&nbsp;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/121/887/medium800/adafruit_products_I2SBFF_Picoblade_side.jpg?1686774224)

We include some header that you can solder to your QT Py.&nbsp;[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.
- [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 I2S amplifier.

**Speaker and QT Py are not included.**

![](https://cdn-learn.adafruit.com/assets/assets/000/121/888/medium800/adafruit_products_I2SBFF_Picoblade_side.jpg?1686774235)

# Adafruit I2S Amplifier BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/121/889/medium800/adafruit_products_I2SBFF_pinouts_guide.jpg?1686774280)

## I2S Amplifier

- The grey square located in the center at the top of the BFF is the **MAX93785&nbsp;I2S amplifier chip**. It supports digital audio.

## Speaker Connector

- This **two-pin PicoBlade-compatible speaker**  **connector** , located at the center 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.

## I2S Pins

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

- **A0** - This is used for audio data, or **DIN**.
- **A1** - This is used for wordselect clock, or **LRC**.
- **A2** - This is used for bitclock, or **BIT**.

**These pins will not work with the QT Py SAMD21 microcontroller board.** To use a SAMD21, you would need to cut the pin jumpers and rewire the traces to compatible pins.

## I2S Default Pin Jumpers

There are jumpers on the I2S pins to enable you to change the default QT Py pins.

**First, cut the trace on the jumper associated with the default pin. Next, solder a wire between the jumper pad _furthest away from the pin label on the silk_ and the desired QT Py pin.**

- **A0 jumper** - Cutting this trace enables you to reassign the DIN (audio data) to a different pin.
- **A1 jumper** - Cutting this trace enables you to reassign the LRC (wordselect clock) to a different pin.
- **A2 jumper** - Cutting this trace enables you to reassign the BIT (bitclock) to a different pin.

The pads highlighted in magenta in the image below are the correct pads to wire to a new pin.

![](https://cdn-learn.adafruit.com/assets/assets/000/121/890/medium800/adafruit_products_I2SBFF_jumper_solder_pads.jpg?1686782395 Solder these pads to a new QT Py pin to reassign the default I2S pins, after cutting the jumper traces.)

## I2S Through-Hole Pads

You can use these through-hole pads to connect the I2S pins to different QT Py pins. They are labeled on the back of the board.

Info: 

 **To reassign an I2S pin, cut the trace on the jumper associated with the default pin, and then solder a wire between the through-hole pad and the desired QT Py pin.**

- **DIN** - This pad, located next to the A0 pin label on the board silk, is connected to the DIN pin.
- **LRC** - This pad, located between the DIN pin and the MAX93785 chip, is connected to the LRC pin.
- **BIT** - This pad, located near the A3 pin label on the board silk, is connected to the BIT pin.

## Left/Right Channel Jumper

This jumper allows you to choose between the left channel, right channel, or both together.

- The BFF **defaults to stereo mix** , using both the left and right channel equally if no changes are made to this jumper.
- If you solder **the pad near the R label on the board silk** and **the**  **center pad** together, you will get audio out of the **right channel** only.
- If you solder **the pad near the L label on the board silk** and **the center pad** together, you will get audio out of the **left channel** only.

# Adafruit I2S Amplifier BFF

## CircuitPython

![](https://cdn-learn.adafruit.com/assets/assets/000/121/917/medium800/adafruit_products_I2SBFF_speaker.jpg?1686872027)

CircuitPython supports sending I2S audio signals using the builtin `audiobusio` module, making it simple to use the I2S BFF with your QT Py. It's easy to use CircuitPython to play different types of audio using I2S, including tones and WAV files.

This page uses a QT Py RP2040 as the microcontroller board. These demos will work with any QT Py version, as long as it has the `audiobusio` module builtin to CircuitPython for that board. Visit [circuitpython.org/downloads](https://circuitpython.org/downloads) and search for the QT Py you wish to use. Click on it, and you'll find a list of built-in modules. The list for the QT Py RP2040 is indicated by the magenta rectangle. `audiobusio` is highlighted.

![](https://cdn-learn.adafruit.com/assets/assets/000/121/911/medium800/adafruit_products_I2SBFF_QTPyRP_builtin_modules.png?1686867880)

## Wiring

You'll need to connect the BFF to a QT Py RP2040, and a speaker to the BFF.

### QT Py to BFF

Connect a QT Py RP2040 to the I2S BFF by soldering on a pair of pin headers to one, and a pair of socket headers to the other.

In this setup, the pin headers are on the QT Py on the top of the image, and the socket headers are on the I2S BFF on the bottom of the image. **They should be plugged in with the backs of the boards facing each other**. The I2S BFF has on the back, a USB label with an arrow, to indicate which end of the board should be aligned with the USB connector on the QT Py.

![adafruit_products_I2SBFF_QT_Py_RP2040.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/912/medium640/adafruit_products_I2SBFF_QT_Py_RP2040.jpg?1686868287)

Info: 

### I2S BFF to Speaker

Connect a speaker to your I2S BFF as shown below.

Plug the **PicoBlade-compatible connector on your speaker** into the **PicoBlade-compatible socket on your I2S BFF**.

The socket is keyed along with the connector to ensure avoiding plugging it in backwards.

![adafruit_products_I2SBFF_with_speaker_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/903/medium640/adafruit_products_I2SBFF_with_speaker_bb.jpg?1686859838)

### Speaker to Connector Cable (Optional)

If your speaker comes with bare wires, you'll want to pick up [this cable](http://www.adafruit.com/product/3922), and solder it to your speaker.

Info: 

Solder the cable to the speaker by connecting the wires on the cable to the same color wires on the speaker.

![adafruit_products_I2SBFF_speaker_soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/909/medium640/adafruit_products_I2SBFF_speaker_soldered.jpg?1686867033)

## CircuitPython Usage

There are two I2S audio examples: tone playback and WAV playback.

### Tone Playback

Click the **Download Project Bundle** button below to download the **code.py** file in a zip file. Extract the contents of the zip, and copy the&nbsp; **code.py** &nbsp;file to your&nbsp; **CIRCUITPY** &nbsp;drive.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Adafruit_I2S_BFF/CircuitPython/Tone/code.py

Once successfully copied, you'll begin hearing a one second 440Hz tone, every other second!

You can edit the following variables in the example code to increase the tone volume, and change the frequency in Hz of the tone being played.

```python
TONE_VOLUME = 0.1  # Increase this to increase the volume of the tone.
FREQUENCY = 440  # Set this to the Hz of the tone you want to generate.
```

### WAV Playback

Click the **Download Project Bundle** button below to download the **code.py** file and the&nbsp; **booploop.wav&nbsp;** file in a zip file. Extract the contents of the zip, and copy the&nbsp; **code.py** and&nbsp; **booploop.wav&nbsp;** files to your&nbsp; **CIRCUITPY** &nbsp;drive.

Your **CIRCUITPY** drive contents should resemble the following.

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

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Adafruit_I2S_BFF/CircuitPython/WAV/code.py

Once successfully copied, you'll hear the WAV file play once.

You can update the `LOOP` variable in this example to `True` if you want the WAV playback to loop.

```python
LOOP = False  # Update to True loop WAV playback. False plays once.
```

# Adafruit I2S Amplifier BFF

## CircuitPython Docs

# Adafruit I2S Amplifier BFF

## Arduino

Using the I2S BFF and the QT Py RP2040 with Arduino involves soldering up the two boards, connecting them in the appropriate orientation, and running the provided example code. **These examples do not require any separate libraries.**

## Wiring

You'll need to connect the BFF to a QT Py RP2040, and a speaker to the BFF.

### QT Py to BFF

Connect a QT Py RP2040 to the I2S BFF by soldering on a pair of pin headers to one, and a pair of socket headers to the other.

In this setup, the pin headers are on the QT Py on the top of the image, and the socket headers are on the I2S BFF on the bottom of the image. **They should be plugged in with the backs of the boards facing each other**. The I2S BFF has on the back, a USB label with an arrow, to indicate which end of the board should be aligned with the USB connector on the QT Py.

![adafruit_products_I2SBFF_QT_Py_RP2040.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/913/medium640/adafruit_products_I2SBFF_QT_Py_RP2040.jpg?1686870479)

Info: 

### I2S BFF to Speaker

Connect a speaker to your I2S BFF as shown below.

Plug the **PicoBlade-compatible connector on your speaker** into the **PicoBlade-compatible socket on your I2S BFF**.

The socket is keyed along with the connector to ensure avoiding plugging it in backwards.

![adafruit_products_I2SBFF_with_speaker_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/914/medium640/adafruit_products_I2SBFF_with_speaker_bb.jpg?1686870511)

![](https://cdn-learn.adafruit.com/assets/assets/000/121/919/medium800/adafruit_products_I2SBFF_speaker.jpg?1686872126)

### Speaker to Connector Cable (Optional)

If your speaker comes with bare wires, you'll want to pick up [this cable](http://www.adafruit.com/product/3922), and solder it to your speaker.

Info: 

Solder the cable to the speaker by connecting the wires on the cable to the same color wires on the speaker.

![adafruit_products_I2SBFF_speaker_soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/121/915/medium640/adafruit_products_I2SBFF_speaker_soldered.jpg?1686870647)

## Tone Example Code

This example plays a tone. The code below was adapted from [the **SimpleTone.ino** demo in the arduino-pico core I2S library examples](https://github.com/earlephilhower/arduino-pico/blob/master/libraries/I2S/examples/SimpleTone/SimpleTone.ino).

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Adafruit_I2S_BFF/Arduino/I2S_BFF_QT_Py_RP2040_Tone/I2S_BFF_QT_Py_RP2040_Tone.ino

Once you have uploaded the sketch to your QT Py, you'll hear a tone.

You can change the frequency (pitch) of the tone by updating the `frequency` variable.

```cpp
const int frequency = 440; // frequency of square wave in Hz
```

## Audio Playback Example Code

This example plays a PCM audio file when the Boot button is pressed. Check out [this Python script to convert WAV files to PCM files](https://github.com/adafruit/Adafruit_Media_Converters).

Click the button below to download the source code and header file. Unzip it, and open it with the Arduino IDE.

[Audio Playback Source Code](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/main/Adafruit_I2S_BFF/Arduino/I2S_BFF_QT_Py_RP2040_Audio_Playback)
When you open the code in the Arduino IDE, you will see the Arduino sketch code in one tab, and the header file in a second tab.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/008/medium800/adafruit_products_I2SBFF_Arduino_sketch_and_header_file.png?1687365153)

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Adafruit_I2S_BFF/Arduino/I2S_BFF_QT_Py_RP2040_Audio_Playback/I2S_BFF_QT_Py_RP2040_Audio_Playback.ino

Once you've uploaded the sketch onto the QT Py RP2040, press the Boot button to hear the clip played.

The **Boot button** (highlighted in blue in the image), is located towards the bottom edge of the board between the STEMMA QT connector on the right and the USB connector on the left.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/002/medium800/adafruit_products_QT_Py_RP2040_boot_button_blue.jpg?1687308510)

# Adafruit I2S Amplifier 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-I2S-Amplifier-BFF-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20I2S%20Amp%20BFF.fzpz)

# Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/121/881/medium800/adafruit_products_I2SBFF_sch.png?1686767151)

![](https://cdn-learn.adafruit.com/assets/assets/000/121/882/medium800/adafruit_products_I2SBFF_fab_print.png?1686767190 Dimensions are in inches.)


## Primary Products

### Adafruit I2S Amplifier BFF Add-On for QT Py and Xiao

[Adafruit I2S Amplifier BFF Add-On for QT Py and Xiao](https://www.adafruit.com/product/5770)
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 add an I2S 3 Watt amplifier, for high quality audio playback,&nbsp;that can fit on the back of your miniature dev board. It uses just three GPIO pins that do...

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

## Featured Products

### 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)
### 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)
### Adafruit QT Py RP2040

[Adafruit QT Py RP2040](https://www.adafruit.com/product/4900)
What a cutie pie! Or is it... a QT Py?&nbsp;This diminutive dev board comes with one of our new favorite chip, the RP2040. It's been made famous in the new [Raspberry Pi Pico](https://www.adafruit.com/pico) _and_ our [Feather...](http://www.adafruit.com/product/4884)

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

## Related Guides

- [Adafruit QT Py RP2040](https://learn.adafruit.com/adafruit-qt-py-2040.md)
- [QT Py RP2040 USB to Serial MIDI Friends](https://learn.adafruit.com/qt-py-rp2040-usb-to-serial-midi-friends.md)
- [Owl IR TV Remote](https://learn.adafruit.com/owl-ir-tv-remote.md)
- [NeoPixel Mini VU Meter](https://learn.adafruit.com/neopixel-mini-vu-meter.md)
- [MIDI for Makers](https://learn.adafruit.com/midi-for-makers.md)
- [Audio Synthesis with CircuitPython synthio](https://learn.adafruit.com/audio-synthesis-with-circuitpython-synthio.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [Toddler Timer](https://learn.adafruit.com/toddler-timer.md)
- [Tyrell Desktop Synthesizer](https://learn.adafruit.com/tyrell-desktop-synthesizer.md)
- [Lemon Mechanical Keypad](https://learn.adafruit.com/qtpy-lemon-mechanical-keypad-macropad.md)
- [MIDI Foot Pedal](https://learn.adafruit.com/midi-foot-pedal.md)
- ["Mother of all Demos" USB Keyset](https://learn.adafruit.com/usb-keyset.md)
- [NeoPixel Menorah](https://learn.adafruit.com/neopixel-menorah.md)
- [Walkmellotron: Cassette Player Mods](https://learn.adafruit.com/walkmellotron.md)
- [Hexpad](https://learn.adafruit.com/hexpad.md)
- [Adafruit PC Joystick to seesaw I2C Adapter](https://learn.adafruit.com/adafruit-pc-joystick-to-seesaw-i2c-adapter.md)
