Overview
The PAM8406 is a tiny stereo Class-D audio amplifier that turns a 5V rail and a line-level signal into real speaker volume: 5W + 5W into 4-ohm speakers, or about 3W + 3W into 8-ohm. Class-D means the output transistors switch rather than dissipate — efficiency runs around 90%, so there's no heatsink, almost no heat, and it runs happily from USB power banks and single-cell boost circuits.
This CJMCU-style breakout brings out everything on clearly labeled pads: stereo inputs (INL/INR with GND between), stereo bridged outputs (+L/-L and +R/-R), and 5V power — with a hefty 1000uF reservoir capacitor onboard to steady the supply during bass hits. Feed it from a phone's headphone jack, an ESP32 DAC pin, a Pi's audio output, or a filtered PWM pin on any microcontroller.
It's the go-to amp for project speakers, talking gadgets, arcade cabinets, intercoms, and audio-reactive builds. One rule matters above all: the outputs are bridge-tied (BTL) — each speaker terminal is actively driven — so speaker minus pins must never touch ground or each other. Wire each speaker only across its own +/- pair and the amp will run cool for years.
At a Glance
Specifications
| Parameter | Value |
| Amplifier IC | PAM8406 filterless Class-D stereo |
| Supply Voltage | 2.5V - 5.5V DC (5V nominal) |
| Output Power | 5W/ch @ 4 ohm, 3W/ch @ 8 ohm (5V, 10% THD) |
| Output Topology | Bridge-tied load (BTL) — outputs must float |
| Efficiency | Up to ~90% |
| THD+N | ~0.1% at 1W typical |
| Input | Stereo line level (INL / INR), ~10k input impedance |
| Quiescent Current | ~10-20 mA (no signal) |
| Peak Current | Up to ~2 A on loud bass — size the supply accordingly |
| Onboard Reservoir | 1000 uF / 16V electrolytic |
| Pads | +R -R -L +L | INR GND INL | GND VCC |
Pinout Diagram
Left edge: the four speaker pads — +R/-R for the right speaker, -L/+L for the left. Right edge, top group: the audio input — INR, GND, INL — which maps directly onto a 3.5mm stereo plug (tip = left, ring = right, sleeve = GND). Right edge, bottom group: GND and VCC for the 5V supply. The big can capacitor between them is the onboard reservoir.
Wiring Guide
Arduino Wiring (filtered PWM tones)
The Uno has no DAC, so tone() output is tamed with a simple RC filter before the amp input.
| Connection | Details |
|---|---|
| D9 → 1k resistor → INL | PWM/tone output into left input |
| INL → 100nF cap → GND | RC low-pass (~1.6 kHz corner) |
| Input GND → Arduino GND | Shared signal ground |
| VCC / GND | 5V / GND (USB is fine for beeps) |
| Left speaker → +L and -L | 4-8 ohm, across the pair only |
ESP32 Wiring (true DAC output)
The classic ESP32 has two real 8-bit DACs — GPIO 25 and 26 — which drive the PAM8406 directly with no filter needed.
| Module Pad | ESP32 Pin | Details |
|---|---|---|
| INL | GPIO 25 (DAC1) | Left channel |
| INR | GPIO 26 (DAC2) | Right channel (optional) |
| Input GND | GND | |
| VCC / GND | VIN (5V) / GND | Amp power |
| Speakers | +L/-L and +R/-R | Across each pair |
Raspberry Pi Wiring (line-out or USB audio)
Feed the amp from the Pi's 3.5mm jack (models that have one) or a USB sound dongle — the highest-quality route — and keep the Pi and amp grounds common.
| Connection | Details |
|---|---|
| 3.5mm tip → INL | Left audio |
| 3.5mm ring → INR | Right audio |
| 3.5mm sleeve → input GND | Audio ground |
| VCC / GND | Pin 2 (5V) / Pin 6 (GND) |
| Speakers | +L/-L and +R/-R pairs |
Raspberry Pi Pico Wiring (filtered PWM)
| Connection | Details |
|---|---|
| GP15 → 1k resistor → INL | PWM audio out |
| INL → 100nF cap → GND | Low-pass filter |
| Input GND → Pico GND | |
| VCC | VBUS (pin 40, 5V) |
| GND | GND (pin 38) |
| Left speaker | +L and -L |
Code Examples
The Arduino and Pico examples play melodies over filtered PWM; the ESP32 example synthesizes a sine sweep on its true DAC; the Pi example plays any audio file through the amp with one command plus a Python volume-sweep script.
Arduino
// PAM8406 Amplifier - Arduino Example (tone melody)
// D9 -> 1k -> INL, INL -> 100nF -> GND, speaker across +L/-L
const int audioPin = 9;
// Simple startup jingle: note frequency (Hz) and duration (ms)
const int melody[][2] = {
{262, 200}, {330, 200}, {392, 200}, {523, 400},
{392, 200}, {523, 600},
};
void setup() {
Serial.begin(9600);
Serial.println("Playing jingle on PAM8406...");
}
void loop() {
for (unsigned int i = 0; i < sizeof(melody) / sizeof(melody[0]); i++) {
tone(audioPin, melody[i][0]);
delay(melody[i][1]);
noTone(audioPin);
delay(30);
}
delay(2000);
}
ESP32 (Arduino IDE, DAC sine)
// PAM8406 Amplifier - ESP32 Example (DAC sine sweep)
// INL -> GPIO 25 (DAC1), input GND -> GND, VCC -> VIN(5V)
#include <math.h>
const int SAMPLES = 64;
uint8_t sine[SAMPLES];
void setup() {
Serial.begin(115200);
for (int i = 0; i < SAMPLES; i++) {
sine[i] = 128 + 100 * sinf(2 * PI * i / SAMPLES); // 8-bit sine
}
Serial.println("Sweeping 200 Hz - 2 kHz on DAC1...");
}
void playTone(float freq, int ms) {
// per-sample delay in microseconds for the target frequency
int us = (int)(1000000.0f / (freq * SAMPLES));
long end = millis() + ms;
int i = 0;
while (millis() < end) {
dacWrite(25, sine[i]);
i = (i + 1) % SAMPLES;
delayMicroseconds(us);
}
}
void loop() {
for (float f = 200; f <= 2000; f *= 1.12f) {
playTone(f, 120);
}
dacWrite(25, 128); // rest at midpoint = silence
delay(1500);
}
Raspberry Pi (Python)
#!/usr/bin/env python3
# PAM8406 Amplifier - Raspberry Pi Example
# Audio out (3.5mm or USB dongle) -> INL/INR/GND, VCC -> 5V
# Plays a test file and sweeps the system volume.
# Install: sudo apt install alsa-utils; put test.wav in the same folder
import subprocess
import time
def set_volume(percent):
subprocess.run(
["amixer", "sset", "Master", "{}%".format(percent)],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print("Sweeping volume up while playing test.wav...")
player = subprocess.Popen(["aplay", "test.wav"])
try:
vol = 20
while player.poll() is None:
set_volume(vol)
print("Volume: {}%".format(vol))
vol = min(90, vol + 10)
time.sleep(1)
print("Done.")
except KeyboardInterrupt:
player.terminate()
print("Stopped by user")
Raspberry Pi Pico (MicroPython)
# PAM8406 Amplifier - Pico MicroPython Example (PWM melody)
# GP15 -> 1k -> INL, INL -> 100nF -> GND, speaker across +L/-L
from machine import Pin, PWM
import time
spk = PWM(Pin(15))
MELODY = [
(262, 200), (330, 200), (392, 200), (523, 400),
(392, 200), (523, 600),
]
def play(freq, ms):
spk.freq(freq)
spk.duty_u16(32768) # 50% duty = loudest square tone
time.sleep_ms(ms)
spk.duty_u16(0) # silence between notes
time.sleep_ms(30)
print("Playing jingle on PAM8406...")
while True:
for freq, ms in MELODY:
play(freq, ms)
time.sleep(2)