Raspberry Pi as a Bluetooth A2DP Speaker Interface

ยท

Got a decent set of passive speakers but no way to stream audio to them wirelessly? A Raspberry Pi makes an excellent Bluetooth A2DP receiver – turning any speaker system into something you can stream to from your phone, laptop, or tablet. This guide covers the full setup on modern Raspberry Pi OS Lite, from a fresh flash to auto-connecting on boot.

What you’ll need

  • A Raspberry Pi (any model with built-in Bluetooth works – Pi 3, 4, or 5; older models need a USB Bluetooth adapter)
  • A micro SD card (8GB minimum)
  • A USB audio adapter or DAC if you want line-out quality (the Pi’s 3.5mm output is usable but not hifi)
  • Speakers connected via 3.5mm or your DAC’s output
  • SSH access to your Pi

1. Flash and set up Raspberry Pi OS Lite

Download Raspberry Pi Imager and flash Raspberry Pi OS Lite (64-bit) to your SD card. In the Imager’s settings, configure your Wi-Fi credentials and enable SSH before flashing – this saves you needing a monitor and keyboard.

Boot your Pi, then SSH in:

ssh pi@raspberrypi.local

2. Install dependencies

Update the system first, then install PulseAudio with Bluetooth support:

sudo apt update && sudo apt upgrade -y
sudo apt install -y pulseaudio pulseaudio-module-bluetooth bluez bluez-tools alsa-utils

Add the pi user to the bluetooth and pulse-access groups:

sudo usermod -a -G bluetooth,pulse-access pi

3. Configure Bluetooth for always-on discoverability

Edit /etc/bluetooth/main.conf and set the following in the [General] section:

[General]
DiscoverableTimeout = 0
Class = 0x200408
Enable = Source,Sink,Media,Socket

Setting DiscoverableTimeout = 0 keeps the Pi permanently visible to Bluetooth devices. The Class value identifies it as an audio device to your phone or laptop.

Restart Bluetooth and make it discoverable:

sudo systemctl restart bluetooth
sudo bluetoothctl
power on
discoverable on
pairable on
exit

4. Configure PulseAudio

Edit /etc/pulse/default.pa and comment out the suspend-on-idle module – this stops PulseAudio from cutting out when audio pauses briefly:

# Comment this line out:
# load-module module-suspend-on-idle

Then configure PulseAudio to autostart. Edit /etc/pulse/client.conf and ensure this line is present and uncommented:

autospawn = yes

Enable PulseAudio as a system service:

sudo systemctl enable pulseaudio
sudo systemctl start pulseaudio

Verify sinks are running:

pacmd list-sinks

You should see state: IDLE – that means PulseAudio is running and waiting for audio input.

5. Pair a device

On your phone or laptop, scan for Bluetooth devices. You should see your Pi listed – the name defaults to raspberrypi but you can change it in /etc/hostname. Pair it like any other Bluetooth speaker.

For auto-reconnect on future boots, use bluetoothctl to trust the device after pairing:

sudo bluetoothctl
trust AA:BB:CC:DD:EE:FF   # replace with your device's MAC address
exit

6. Auto-start on boot

To make the Pi advertise itself and reconnect automatically every time it boots, create a simple systemd service. Create /etc/systemd/system/bt-discoverable.service:

[Unit]
Description=Make Bluetooth discoverable and pairable on boot
After=bluetooth.target

[Service]
Type=oneshot
ExecStart=/usr/bin/bluetoothctl discoverable on
ExecStartPost=/usr/bin/bluetoothctl pairable on
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
sudo systemctl enable bt-discoverable
sudo systemctl start bt-discoverable

Troubleshooting

No audio output after pairing: Check PulseAudio is running with pulseaudio --check. If not, start it manually with pulseaudio -D and check journalctl -xe for errors.

Audio cuts out after a few seconds: The suspend-on-idle module is still active. Double-check it’s commented out in /etc/pulse/default.pa and restart PulseAudio.

Pi not appearing in Bluetooth scan: Run sudo bluetoothctl show and confirm Discoverable: yes. If not, run sudo bluetoothctl discoverable on manually and check your main.conf settings.

Poor audio quality: The Pi’s built-in 3.5mm output is functional but not great. A cheap USB audio adapter or a dedicated DAC like the HiFiBerry DAC2 will make a noticeable difference.

What to do next

Once this is working, you’ve got a solid foundation to build on. A few directions worth exploring:

  • Add shairport-sync to also accept AirPlay streams alongside Bluetooth
  • Add Raspotify to make the Pi a Spotify Connect target
  • Connect the Pi to an amplifier board like the HiFiBerry Amp3 for a fully self-contained powered speaker system
  • Use a Pi Zero 2 W to keep the whole build tiny and low-power

The Pi makes an surprisingly capable audio receiver for the price – and unlike a commercial Bluetooth speaker, you can extend it however you like.

Jonathan Mitchell, CTO | CITP | MSc


Leave a Reply