Bluetooth Speaker Plugin

I rewrote the avrcp handling to fix some issues (not recognizing device / crash on disconnect)…
I hope this fixed some of the issues with remote controlling volumio from the speaker.

1 Like

Hi, do you mean this post:
geeks-r-us.de/2017/08/18/bluetoo … pberry-pi/ ?

I don’t see any connection to Volumio. Does this mean, the described connection to the bluetooth speakers works independently from Volumio?

This post is about how to setup the basic services to enable the Bluetooth A2DP (Stereo Audio over Bluetooth) communication on a Linux system.
Because this features is still in development and not in a stable state it is not very well documented and this post is a write up to help others to set up the service.
Most features of Volumio base on Linux services. Volumio’s task is to glue the services together and make them controllable through a nice front-end.

AVRCP is another Bluetooth profile that allows a keyboard-like communication with the host. In the case of speakers play/pause/next/prev…

So please don’t mix up all those different things.

What this Plugin do:
[] setting up your RPI to be able to use A2DP and AVRCP protocols
[
] give you a rudimentary front-end to control your bluetooth controller (make it visible to others, pair visible devices and connect them to the A2DP service). And yes the front-end is surely not as neat and clear as it could be but I’m no front-end developer. mea culpa.
[] let you control Volumio from remote by the AVRCP protocol.
[
] improve over the time

What this Plugin can’t do:
[] improve stability of the Bluetooth connection
[
] improve support of devices

To conclude the service is still under development and there are still some unsolved problems like interference of Bluetooth and WLAN (because they share the same antenna), stable long running A2DP connections… which are a general problem of the Linux services and many smart people are working on this to fix them. This just packages the current state into the front-end and is updated when things improve or front-end bugs are reported. And when it is in a stable state it will be released to the plugin manager. So don’t consider this plugin as a ready on-click solution for unsolved problems.

Thanks for the reply. In my case, the bluetooth speaker is displayed as connected, but it remains silent if I play a song in Volumio. Have you an idea what could have gone wrong?

All I could say without logs: If you use a Raspberry Pi 3 with latest version it should work.

I experienced a bad Bluetooth signal quality with my current setup so a jitter free playback was only possible in a range of about 3 meters.
Which is not really the idea behind wireless speakers.

So I added a external WLAN antenna to my RPi.
A little write up of the steps can be found on my blog http://geeks-r-us.de/2018/01/07/raspberry-pi3-reichweite-von-wlan-und-bluetooth-verbessern/. (It’s in German but Google translate is your friend :wink: )

UPDATE:

Due to there were some requests which components to use I added a kit to the online shop on the site.

Ok, I just tried it again, but without (long) success. My system:

  • RPi3
  • Volumio 2.296
  • bluetooth speaker: UE boom

I followed the instructions reported in the 1st post and I could establish a connection to my speaker (which is 1m apart from the raspi) for about 5 minutes. Then the sound began to shake and ended up in complete silence. Here is the log generated by “sudo journalctl -f” during the connection loss:

Jan 08 17:59:32 volumio bluealsa[782]: /usr/bin/bluealsa: BT socket write error: Resource temporarily unava ilable Jan 08 17:59:32 volumio kernel: Bluetooth: hci0 link tx timeout Jan 08 17:59:32 volumio kernel: Bluetooth: hci0 killing stalled connection 88:c6:26:c4:b3:de Jan 08 17:59:33 volumio volumio[977]: info: CoreCommandRouter::executeOnPlugin: mpd , handleBrowseUri Jan 08 17:59:33 volumio volumio[977]: info: CURURI: albums://Amy%20Winehouse/Back%20to%20Black Jan 08 17:59:34 volumio kernel: Bluetooth: hci0 command 0x041f tx timeout Jan 08 17:59:36 volumio volumio[977]: Extracted metadata : /data/albumart/metadata///mnt/NAS/Musik/Alben/De peche Mode/The Complete Depeche Mode/metadata.jpeg Jan 08 17:59:36 volumio kernel: Bluetooth: hci0 command 0x0406 tx timeout Jan 08 17:59:39 volumio bluetoothd[771]: Suspend: Connection timed out (110) Jan 08 17:59:39 volumio kernel: Bluetooth: hci0 link tx timeout Jan 08 17:59:39 volumio kernel: Bluetooth: hci0 killing stalled connection 88:c6:26:c4:b3:de Jan 08 17:59:39 volumio volumio[977]: error: Upnp client error: Error: read ECONNRESET Jan 08 17:59:39 volumio volumio[977]: error: MPD error: Error: read ECONNRESET Jan 08 17:59:39 volumio volumio[977]: Upnp client error: Error: This socket has been ended by the other par ty Jan 08 17:59:41 volumio bluetoothd[771]: Abort: Connection timed out (110) Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 link tx timeout Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 killing stalled connection 88:c6:26:c4:b3:de Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 link tx timeout Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 killing stalled connection 88:c6:26:c4:b3:de Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 link tx timeout Jan 08 17:59:41 volumio kernel: Bluetooth: hci0 killing stalled connection 88:c6:26:c4:b3:de Jan 08 17:59:41 volumio volumio[977]: info: removed device { Jan 08 17:59:41 volumio volumio[977]: "syspath": "/sys/devices/virtual/input/input2/event2", Jan 08 17:59:41 volumio volumio[977]: "ACTION": "remove", Jan 08 17:59:41 volumio volumio[977]: "DEVNAME": "/dev/input/event2", Jan 08 17:59:41 volumio volumio[977]: "DEVPATH": "/devices/virtual/input/input2/event2", Jan 08 17:59:41 volumio volumio[977]: "ID_INPUT": "1", Jan 08 17:59:41 volumio volumio[977]: "ID_INPUT_KEY": "1", Jan 08 17:59:41 volumio volumio[977]: "MAJOR": "13", Jan 08 17:59:41 volumio volumio[977]: "MINOR": "66", Jan 08 17:59:41 volumio volumio[977]: "SEQNUM": "1181", Jan 08 17:59:41 volumio volumio[977]: "SUBSYSTEM": "input", Jan 08 17:59:41 volumio volumio[977]: "USEC_INITIALIZED": "861" Jan 08 17:59:41 volumio volumio[977]: } Jan 08 17:59:42 volumio volumio[977]: info: removed device { Jan 08 17:59:42 volumio volumio[977]: "syspath": "/sys/devices/virtual/input/input2", Jan 08 17:59:42 volumio volumio[977]: "ACTION": "remove", Jan 08 17:59:42 volumio volumio[977]: "DEVPATH": "/devices/virtual/input/input2", Jan 08 17:59:42 volumio volumio[977]: "EV": "100007", Jan 08 17:59:42 volumio volumio[977]: "ID_INPUT": "1", Jan 08 17:59:42 volumio volumio[977]: "ID_INPUT_KEY": "1",

A reboot brings the music back again for another 5 minutes…

Maybe it’s rather a hardware issue than a software problem.

EDIT:
After reboot the connection seems to be stable now!! :smiley: :smiley:

Is this plugin intended for streaming music FROM Volumio, or is it possible to stream TO Volumio? My use case is to stream from my phone via bluetooth to a Pi 3 running Volumio with music output via the headphone jack. I’m using Volumio because I’ll have a screen attached and I hope to see song info displayed.

Thanks

This is planed but not fully implemented right now.
But you can use it in this way with some extra work.
The plugin allows you to set the volumio bt to visible to your phone and should allow pairing (not extensively tested)

somewhere else in the forum are the steps noted you need to change to be able to play music from you phone on volume
I thing it was noted here: https://volumio.org/forum/a2dp-bluetooth-support-t1475-40.html

I am currently running Volumio version 2.348. I have copied over the UI files just fine, as well as installed the Bluetooth Speaker plugin. All things work fine. I am also able to connect to my speakers.

However, I do not hear any sound. After running sudo journalctl -f I did not notice any outstanding errors.

One thing I do know is that there is no ability to choose “Bluetooth” as an option within the Playback Options. I have looked through this forum, as well as pretty much all of the GitHub links that have been provided, but haven’t been able to find an answer to why the audio is not playing through the speakers. I have also tried on several different bluetooth speakers, with the same result.

I know that I am very close to figuring this out, so any push in the right direction is helpful. If you need any more information, I would be happy to provide it.

Thank you for creating this plugin, as well!

Here is a method that works OK for me, I can stream from my phone to volumio. You have to pair it manually but you don’t need to change that often anyway. Please look at the end of the thread for the updated script I modified. I have also got a much newer version of Bluez installed on my setup (default Pi repository is 5.23, newest is 5.48).

volumio-bluez-alsa-a2dp-bluetooth-support-t6130.html

The Bluetooth speaker is currently added as a second audio sink beside the selected output (audio jack, HDMI, DAC … ) so both will output the audio (bt has a little delay to the other output because of the encoding, transmission, decoding, stuff).

Bluetooth first starts playback after the a speaker is connected and a mpd starts a playback. mpd is not capable to attach the second sink to a running audio output.

Thanks for the reply.

Is there any other information I could send you to see what I need to do to get this speaker to play? I know that’s a pretty broad question, but I’m just going with what I got.

I’ve installed the plugin and it is working great with music located on a usb drive. However, I can’t get it to work in combination with the Spotify plugin.

I assumed it had something to do with the way spopd outputs the audio stream using sox/ao/oss/dummy. Therefore I’ve been playing around with different outputs (github.com/Schnouki/spop/blob/m … onf.sample). However none of them appear to work.

Could anyone help me in the right direction?

(i’m on v2.368 using a rpi3)

Plugin works great for my setup (2.368, RPI 3b, 7" Touch, XB40 BT speakers), with the UI and plugin from the first post. thanks for the work!

Is there any chance that the plugin become official and the UI is integrated?

I tried to update the 2.368 UI with the BluetoothPluginController, but there is no chance with a texteditor. How can I do this?

Hi everyone.
I contributed to the following thread last year.
volumio-bluez-alsa-a2dp-bluetooth-support-t6130.html
and also started this new thread
zero-bluetooth-working-but-t6326.html

My Hardware is
Raspberry Pi Zero W
Hifi Berry Dac Zero
Guittarreria.com case
128Gb USB pen holding my complete music Lib (converted to MP3)

Software - volumio-2.141

it all been working well. Both connected from the DAC to the Aux In on the Caravan Radio & to the mini jack on my Studio Series Bluetooth speaker.
But I’ve never managed to get a working Bluetooth connection to the Studio Series and gave up trying.

With a new Caravaning season about to start, I was resigned to buying a Bluetooth Transmitter. To use beetween the Pi Zero and the Bluetooth Speaker.

Then I came across this thread and decided to have one more go.
I have updated to Volumio 2.368 and have it running well. I’ve downloaded the ui.zip and bluetooth_controller.zip. Now I am stuck at installing everything.
Despite trying various permutations, I just don’t understand where and how I should be adding the contents of the un-zipped ui folder
I have yet to attempt installing the bluetooth plugin!
Could someone post a step, by step set of instructions for both parts of the install?
I am using my imac. On the desktop I can open the Volumio partitions. volumio, boot & volumio_data. I can also ssh to the Pi zero.

Thanks for looking and all the work.

For me these steps worked:

  1. Make a backup from the one on your Volumio: scp volumio@IPAdressOfVolumio:/volumio/http/www /path/to/local/backupplace/www
  2. Download UI from first post
  3. unzip downloadet ui-zipfile (ex. to /path/to/ui)
  4. ssh to Volumio ssh volumio@IPAdressOfVolumio
  5. remove content of www on Volumio: rm -R /volumio/http/www/*
  6. Upload UI to Volumio: scp -r /path/to/ui volumio@[i]IPAdressOfVolumio[/i]:/volumio/http/www
  7. Check that the content of /volumio/http/www is korrekt index.html scripts app fonts styles . If not: correkt it with cp or mv
  8. Reboot volumio and delete you browser cache -> now you should see in the Volumio-Webinterface -> Plugins -> a new third tab with a area, where you can drag and drop files
  9. download the controller zip file from the first post, but do not unzip it
  10. drag and drop the controller zip file to the area on the third tab -> it will install automatic which take a long time (15min +)
  11. Reboot volumio
  12. put your BT speaker in discoverable mode
  13. Volumio Webinterface -> plugins -> Bluetooth Manager -> put to on (slider becomes green) -> setup -> leave discoverable off -> hit refresh until you speaker shows up -> connect -> play music (worked for me with music from nfs/nas/usb/radio, not shure with Spotify)
  14. and you need some patience. For me it worked mostly for the first try, but sometimes waiting and rebooting helps…
1 Like

Hi and thanks for the help.

Took me a little while to get my head around the “scp” command, but I have now copied the www folder, removed the www folder and added the ui folder. I have confirmed that index.html, scripts, app, fonts & styles are all included. So far so good.
But I’m now stuck at relaunching Volumio on Firefox.

Despite deleting the firefox browser cache and history i get the following message when trying to load volumio.local.

"The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept cookies."

Would you have a solution please?

Thanks again

Getting there.
This morning I removed the ui folder from volumio/http/www. Then I added just the contents of the ui folder to www.
index.html
scripts
app
fonts
styles
After a reboot the web ui loaded no problem and the third tab was there in plugins. Dropped the bluetooth controller zip file onto this tab and it installed successfully.

The green active button is lit and volumio can see both my iMac & iPad. However, no matter what I do it the Studio Series Speaker never appears.

I will get trying

Thanks again

Hello together,
first of all thank´s for the great work with hte bluetooth plugin, I have been able to get a connection from a raspberry pi zero to my Bose soundlink Colour and hear a WIFI Internet Radio channel with great audio quality. That´s fantastic!

On the other hand I have some problems with the plugin:

  • i could not reproduce my success, althought I tried it several times the Box isn´t connecting
  • at my first successfull connection I could not change the volume, neither at the buttons on the box(!) nor with the software buttons in the website or with the Bose App.
  • I can´t remove the connected Box, it consists as “connected” in the List but it is not paired physically
  • I could not remove the plugin via the manager… it is still there

do you have any suggestions or ideas for me how I can manage that?

Can you tell me where the config files are located so that I can remove the speaker for a fresh reconnect? (/etc/…?)

Thanks in advance!!