PDA

View Full Version : Experimental: Bluetooth Speaker support in piCorePlayer 3.22



paul-
2017-09-23, 13:12
EXPERIMENTAL Yes, I'm trying to emphasize this.

When I noticed the bluez-alsa project was re-implementing the support for alsa that was dropped from Bluez 5.x. I figured I would see how squeezelite and bluetooth would work. It worked better than I expected.

Requirements

piCorePlayer 3.22
rpi3 or rpi0W
A little linux skillz to install manual portions of support, and to do some debugging if needed
Hardwired Ethernet connection to your player. Rpi onboard wifi for sure wont work. Some USB wifi devices will work, but no promises (EDIMaX 7811Un is one the won't work)


Do the following steps

Download Extension pcp-bt from the extension browser. Using the piCorePlayer Sourceforge repo.
Disable onboard wifi from the web interface (Do not reboot yet)
Manually edit config.txt comment out dtoverlay=pi3-disable-bt



m1
vicfg
u1


edit /opt/bootlocal.sh Add /usr/local/bin/pcp-bt-start-controller 2>&1 | tee -a /var/log/pcp_bt.log before the pCPstart
Backup - pcp bu
Reboot - pcp rb
edit /opt/.filetool.lst and add var/lib/bluetooth at the end of the file.
When the system reboots, open a ssh session and run pcp-bt-pair
Setup Squeezelite per the attached image. (The Power Script is /usr/local/bin/pcp-bt-reconnect.sh)
Restart Squeezelite......
Check the mixer setting



tc@picoreplayer:~$ . ~/.pcp-bt-device
tc@picoreplayer:~$ sudo amixer -D bluealsa sset "$BTMIXER" 100%


A couple of tips.

When rebooting your player, power cycle your BT speaker.
If you turn off the power on the player, you can shut off your speaker. But be sure to turn your speaker back on and give it time to start before turning the power back on the player.



23718

huxmut
2017-09-23, 23:27
Wow
I was just wondering about this two days ago ...
I wont have a chance to try for a little while, but many thanks in advance :)

Tony T
2017-09-24, 19:41
I was also just thinking about a BT Speaker as I wanted Stereo….
….then I remembered that I can configure my 2 SB radios to Left Output and Right Output and sync, and wala… Stereo!

Still, great to see this experimental support for BT in pCP :)

ashceryth
2017-10-28, 03:24
Hi, This is working great so far and looks like the perfect solution for me. I used your guide and everything worked out flawlessly. Thank you so much!

M-H
2017-10-28, 13:37
When I noticed the bluez-alsa project was re-implementing the support for alsa that was dropped from Bluez 5.x. I figured I would see how squeezelite and bluetooth would work. It worked better than I expected.


Paul, Would this also allow us to add BT-input ?
It would be a great addition to be able to play an occasional tune from my phone over the PCP managed amp and speakers .

Greetz MH

Dan benDan
2017-12-12, 15:59
A little linux skillz to install manual portions of support, and to do some debugging if needed

I don't know how to "•Download Extension pcp-bt from the extension browser. Using the piCorePlayer Sourceforge repo." Can you explain how to do this?

Will WI-FI work using an external WI-FI adapter?

Thanks!

paul-
2017-12-12, 19:38
Thais is still experimental, as I was looking to see if folks had luck with various Bluetooth devices. If you have never looked at bluez, you will need to read up on that.

Read point 4 in the opening post.

The extension can be installed from the extension button in the main menu.

Dan benDan
2017-12-13, 08:58
I tried Putty/SSH $ sudo nano config.txt but got "sudo: nano: command not found".

I am sorry but I really am a Noob!

paul-
2017-12-13, 10:39
nano is not included in our distro. Just use vi.

Dan benDan
2017-12-13, 13:14
nano is not included in our distro. Just use vi.

tc@PiCore31LAN:~$ vi /boot/config.txt shows no information

all lines are just - except the bottom one which is "- /boot/config.txt 1/1 100%"

paul-
2017-12-13, 14:51
The boot drive is not mounted, please go back and read the instructions up top.

Dan benDan
2017-12-14, 11:34
I see this in the pcp_bt.log file

tc@PiCore31LAN:~$ sudo vi /var/log/pcp_bt.log

Bluetooth Hardware Address:b8:27:eb:d4:f6:35
bcm43xx_init
Flash firmware /usr/local/lib/firmware/brcm/BCM43430A1.hcd
Set BDADDR UART: b8:27:eb:d4:f6:35
Set Controller UART speed to 921600 bit/s
Device setup complete
Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkn own: The name org.bluez was not provided by any .service files
()
Need to pair device. \n Please run pcp-bt-pair
Need to pair device. \n Please run pcp-bt-pair
2: Initialising...
Reconnecting
Connected

I do not understand where I went astray, I hope you can help me.

Thanks

squeezeGoose
2017-12-16, 09:49
I too am having challanges getting BT to work as simply as it should. Whenever I select Bluetooth audio and set the output setting and power on/off script to the values specified Squeezelite no longer starts.

pcp_bt.log reports:-
Bluetooth Hardware Address:b8:27:eb:eb:fe:20
bcm43xx_init
Flash firmware /usr/local/lib/firmware/brcm/BCM43430A1.hcd
Set BDADDR UART: b8:27:eb:eb:fe:20
Set Controller UART speed to 921600 bit/s
Device setup complete
Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkn own: The name org.bluez was not provided by any .service files
()
2: Initialising...
Reconnecting A0:60:90:13:79:E4
Connected
0: turn off

pcp_boot.log reports:-
Starting piCorePlayer setup...
Loading pcp-functions...and pCP configuration file.Done.
Checking for newconfig.cfg on mmcblk0p1...
Trying to mount /dev/mmcblk0p1.
newconfig.cfg not found on mmcblk0p1.
Setting piCore repository... Done.
Generating drop-down list... Done.
Loading configuration file... Done.
Checking wifi... Done.
Loading pcp-lms-functions... Done.
Waiting for soundcards to populate. Done (1).
Starting ALSA configuration... Done.
Waiting for network. Done (1).
Starting Openssh server... Done.
Starting Squeezelite... Done.
Starting httpd web server... Done.
eth0 IP: 192.168.0.134
Finished piCorePlayer setup.
crond syncing time...

It all looks ok except for that bus error but it still refuses to start.

Any ideas?

paul-
2017-12-16, 12:46
Need to pair device. \n Please run pcp-bt-pair
Need to pair device. \n Please run pcp-bt-pair


Did you run this already?

paul-
2017-12-16, 13:15
squeezeGoose,

Seems I missed a step for you

edit /opt/.filetool.lst and add /var/lib/bluetooth at the end. (I've updated the OP)

Then repair your speaker.


Ignore the dbus error. The bus takes a bit to start and sometimes the script tries before it's complete. But the script does keep trying. The () after the error message is actually the success. (I probably should have a better message printed :)


Edit: I've updated the script to include a better message. You can download the latest by running "pcp-update pcp-bt.tcz"

squeezeGoose
2017-12-18, 09:51
Great, thanks, I'll have a play!

Just a quick confirmation of something, you wrote "Rpi onboard wifi for sure wont work.", I assume that to mean that WiFi and Bluetooth can't be used at the same time? Is that a radio or a driver limitation? A WiFi, Bluetooth piCorePlayer would be pretty cool!

A small "thank you" in the donation pot for you too...

paul-
2017-12-18, 10:49
On the rpi3 it is a Hardware implementation limitation. But there are also driver incompatibilities for other chipsets.

I have two at home that did work.

Grumpy Bob
2018-01-06, 01:00
I have a pair of Bluetooth headphones - would they function as if they were Bluetooth speakers for this experimental Bluetooth set-up? The set-up process doesn't look too daunting to me, and I'm keen to give it a go when I have a chance - back in analogue world, I'm currently making a few mechanical changes to my Planar 3!

Robert

paul-
2018-01-06, 07:08
I have a pair of Bluetooth headphones - would they function as if they were Bluetooth speakers for this experimental Bluetooth set-up? The set-up process doesn't look too daunting to me, and I'm keen to give it a go when I have a chance - back in analogue world, I'm currently making a few mechanical changes to my Planar 3!

Robert

Yes, they should work. I am getting close to getting this support integrated into the web interface.

MaDsGa3
2018-01-17, 05:42
Yes, they should work.

First of all thank you for the great work you are sharing here! Respect!

I just want to confirm that my Phillips SHB-3060 bluetooth headphones are running fine with the manual you described here in this tread.
Finally I got handsfree music in my home office, without disturbing anybody else in the house :cool:

Looking forward for more exiting developments on the pcp here!!

paul-
2018-01-17, 07:56
First of all thank you for the great work you are sharing here! Respect!

I just want to confirm that my Phillips SHB-3060 bluetooth headphones are running fine with the manual you described here in this tread.
Finally I got handsfree music in my home office, without disturbing anybody else in the house :cool:

Looking forward for more exiting developments on the pcp here!!

Thanks for the confirmation, I have this support built in to the web interface for the next release.....which is hopefully soon.

Grumpy Bob
2018-01-17, 13:37
First of all thank you for the great work you are sharing here! Respect!

I just want to confirm that my Phillips SHB-3060 bluetooth headphones are running fine with the manual you described here in this tread.
Finally I got handsfree music in my home office, without disturbing anybody else in the house :cool:

Looking forward for more exiting developments on the pcp here!!

I have just worked through the instructions and have my Bowers & Wilkins PX headphones working. There are some complexities from the headphones turning off when removed from my head, which doesn't play ball with squeezelite - at the moment I'm trying to set parameters to make this smoother.

Robert

paul-
2018-01-17, 14:12
I have just worked through the instructions and have my Bowers & Wilkins PX headphones working. There are some complexities from the headphones turning off when removed from my head, which doesn't play ball with squeezelite - at the moment I'm trying to set parameters to make this smoother.

Robert

This is one of the biggest issues I had to work through. If the audio device disappears, squeezelite will crash. If you turn off the "power" button in LMS, then squeezelite will close the audio output, which you can then turn off your headphones. Just be sure to let your headphones connect before pressing the power button again.


In the future pCP integration, I've added a check to restart squeezelite if needed when the configured bluetooth speakers connect.

Grumpy Bob
2018-01-17, 14:29
This is one of the biggest issues I had to work through. If the audio device disappears, squeezelite will crash. If you turn off the "power" button in LMS, then squeezelite will close the audio output, which you can then turn off your headphones. Just be sure to let your headphones connect before pressing the power button again.


In the future pCP integration, I've added a check to restart squeezelite if needed when the configured bluetooth speakers connect.

That's very helpful - thanks!

Robert

majones
2018-02-07, 05:05
I have this support built in to the web interface for the next release.....which is hopefully soon.
I'm keen to give this a try, but will wait for the next release I think. Just to clarify, can this be used with a USB bluetooth dongle, and if so what chipsets are compatible with the in built drivers used by piCorePlayer? I'd like to use my RPi3 with squeezelite with onboard wifi to connect to LMS and the dongle to connect to my bluetooth speaker. Is this likely to work?

paul-
2018-03-18, 08:27
Testing with the new RPi3B+

Wlan connected at 2.4Mhz, bluetooth plays, but stumbles a little

Wlan connected at 5Ghz, Bluetooth plays quite nicely

radostyle
2018-05-06, 20:53
Paul,
Are you saying that with the RPI3B+ there is no hardware limitation to using wifi and bluetooth at the same time?

paul-
2018-05-07, 12:33
Correct, as long as the wifi is using a 5Ghz band.

radostyle
2018-05-07, 21:59
I have the Rpi3 B+ version and so I am using the 3.5.0 Audio Optimized version.

I wasn't able to follow the instructions on the 3.5.0AudioOptimized image because in the newer version the file
/usr/local/bin/pcp-bt-start-controller was not there. Instead there are files

tc@piCorePlayer:~$ ls /usr/local/bin/*bt*
/usr/local/bin/btattach /usr/local/bin/pcp-bt-connect-daemon /usr/local/bin/pcp-bt-pair
/usr/local/bin/btmon /usr/local/bin/pcp-bt-functions


But I tried to pair my phone anyway and got this:

tc@piCorePlayer:~$ /usr/local/bin/pcp-bt-pair
rm: can't remove '/tmp/select.in': No such file or directory
rm: can't remove '/tmp/btpair': No such file or directory
Place Device in Pair mode and then hit enter

Scanning for Bluetooth Devices
process 6798: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5904.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Aborted

paul-
2018-05-20, 06:19
in 3.5.0 the scripts were all changed when it was integrated. Scripts are not intended to be ran from command line.

Also, This is for speaker support only. Not phones.

tvsb
2018-06-22, 06:41
exactly the same error with @radostyle here ,so how to do this in 3.5.0, @paul the mighty

paul-
2018-06-22, 08:23
Make sure you are in Beta mode.....then make sure you have installed the support files from the Control Page.

tvsb
2018-06-22, 16:18
thx for the tips @paul , in beta mode bluetooth speaker paired and streaming works !


my 2 cents for the forum:

be aware ,the Squeezelite will not start if pcp can't connect to the bt output device on boot , check the log @ http://****/cgi-bin/diag_logs.cgi?SELECTION=All&ACTION=Show for detail .

and this is what not turn out as expected as the main post (I support they don't matter anymore ):
1 vi /mnt/mmcblk0p1/config.txt : no dtoverlay=pi3-bt line to comment out , only line similar with that is dtoverlay=pi3-wifi which I didnt touch

2 /usr/local/bin/pcp-bt-start-controller: not found

3 var/lib/bluetooth also not found

4 /usr/local/bin/pcp-bt-reconnect.sh not found
~/.pcp-bt-device not found
sudo amixer -D bluealsa sset "$BTMIXER" 100% : Wrong scontrol identifier:

paul-
2018-06-22, 19:26
be aware ,the Squeezelite will not start if pcp can't connect to the bt output device on boot , check the log @ http://****/cgi-bin/diag_logs.cgi?SELECTION=All&ACTION=Show for detail .

and this is what not turn out as expected as the main post (I support they don't matter anymore ):


Correct squeezelite wont start, but as soon as your speaker connects, the connect daemon will restart squeezelite.

Also, the description of the thread is 3.22.....so none of the previous manual methods apply to 3.5.0, they all have been changed slightly.

Battle Angel
2019-04-09, 08:24
Hy Volks,

I Thought it would be kinda nice to use a Bluetoothkeyboard, but i struggle in pairing it.
everytime i use pcp-bt-pair i get the error
rm: can't remove '/tmp/select.in': No such file or directory
rm: can't remove '/tmp/btpair': No such file or directory
did i overead something?
is someone able to give me a hint?
i use a pi zero W with disabled wlan onboard and a conectet wifi stick.

thanks for help

sry for my bad english

paul-
2019-04-09, 08:53
This is only for speakers. Keyboards are not supported.

Battle Angel
2019-04-09, 10:26
thats quied sad,

i thought that wold be nice to use it with this bluetooth remtote but when there is no way jet i have to accept it.

btw thist was the keyboard i wantet to use.
https://www.ebay.de/itm/Bluetooth-Wireless-Media-Button-Fernbedienung-Selfie-Musik-f%C3%BCr-Auto-Android-iOS/173499972255?ssPageName=STRK%3AMEBIDX%3AIT&var=472191172097&_trksid=p2057872.m2749.l2648