The setup of a bluetooth speaker on a Pi Zero W is pretty touchy.
- Use a solid power source
- check the speaker works on another hardware (android phone f.i.)
- make sure you've updated your Raspbian, install and run rpi-update just in case.
In case of compatibility doubt
- Use a raspbian Pixel, run
sudo apt-get updatethen
sudo apt-get dist-upgradeand reboot.
- use the graphical widget to pair and connect your speaker. You may have to try twice or more.
What to install?
pi-bluetooth and bluez are already installed on recent Raspbian.
sudo apt-get install pulseaudio pulseaudio-module-bluetooth
(without this module, you get messages like "bluetoothd: a2dp-sink profile connect failed for 00:1D:43:6D:03:26: Protocol not available")
Add your pi user to the bluetooth group
sudo usermod -G bluetooth -a pi
Start a pulseaudio server
If it complains about not being able to spawn a local server, run
pax11publish -r; /usr/bin/pulseaudio --start
Pair and connect
use "help" if you want more details about the available commands. The first time, you'll have to run the following:
- wait for the device to be discovered, note it's address (you can then use tab for auto-completion)
connect <dev>wait for the confirmation, then
edit /etc/pulse/default.pa , add
# automatically switch to newly-connected devices load-module module-switch-on-connect
edit /etc/bluetooth/main.conf, at the end of the file, add AutoEnable in the existing Policy section :
After a reboot
You may need to:
(This last step was not useful for me):
bluetoothctl -athen wait and quit when (auto) connected
Still have to sort out
- Sometimes, the BT speaker disconnects itself, but it's still viewed as "connected" from the Pi. From this point, nothing will fix it exept a Pi reboot.