[GUIDE] Volumio Bluetooth broadcaster (REQUIRES PULSEAUDIO)


I just successfully made Volumio play music simultaneously on my wired speaker, and wirelessly on a Bluetooth speaker! :wink:

NOTICE: I’m using Volumio with PulseAudio. This modification is covered by my earlier topic: volumio2-rpi-zero-with-phatbeat-dac-and-pulseaudio-t8493.html , however it is hardware-specific. Following guide will not work for default ALSA sound manager!

So here is a quick guide, I hope I will not skip any step I performed on my way. I would be more than glad if anyone could try that guide, and let me know if anything is missing!

  1. Install necessary packets from APT repository:
apt-get install bluez bluez-tools bluez-firmware pi-bluetooth blueman pulseaudio-module-bluetooth
  1. Download latest BlueZ sources, prepare dependencies, unpack, change directory:

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz apt-get install libdbus-1-3 libc6 libusb-dev libdbus-1-dev libglib2.0-dev libudev1 libudev-dev libical-dev libreadline-dev libsbc1 tar xvf bluez-5.50.tar.xz cd bluez-5.50
3. Apply patch for hciattach from there: gist.github.com/pelwell/c8230c48ea24698527cd
4. Build and install latest BlueZ - it will overwrite the old BlueZ from APT repository, which is good!:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental --enable-deprecated
sudo make install
  1. Give your user (‘volumio’ in my case) rights for using bluetoothctl without root rights. To do that, append code below into /etc/dbus-1/system.d/bluetooth.conf next to similiar existing entry:
<policy user="volumio">
    <allow own="org.bluez"/>
    <allow send_destination="org.bluez"/>
    <allow send_interface="org.bluez.Agent1"/>
    <allow send_interface="org.bluez.MediaEndpoint1"/>
    <allow send_interface="org.bluez.MediaPlayer1"/>
    <allow send_interface="org.bluez.Profile1"/>
    <allow send_interface="org.bluez.GattCharacteristic1"/>
    <allow send_interface="org.bluez.GattDescriptor1"/>
    <allow send_interface="org.bluez.LEAdvertisement1"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>
  1. Create /etc/bluetooth/main.conf file and write to it:
Class = 0x20041C

  1. Make sure your /lib/systemd/system/hciuart.service looks like below, or create it (triple exec might not be required with patch above, I patched it only partly):
Description=Configure Bluetooth Modems connected by UART

ExecStartPre=-/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow
ExecStart=-/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow
ExecStopPost=-/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow

  1. Make sure your /lib/systemd/system/bluetooth.service looks like below, or create it:
Description=Bluetooth service


  1. Enable both services:
systemctl enable hciuart
systemctl enable bluetooth
  1. Add following UDev rules:
# Set bluetooth power up
ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="/bin/hciconfig %k up"


ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci0:[0-9]*", RUN+="/usr/local/bin/on-bt-speaker-connect"
  1. Create /usr/local/bin/on-bt-speaker-connect file with following content, but replace slaves attribute content with names of your PulseAudio sinks (get them using command: pactl list:
sleep 5
pacmd load-module module-combine-sink sink_name=combined slaves=alsa_output.pivumeter,bluez_sink.30_21_92_11_2D_AA
pacmd set-default-sink combined
  1. Add execution rights to it:
sudo chmod +x /usr/local/bin/on-bt-speaker-connect
  1. Reboot
  1. Run bluetoothctl, start scanning, find your device address, pair it and trust it:
volumio@volumio:~$ bluetoothctl
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 43:43:A1:12:1F:AC Discovering: yes
[NEW] Device 30:21:92:11:2D:AA BTS-06
[bluetooth]# pair 30:21:92:11:2D:AA
[bluetooth]# trust 30:21:92:11:2D:AA
[bluetooth]# connect 30:21:92:11:2D:AA
[bluetooth]# quit

15. Reboot, and voila! :sunglasses:

Now, whenever you turn on your BT speaker, the script will be called that will change sinks in PulseAudio, and enable simulatanous output to your wired speaker and BT speaker! If you disconnect, it will continue to play on the wired speaker. Volume setting in Volumio affects only the wired speaker, for BT speaker you set in on the speaker. There is a delay between both, so it’s not suitable for boosting the sound within the same room. I’ve personally used it for waterproof speaker under the shower! :slight_smile:

If you face any issues on the way with this guide, and you are not giving up easily, always go through output of:

sudo journalctl

It helped me a 100 times! Grepping by ‘blue’ or ‘pulseaudio’ is helpful as well :wink:

Good luck, and enjoy!!! :mrgreen:

is this guide workable on x86 version of Volumio?
If not, how to make it?