The setup of a bluetooth speaker on a Pi Zero W is pretty touchy.
Please get in touch via Twitter @actuino or http://www.actuino.fr/ if you've got comments or improvements to this quick draft.
- 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.
- Use a raspbian Pixel, run
sudo apt-get update
thensudo apt-get dist-upgrade
and reboot. - use the graphical widget to pair and connect your speaker. You may have to try twice or more.
pi-bluetooth and bluez are already installed on recent Raspbian.
Install:
sudo apt-get install pulseaudio pulseaudio-module-bluetooth
(without this module, you get messages like "bluetoothd[5556]: 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
sudo reboot
pulseaudio --start
If it complains about not being able to spawn a local server, run
pax11publish -r; /usr/bin/pulseaudio --start
run bluetoothctl
use "help" if you want more details about the available commands. The first time, you'll have to run the following:
power on
agent on
scan on
- wait for the device to be discovered, note it's address (you can then use tab for auto-completion)
pair <dev>
trust <dev>
connect <dev>
wait for the confirmation, thenquit
test : aplay something.wav
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 :
[Policy]
AutoEnable=true
You may need to:
pulseaudio --start
(This last step was not useful for me):
bluetoothctl -a
then wait and quit when (auto) connected
- 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.
Couldn't get it to work sadly. Followed all the steps, Configuration all seemed to work just fine, no trouble finding or pairing to my Ikea Eneby 20. When I tried to use the aplay command to play one of my .wav files it started playing on my HiFi (via HDMI).
I made sure I didn't force audio to play through HDMI in raspi-config, but it's set to Auto. I then right-clicked the volume control in the bottom right and noticed audio was being sent to HDMI. I clicked 'Eneby 20' and I could see that it switched to that, tried again and no audio from the speaker (or my HiFi).
Rebooted the Pi a couple times, it automatically connected to the speaker, audio settings remaimed, but still no Audio. Not sure where to start troubleshooting.
By the way, when it's working should it work with any software? Could I use Chromium or a Volumio to send audio to the speaker? Because if I can only play audio from the commandline using aplay it wouldn't really fit my needs.