Skip to content

Connecting_Bluetooth_device_to_Phoniebox

Alvin Schiller edited this page Dec 22, 2023 · 4 revisions

Connecting Bluetooth device to Phoniebox

Taken from the Phoniebox@GitHub issues forum

Connecting your Raspberry Pi Phoniebox to Bluetooth speakers or headsets:

  • Have a finished Phoniebox running (this howto was tested on the Phoniebox Classic meaning: no Spotify, version 1.1.7)
    • Tested on Raspberry Pi Zero W
    • Raspbian Image "2018-10-09-raspbian-stretch-lite"
    • Phoniebox 1.1.7 Classic - without Spotify

Make an update and install the required software:

Note

The package bluealsa isn't available anymore since bullseye. For bookworm you can use bluez-alsa-utils instead.

sudo apt update && sudo apt upgrade
sudo apt install bluealsa
sudo reboot

The reboot is necessary!

Switch on your Bluetooth speakers / gadgets. Then:

sudo bluetoothctl

And type in the following commands in this order:

power on
agent on
scan on

Now the Phoniebox is looking for nearby Bluetooth equipment, which looked like this in my case:

pi@phoniebox:~ $ sudo bluetoothctl
[NEW] Controller B8:27:EB:26:53:17 phoniebox [default]
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:26:53:17 Discovering: yes
[NEW] Device FC:58:FA:DD:AA:D2 MD 43438

Note down the Mac address of your hardware, we need it later. In my case: [NEW] Device FC:58:FA:DD:AA:D2 MD 43438

Now the pairing happens. This is what I did, you need to replace the MAC address with the one from your hardware: pair FC:58:FA:DD:AA:D2

trust the hardware trust FC:58:FA:DD:AA:D2

connect to the hardware connect FC:58:FA:DD:AA:D2

Stop the discovery mode scan off exit

Create a new file sudo nano /etc/asound.conf

This is the content of the new file (in my case, again use your MAC address). I called my device here pcm.btspeaker. You can change that name to e.g. pcm.sonosspeaker`

pcm.btspeaker {
    type plug
    slave.pcm {
        type bluealsa
        service "org.bluealsa"
        device "FC:58:FA:DD:AA:D2"
        profile "a2dp"
        delay -20000
    }
    hint {
        show on
        description "Medion Partybox"
    }
}

Try if it works. If you used a different name than pcm.btspeaker you need to change it in the following command: aplay -D btspeaker /usr/share/sounds/alsa/Front_Center.wav

Almost done, you need to edit the mpd.conf file: sudo nano /etc/mpd.conf

Look for audio_output and edit some lines. In my case to this:

        type            "alsa"
        name            "My ALSA Device"
        device          "btspeaker"    # see https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/284#issuecomment-443497319
        mixer_type      "software"      # optional

Done and good luck! Questions, suggestion, etc in the thread linked at the top of this document.

Home

πŸ”₯ Version 3

Version 3 Pages

Nothing yet

🎢 Version 2

Version 2 Pages

Installation

Specials

RFID Reader

Sound card configurations

Hardware Buttons

Displays (LED, LCD, Matrix, etc.)

Hacks

Bluetooth

AirPlay

MPD tricks

For Developers

Clone this wiki locally