Hardware Requirements:
- Original ESP32/WROOM-32 with Bluetooth Classic
- PCM5102A DAC
- Arduino IDE
What we are Building
- Bluetooth A2DP receiver
- Stereo bass, mid and treble EQ
- Flat, Rock, Jazz and Classical presets
- Serial control for initial tuning
It uses the current ESP32-A2DP and Arduino Audio Tools approach. ESP32-A2DP receives SBC audio as 16-bit stereo PCM, and Audio Tools provides the I²S output layer.
Required Libraries
In Arduino IDE → Library Manager, install:
- ESP32-A2DP by Phil Schatzmann
- Arduino Audio Tools by Phil Schatzmann
- btAudio - https://github.com/tierneytim/btAudio#c
Select an original ESP32 board, such as ESP32 Dev Module. The ESP32-S3 and C3 are unsuitable because they do not support Bluetooth Classic A2DP.
Pinout
| PCM5102A | ESP32 |
|---|---|
| BCK | GPIO 26 |
| LCK, LRCK or WS | GPIO 27 |
| DIN | GPIO 25 |
| SCK | GND |
| GND | GND |
| VIN | 5 V |
If exposed:
FMT→ GND for standard I²SXSMT→ 3.3 V for unmuted operationSCK→ GND on the common PLL-equipped modules
These pin assignments correspond to the established ESP32-A2DP PCM5102 setup.
Code
Using btAudio
#include <btAudio.h>
// Sets the name of the audio device
btAudio audio = btAudio("ESP_Speaker");
void setup() {
// Streams audio data to the ESP32
audio.begin();
// Re-connects to last connected device
audio.reconnect();
// Outputs the received data to an I2S DAC, e.g. https://www.adafruit.com/product/3678
int bck = 26;
int ws = 27;
int dout = 25;
audio.I2S(bck, dout, ws);
}
void loop() {
}
References
| Reference | URL |
|---|---|
ESP32-A2DP | https://github.com/pschatzmann/ESP32-A2DP |
Arduino Audio Tools | https://github.com/pschatzmann/arduino-audio-tools |
| btAudio | https://github.com/tierneytim/btAudio#c |
| ESP32 Bluetooth Audio example with PCM5102A I2S module | https://www.youtube.com/watch?v=I2s0DBARlKg&t=7s |


