User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Bluetooth headset (speaker/microphone)

Fri May 20, 2016 7:45 am

Hello,

Did anyone managed to connect Bluetooth headset (speaker and microphone) to Raspberry Pi 3?

I tried many SW but I can only have the speaker part, no SW support for Bluetooth microphone.

Thanks in advance.

excalibas
Posts: 2
Joined: Tue Jan 21, 2014 2:32 pm

Re: Bluetooth headset (speaker/microphone)

Tue May 31, 2016 8:38 am

Same problem here :( speaker works fine but I can't get the microphone to work.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Thu Sep 01, 2016 6:57 pm

I'm here again to tell you two short information:
- You can connect a Bluetooth headset with A2DP profile, use bluetoothctl to connect it, and then start a pulseaudio daemon.
- For headsets with microphone HSP/HFP, the current PulseAudio for Raspbian (5.x) doesn't support these profiles.

I'm writing a complete post to help all people I saw here reporting this recurrent issue.

User avatar
Douglas6
Posts: 4672
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth headset (speaker/microphone)

Thu Sep 01, 2016 7:44 pm

Have you tried with a later version of PulseAudio? PulseAudio 6.0 added native support for HSP and supports HFP with ofono. https://www.freedesktop.org/wiki/Softwa ... Notes/6.0/

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Thu Sep 01, 2016 7:57 pm

Douglas6 wrote:Have you tried with a later version of PulseAudio? PulseAudio 6.0 added native support for HSP and supports HFP with ofono. https://www.freedesktop.org/wiki/Softwa ... Notes/6.0/
Hi Douglas,

I'm trying to install PulseAudio from source.
If you have any tutorial for this it may help me.

Thank you.

Arie Aardvarken
Posts: 4
Joined: Thu Sep 01, 2016 7:32 pm

Re: Bluetooth headset (speaker/microphone)

Thu Sep 01, 2016 8:01 pm

How did you manage to even get the speakers working? I have a Philips SHB8850NC and I can connect them, but I'm not getting further than this:

Code: Select all

pactl list sources short

--> OUTPUT:
0       alsa_output.0.analog-stereo.monitor     module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED
2       bluez_sink.6C_5A_B5_FC_4A_17.monitor    module-bluez5-device.c  s16le 2ch 44100Hz       SUSPENDED
How did you eventually got the sound through the headset? I have tried many tutorials, including many that had to do with audio sinks. The latest I tried said to do this:

Code: Select all

pacmd set-card-profile 2 a2dp_sink
But my ouput here was:

Code: Select all

No such profile: a2dp_sink
I removed the "_sink", and it didn't gave any respond, also no errors, but it also did not work. I'm becoming more and more familiar with the pi and it's OS, but this setup I'm still not following. I also find it quite odd that it is so complicating from the command line, while it can be easily done from the rasbian desktop with a few clicks.

Could you help me out or show me the link to the tutorial that was working out for you? Thanks in advance!

User avatar
Douglas6
Posts: 4672
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth headset (speaker/microphone)

Thu Sep 01, 2016 8:11 pm

I wrote up instructions on building PulseAudio 5 back on Wheezy when 4 was the repo version. Don't know if it will be helpful for version 6 on Jessie: viewtopic.php?p=619713#p619713

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Fri Sep 02, 2016 7:48 pm

Arie Aardvarken wrote:How did you manage to even get the speakers working? I have a Philips SHB8850NC and I can connect them, but I'm not getting further than this:

Code: Select all

pactl list sources short

--> OUTPUT:
0       alsa_output.0.analog-stereo.monitor     module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED
2       bluez_sink.6C_5A_B5_FC_4A_17.monitor    module-bluez5-device.c  s16le 2ch 44100Hz       SUSPENDED
How did you eventually got the sound through the headset? I have tried many tutorials, including many that had to do with audio sinks. The latest I tried said to do this:

Code: Select all

pacmd set-card-profile 2 a2dp_sink
But my ouput here was:

Code: Select all

No such profile: a2dp_sink
I removed the "_sink", and it didn't gave any respond, also no errors, but it also did not work. I'm becoming more and more familiar with the pi and it's OS, but this setup I'm still not following. I also find it quite odd that it is so complicating from the command line, while it can be easily done from the rasbian desktop with a few clicks.

Could you help me out or show me the link to the tutorial that was working out for you? Thanks in advance!
Hi,

Try :

Code: Select all

pacmd set-default-sink bluez_sink.6C_5A_B5_FC_4A_17
(To be done after each reboot or re-connection of the headset)

I can imagine how this topic is difficult, but I guess we will soon get the good packages in Raspbian (BlueZ, PA, oFono)

Good luck.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Fri Sep 02, 2016 7:56 pm

Douglas6 wrote:I wrote up instructions on building PulseAudio 5 back on Wheezy when 4 was the repo version. Don't know if it will be helpful for version 6 on Jessie: viewtopic.php?p=619713#p619713
Hi Douglas,

I tried to install PA from sources like described in official website (https://www.freedesktop.org/wiki/Softwa ... ioFromGit/), but now I'm lost between the built one and the remaining files of the native PA, is there a way to purge all the configuration of native PA?

Another question, do I need to run PA for X11 like the Pi does normally during boot?

User avatar
Douglas6
Posts: 4672
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth headset (speaker/microphone)

Fri Sep 02, 2016 10:34 pm

You could try

Code: Select all

sudo apt-get purge pulseaudio 
but I would do that before building the new one. Shouldn't matter, as the make install script looks like it installs to /usr/local, so just make sure you're using that one.

I'm not sure what you mean by 'Run PA for X11'.

I'll play around this weekend and see what I can come up with. But I don't have a headset for testing.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 1:35 pm

Douglas6 wrote:You could try

Code: Select all

sudo apt-get purge pulseaudio 
but I would do that before building the new one. Shouldn't matter, as the make install script looks like it installs to /usr/local, so just make sure you're using that one.

I'm not sure what you mean by 'Run PA for X11'.

I'll play around this weekend and see what I can come up with. But I don't have a headset for testing.
Thanks Douglas,

That's the point, to figure out how to use the correct PluseAudio.
For you I think that you can use a smartphone to check.

I'm not yet finish, but so far many problems appeared:
- The Git version doesn't have all modules like the Debian version.
>> How to install a module in the compiled PulseAudio ?

- Even with purge, some configuration files of PulseAudio are still here, not sure if they disturb the built on or not.
>> Do it manually ?

- Some libs missing
>> Not so bad, each time I have just to apt-get install them.

Meanwhile, I wrote a detailed post for Bluetooth headset connection:
http://youness.net/raspberry-pi/bluetoo ... spberry-pi

Any feedback is welcome.

Arie Aardvarken
Posts: 4
Joined: Thu Sep 01, 2016 7:32 pm

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 1:44 pm

Hi Tiqni, I tried your solution:
Try :

Code: Select all

pacmd set-default-sink bluez_sink.6C_5A_B5_FC_4A_17
(To be done after each reboot or re-connection of the headset)
But unfortunately it's still not working. This is what I am doing on the Pi 3, rasbian (NOOBS): For testing, I am playing music to my Pi via Spotify connect (https://github.com/Fornoth/spotify-connect-web) and I am then trying to get this to my headset. I can hear it continuously play through HDMI on my tv. After the Pi has booted, I do this:

Code: Select all

pulseaudio --start
Then in another terminal I type:

Code: Select all

systemctl status bluetooth
OUTPUT:
bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
   Active: active (running) since Sat 2016-09-03 15:30:03 CEST; 3min 58s ago
     Docs: man:bluetoothd(8)
 Main PID: 840 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─840 /usr/lib/bluetooth/bluetoothd
And see that the bluetooth is active. Then in that same terminal I type:

Code: Select all

bluetoothctl

OUTPUT:
[NEW] Controller B8:27:EB:0C:AD:00 raspberrypi [default]
[NEW] Device 6C:5A:B5:FC:4A:17 Philips SHB8850NC
[NEW] Device 00:02:72:E3:99:03 Belkin X42

[bluetooth]# connect 6C:5A:B5:FC:4A:17

OUTPUT:
Attempting to connect to 6C:5A:B5:FC:4A:17
Connection successful
Then back to the first terminal, I type:

Code: Select all

pacmd set-default-sink bluez_sink.6C_5A_B5_FC_4A_17
Which gives no result, so I am assuming that this is correct? However, still hear the music on my tv, rather than my headset. I do this in two different terminals, because if I exit the "bluetoothctl", I get this:

Code: Select all

[bluetooth]# exit
[DEL] Controller B8:27:EB:0C:AD:00 raspberrypi [default]
And I'm not sure if it disconnects/reverts back to default Pi settings?

Any suggestions on what the problem might be here?

Thanks for the help :)

Arie Aardvarken
Posts: 4
Joined: Thu Sep 01, 2016 7:32 pm

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 1:55 pm

Tiqni wrote: Meanwhile, I wrote a detailed post for Bluetooth headset connection:
http://youness.net/raspberry-pi/bluetoo ... spberry-pi

Any feedback is welcome.
Ah you wrote a post, while I was writing, haha! :D I went to your blog, luckily I didn't have all those problems and I tried this:

Code: Select all

wget http://youness.net/wp-content/uploads/2016/08/h2g2.ogg -P /tmp/
paplay /tmp/h2g2.ogg
To check if some sound was playing through the headset, and some maybe not. This is indeed the case, which surprises me a bit. Apparently your media file is playing, but Spotify connect and also Kodi is not. Why is your media file playing through the BT headset and the rest not? Is it because the above is started through commandline or something?

User avatar
Douglas6
Posts: 4672
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 2:14 pm

Tiqni wrote:Meanwhile, I wrote a detailed post for Bluetooth headset connection:
http://youness.net/raspberry-pi/bluetoo ... spberry-pi

Any feedback is welcome.
That looks like a good start. A couple of small things with bluetoothctl: with the latest Raspbian, the adapter is powered up at boot, so no need to 'power on'. Also, 'default-agent' is no longer needed.

On the Pi I use for A2DP, I have a systemd unit file to start PA in system-wide mode. In /etc/systemd/system/pulseaudio.service I put

Code: Select all

[Unit]
Description=Pulse Audio
[Service]
Type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm --exit-idle-time=-1
[Install]
WantedBy=multi-user.target
Change the path to your new pulseaudio (/usr/local/pulseaudio?) and then enable it with

Code: Select all

sudo systemctl enable pulseaudio 
That should get the correct PA running at boot.

I also added these two lines at the end of /etc/pulse/system.pa

Code: Select all

load-module module-bluetooth-discover
load-module module-bluetooth-policy
That gets everything working at boot with no manual intervention.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 4:48 pm

Arie Aardvarken wrote:
Any suggestions on what the problem might be here?

Thanks for the help :)
I think that the Spotify project that you are using, is made with ALSA support.

https://github.com/Fornoth/spotify-conn ... 93&q=aplay

As I said in my post, Bluetooth will not work with ALSA, so if you really want to use this Spotify project, you will have to replace ALSA by PulseAudio in the source code.

For example:
aplay --> paplay
...etc.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Sat Sep 03, 2016 4:50 pm

Douglas6 wrote:
Tiqni wrote:Meanwhile, I wrote a detailed post for Bluetooth headset connection:
http://youness.net/raspberry-pi/bluetoo ... spberry-pi

Any feedback is welcome.
That looks like a good start. A couple of small things with bluetoothctl: with the latest Raspbian, the adapter is powered up at boot, so no need to 'power on'. Also, 'default-agent' is no longer needed.

On the Pi I use for A2DP, I have a systemd unit file to start PA in system-wide mode. In /etc/systemd/system/pulseaudio.service I put

Code: Select all

[Unit]
Description=Pulse Audio
[Service]
Type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm --exit-idle-time=-1
[Install]
WantedBy=multi-user.target
Change the path to your new pulseaudio (/usr/local/pulseaudio?) and then enable it with

Code: Select all

sudo systemctl enable pulseaudio 
That should get the correct PA running at boot.

I also added these two lines at the end of /etc/pulse/system.pa

Code: Select all

load-module module-bluetooth-discover
load-module module-bluetooth-policy
That gets everything working at boot with no manual intervention.
Thank you, I will update my post with these information.

User avatar
Tiqni
Posts: 15
Joined: Wed Mar 11, 2015 2:03 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Wed Oct 05, 2016 7:19 pm

Now I see that a candidate update of PulseAudio is in the Raspbian directory:
http://mirrordirector.raspbian.org/rasp ... ulseaudio/

I can see the .deb file for 9.0.3 (pulseaudio_9.0-3_armhf.deb)
But apt-get command is still installing the 5.0-13 version...

I tried to install the .deb manually but I get many errors due to dependencies not at the correct versions (lipulse0, ...etc)

Anyone knows how to force the install of specific version of PA?

Thanks.

youness
Posts: 34
Joined: Sat Sep 03, 2016 4:51 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Thu Mar 30, 2017 2:31 pm

In case anyone still cheking this post.

HSP profile for the moment is working only with USB Bluetooth dongles:
http://youness.net/raspberry-pi/bluetoo ... 3-ad2p-hsp

A2DP is working out-of-the box with Raspberry Pi 3 internal Bluetooth:
http://youness.net/raspberry-pi/bluetoo ... -ad2p-only

Hope this help you. Good luck.

youness
Posts: 34
Joined: Sat Sep 03, 2016 4:51 pm
Contact: Website

Re: Bluetooth headset (speaker/microphone)

Thu Feb 08, 2018 2:19 pm

There is now a solution for Bluetooth A2DP and HSP using Raspberry Pi 3 with no external component.
Check the post here: https://youness.net/raspberry-pi/how-to ... berry-pi-3

moizgillani
Posts: 1
Joined: Fri Feb 08, 2019 11:36 am

Re: Bluetooth headset (speaker/microphone)

Fri Feb 08, 2019 11:40 am

"There is now a solution for Bluetooth A2DP and HSP using Raspberry Pi 3 with no external component.
Check the post here: https://youness.net/raspberry-pi/how-to ... berry-pi-3"

by opening this link it gives an error of "Error establishing a database connection"..

any help will be really appreciated.

Return to “Troubleshooting”