# Adafruit STEMMA Audio Amp

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/122/201/medium800/adafruit_products_SAA_top.jpg?1688010132)

The **&nbsp;Adafruit STEMMA Audio Amp** is a super small mono amplifier is surprisingly powerful - able to deliver up to 2.5 Watts into 4-8 ohm impedance speakers. Inside the miniature chip is a class D controller, able to run from 2.0V-5.5VDC. Since the amp is a class D, it's very efficient (over 90% efficient when driving an 8Ω speaker at over half a Watt) - making it perfect for portable and battery-powered projects. It has built in thermal and over-current protection but we could barely tell it got hot. There's even a volume trim pot so you can adjust the volume on the board down from the default 24dB gain. This board is a welcome upgrade to basic "LM386" amps!

![](https://cdn-learn.adafruit.com/assets/assets/000/122/202/medium800/adafruit_products_SAA_back.jpg?1688010129)

This board is a simplified version of our breadboard-friendly&nbsp;Adafruit Mono 2.5W Class D Audio Amplifier board. This version is designed to be 'plug and play' - with no soldering required. You can input the audio via the JST-PH 3 Pin connector - such as a [pin header cable](https://www.adafruit.com/product/3893) or [one with alligator clips](https://www.adafruit.com/product/4030). The trade-off is that this board doesn't have differential inputs, instead the audio inputs are referenced to the power/signal ground wire.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/203/medium800/adafruit_products_SAA_STEMMA_side.jpg?1688010057)

The input to the amplifier goes through 1.0uF capacitors so you can have DC. The output is "Bridge Tied" - that means the output pins connect directly to the speaker pins, no connection to ground. The output is a high frequency 250KHz square wave PWM that is then 'averaged out' by the speaker coil - the high frequencies are not heard. All the above means that you can't connect the output into another amplifier, it should drive the speakers directly.

![](https://cdn-learn.adafruit.com/assets/assets/000/122/204/medium800/adafruit_products_SAA_terminal_block_side.jpg?1688010215)

The board comes fully assembled and tested. We also include header to plug it into a breadboard and a 3.5mm screw-terminal blocks so you can easily attach/detach your speaker. You will be ready to rock in 15 minutes! **Speaker is not included, use any 4 ohm or greater impedance speaker.**

- Output Power: 2.5W at 4Ω, 10% THD, 1.5W at 8Ω, 10% THD, with 5.5V Supply
- 50dB PSRR at 1KHz
- Filterless design, with ferrite bead + capacitors on output.
- Fixed 24dB gain, onboard trim potentiometer for adjusting input volume.
- Thermal and short-circuit/over-current protection.
- Low current draw: 4mA quiescent and 0.5mA in shutdown (due to pullup resistor on SD pin)

**Note:** &nbsp;The terminal block included with your product may be blue or black.

# Adafruit STEMMA Audio Amp

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/122/207/medium800/adafruit_products_SAA_pinouts.jpg?1687997957)

## Power Pins

These pins are available both through the STEMMA connector, and as through-hole pads.

- **VIN** - This is the power pin. To power the board, provide 3V-5VDC.   
- **GND** &nbsp;- This is common ground for power.  

## Audio Input

This pin is available both through the STEMMA connector, and as a through-hole pad.

- **SIGNAL** - This is the audio input pin. Connect to a line level (~ 1Vpp) voltage audio signal to send audio to the amp. There is capacitive AC coupling so you can have a DC offset.

## Audio Output

- **VO+** - Connect the power wire on a compatible 4-8Ω speaker to this pin.&nbsp;
- **VO-** - Connect the ground wire on a compatible 4-8Ω speaker to this pin.

Bridge-Tied Load outputs mean you cannot connect these to another amplifier - they must connect to a speaker directly!

## STEMMA Connector

The **STEMMA connector** is located on the left side of the front of the board, below the PAM8302 on the board silk. You can use a **STEMMA JST PH 2mm 3-pin cable** to connect the amp to your microcontroller board, for example [this cable](https://www.adafruit.com/product/3893) to connect using a breadboard.

The STEMMA connector has the following pins:

- **SIGNAL** **(white wire)** - Audio input pin - line level AC or DC coupled input
- **VIN (red wire)** - Power pin, 3-5VDC
- **GND (black wire)** - Ground pin.

## Terminal Block

The **terminal block** is located on the right side of the front of the board, between the + and - on the board silk. Your terminal block may be blue or black.

The block has the following terminals:

- **-&nbsp;** - This terminal is towards the top of the board, and is located next to the - symbol on the board silk. It is the same as the VO- pin. Connect the ground wire on your speaker to this terminal.
- **+** - This terminal is towards the bottom of the board and is located next to the + symbol on the board silk. It is the same as the VO+ pin. Connect the power wire on your speaker to this terminal.

## Volume

The silver trimpot sitting top-center on the front of the board, labeled **Volume** , allows you to adjust the volume on the board down from the default 24dB gain.

## Power LED and Jumper

- **Power LED -&nbsp;** On the front of the board, below the STEMMA connector on the left, is the power LED, labeled **ON**. It is a green LED.
- **LED jumper** &nbsp;- In the lower right corner on the back of the board is a jumper for the power LED. If you wish to disable the power LED, simply cut the trace on this jumper. To enable it again, solder the pads back together.

# Adafruit STEMMA Audio Amp

## CircuitPython

It's easy to use the **STEMMA Audio Amp&nbsp;** with CircuitPython and the built-in `audiopwmio` module. This module allows you to play a simple tune through the speaker connected to the amp.

This page uses the Feather RP2040 to demonstrate.

## Wiring

Connect up the amp exactly as follows.

This diagram shows wiring it up using the STEMMA connector and the speaker terminal block.

Amp to Feather:

- **Feather A0** to **STEMMA Signal (white wire)&nbsp;**
- **Feather 3.3V** to **STEMMA VIN (red wire)&nbsp;**
- **Feather GND** to **STEMMA GND (black wire)&nbsp;**

Speaker to amp:

- **- side of terminal** to **speaker - (black wire)&nbsp;**
- **+ side of terminal** to **speaker + (red wire)&nbsp;**

![adafruit_products_SAA_FRP_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/319/medium640/adafruit_products_SAA_FRP_STEMMA_bb.jpg?1688591476)

This diagram shows wiring it up using a breadboard.

Feather to amp:

- **Feather GND** to **breakout GND (black wire)**
- **Feather 3.3V** to **breakout VIN (red wire)**
- **Feather A0** to **breakout Signal (white wire)**

Speaker to amp:

- **Speaker -** to **breakout VO-** **(black wire)&nbsp;**
- **Speaker +** to&nbsp; **breakout VO+** **(red wire)**

![adafruit_products_SAA_FRP_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/320/medium640/adafruit_products_SAA_FRP_breadboard_bb.jpg?1688591533)

## Example Code

To use with CircuitPython, you simply need to update **code.py** on your **CIRCUITPY** drive with the example code. No external libraries are needed.

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

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

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

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

Once you have copied **code.py** to your **CIRCUITPY** drive, you should hear a series of five tones, 0.5 seconds each, with a 1 second delay between. These tones play in a loop. That's all there is to using the STEMMA Audio amp to play a short tune!

## Code Configuration

There are two things you can configure in this demo.

The first is tone volume. It defaults to 0.1. You can increase this value to increase the volume of the tones.

```python
tone_volume = 0.1
```

The second is the tone frequencies. There are five frequencies, in Hz, provided in a specific order. You can change the Hz of any of these values to change one of the five tones. You can also add more values, following the same format with commas between them, to create a longer tune.

```python
tone_frequency = [784, 880, 698, 349, 523]
```

## Code Walkthrough

The whole demo put together is conceptually quite short.

Following imports and configuration, you create an `audio` object on pin **A0**.

```python
audio = AudioOut(board.A0)
```

Inside the `while` loop, there is a `for` loop. This nested loop runs once for each tone frequency, and then repeats.

```python
while True:
    for frequency in tone_frequency:
```

Inside the `for` loop, you first compute the sine wave for the current frequency.

```python
length = 8000 // frequency
sine_wave = array.array("H", [0] * length)
for index in range(length):
    sine_wave[index] = int((1 + math.sin(math.pi * 2 * index / length))
                           * tone_volume * (2 ** 15 - 1))

sine_wave_sample = RawSample(sine_wave)
```

At the end of the `for` loop, you play the computed sine wave for the current frequency for 0.5 seconds. Then you stop playing for 1 second.

```python
audio.play(sine_wave_sample, loop=True)
time.sleep(0.5)
audio.stop()
time.sleep(1)
```

When the code reaches the end of the 1 second silence, it begins the for loop again for the next frequency in the cycle.

# Adafruit STEMMA Audio Amp

## CircuitPython Docs

# Adafruit STEMMA Audio Amp

## Arduino

Using the Adafruit STEMMA Audio Amp with Arduino is as easy as wiring up the amp to an RP2040 microcontroller, and running the provided example code. **No libraries are necessary!** This page uses the Feather RP2040 to demonstrate.

## Wiring

Connect the audio amp to a Feather RP2040 exactly as shown below.

You can wire it up using the STEMMA port and the speaker terminal block.

Amp to Feather:

- **Feather A0** to **STEMMA Signal (white wire)&nbsp;**
- **Feather 3.3V** to **STEMMA VIN (red wire)&nbsp;**
- **Feather GND** to **STEMMA GND (black wire)&nbsp;**

Speaker to amp:

- **- side of terminal** to **speaker - (black wire)&nbsp;**
- **+ side of terminal** to **speaker + (red wire)&nbsp;**

![adafruit_products_SAA_FRP_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/315/medium640/adafruit_products_SAA_FRP_STEMMA_bb.jpg?1688590298)

Alternatively, you can use a solderless breadboard.

Feather to amp:

- **Feather GND** to **breakout GND (black wire)**
- **Feather 3.3V** to **breakout VIN (red wire)**
- **Feather A0** to **breakout Signal (white wire)**

Speaker to amp:

- **Speaker -** to **breakout VO-** **(black wire)&nbsp;**
- **Speaker +** to&nbsp; **breakout VO+** **(red wire)**

![adafruit_products_SAA_FRP_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/122/316/medium640/adafruit_products_SAA_FRP_breadboard_bb.jpg?1688590501)

## Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Adafruit_STEMMA_Audio_Amp/Arduino/PWMAudio_Mono_RP2040/PWMAudio_Mono_RP2040.ino

Once you've successfully uploaded the sketch to your Feather RP2040, you'll hear series of tones played through the speaker. That's your short tune!

# Adafruit STEMMA Audio Amp

## Arduino Docs

# Adafruit STEMMA Audio Amp

## Downloads

## Files

- [PAM8302 Datasheet](https://cdn-shop.adafruit.com/datasheets/PAM8302A.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-STEMMA-Audio-Amp-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20STEMMA%20Audio%20Amp.fzpz)

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

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


## Primary Products

### Adafruit STEMMA Audio Amp - Mono 2.5W Class D - PAM8302

[Adafruit STEMMA Audio Amp - Mono 2.5W Class D - PAM8302](https://www.adafruit.com/product/5647)
The **&nbsp;Adafruit STEMMA Audio Amp** is a&nbsp;super small mono amplifier is surprisingly powerful - able to deliver up to 2.5 Watts into 4-8 ohm impedance speakers. Inside the miniature chip is a class D controller, able to run from 2.0V-5.5VDC. Since the amp is a class D, its...

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

## Featured Products

### STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm](https://www.adafruit.com/product/3893)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3893)
[Related Guides to the Product](https://learn.adafruit.com/products/3893/guides)
### JST PH 2mm 3-pin Plug to Color Coded Alligator Clips Cable

[JST PH 2mm 3-pin Plug to Color Coded Alligator Clips Cable](https://www.adafruit.com/product/4030)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with grippy mini alligator clips. We're carrying these to match up with any of our boards or breakouts with 3-pin 'STEMMA' connectors on them such as the&nbsp;<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4030)
[Related Guides to the Product](https://learn.adafruit.com/products/4030/guides)
### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)
### JST PH 2mm 3-pin Plug-Plug Cable - 100mm long

[JST PH 2mm 3-pin Plug-Plug Cable - 100mm long](https://www.adafruit.com/product/4336)
This cable is a little over 100mm / 4" long&nbsp;and fitted with JST-PH 3-pin connectors on either end.&nbsp;

We dig the solid and compact nature of these connectors and the latch that keeps the cable from coming apart easily. We're carrying these to <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4336)
[Related Guides to the Product](https://learn.adafruit.com/products/4336/guides)
### Mono Enclosed Speaker with Plain Wires - 3W 4 Ohm

[Mono Enclosed Speaker with Plain Wires - 3W 4 Ohm](https://www.adafruit.com/product/4445)
Listen up! This single&nbsp; 2.8" x 1.2" speaker&nbsp;is&nbsp;the perfect addition to any audio project where you need 4 ohm impedance and 3W or less of power. We particularly like these speakers as they are small and enclosed for good audio volume and quality. This speaker _does..._

In Stock
[Buy Now](https://www.adafruit.com/product/4445)
[Related Guides to the Product](https://learn.adafruit.com/products/4445/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)

## Related Guides

- [GitHub Actions Status Tower Light](https://learn.adafruit.com/github-actions-status-tower-light.md)
- [xLights for Sparkle Motion Board](https://learn.adafruit.com/xlights-for-sparkle-motion-board.md)
- [Split Ortho Keyboard with TCA8418 Matrix Expanders](https://learn.adafruit.com/split-ortho-keyboard.md)
- [Adafruit NeoKey Trinkey](https://learn.adafruit.com/adafruit-neokey-trinkey.md)
- [50 Cent CPI Tracker for MagTag](https://learn.adafruit.com/50-cent-cpi-tracker-for-magtag.md)
- [Adafruit STHS34PF80 IR Presence / Motion Sensor](https://learn.adafruit.com/adafruit-sths34pf80-ir-presence-motion-sensor.md)
- [Adafruit MagTag COVID Vaccination Percent Tracker](https://learn.adafruit.com/adafruit-magtag-covid-vaccination-percent-tracker.md)
- [Minecraft Turbopad](https://learn.adafruit.com/minecraft-turbopad.md)
- [Make It Change: Potentiometers](https://learn.adafruit.com/make-it-change-potentiometers.md)
- [CircuitPython Libraries on any Computer with Raspberry Pi Pico](https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-raspberry-pi-pico.md)
- [Adafruit MCP23017 I2C GPIO Expander](https://learn.adafruit.com/adafruit-mcp23017-i2c-gpio-expander.md)
- [Scrambled Number Security Keypad](https://learn.adafruit.com/scrambled-number-security-keypad.md)
- [PyPortal Case](https://learn.adafruit.com/pyportal-case.md)
- [Adafruit ESP32-S2 Feather](https://learn.adafruit.com/adafruit-esp32-s2-feather.md)
- [Adafruit LIS2MDL Triple Axis Magnetometer](https://learn.adafruit.com/adafruit-lis2mdl-triple-axis-magnetometer.md)
