How To Connect Bluetooth Headset Or Speaker To Raspberry Pi 3
If you are here, it means that you are trying to use your headset’s microphone AND speakers with Raspberry Pi 3.
What appeared to be a configuration issue turned to a real headache. After so many weekends spent to find a solution, I ended up with a lot of information and no workaround, a sort of puzzle parts that I’m still collecting over all Google results, I’m not exaggerating if I tell you that I already read every single page that Google can propose for this topic.
I keep my previous post for history (not anymore updated): http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi
With all that effort, I start to have clear idea of the problem. So here you will save your time and focus on the major root cause.
Long story short: The real problem comes from built-in WiFi-Bluetooth chipset: BCM43438 (and/or its driver/firmware)
How do I know it?
Because I used external Bluetooth transceiver (USB dongle), and now my headset works perfectly (AD2P & HSP)
So, unless I find THE ideal solution, you have no choice but to use Bluetooth USB dongle.
I know that some people may just want to know how to do, and don’t care about details, so I’ll explain first how to make it.
Then I’ll post exhaustive story behind this Bluetooth/Raspberry Pi issue, in order to help others who want to explore more.
HOW TO DO
Step 1: PulseAudio
One problem that is mentioned everywhere is the drop out of Bluetooth support by ALSA. Now only way is PulseAudio.
Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=4ff9b99292eca193dc0c149722328cb0b1ab0818
Minimal versions needed for HSP (A2DP included) are: Bluez 5 / PulseAudio 6
Source: https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/6.0/
I recommend to start with fresh Raspbian Jessie image:
https://www.raspberrypi.org/downloads/raspbian/
Update and upgrade it:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo reboot
Check the version of packages:
dpkg -l bluez
Version 5.23-2+rpi2
dpkg -l pulseaudio
Version: 5.0-13
WARNING: Raspbian repository is still using PulseAudio 5
Purge pre-installed PulseAudio:
sudo apt-get purge pulseaudio
To install manually PulseAudio 6 or upper, there are two methods and both of them are OK.
Method 1: Install PulseAudio from Debian Backports
Edit source list:
sudo nano /etc/apt/sources.list
Add the line:
deb http://ftp.debian.org/debian jessie-backports main
Add PGP keys to your Raspberry Pi:
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
gpg -a --export 8B48AD6246925553 | sudo apt-key add --
gpg -a --export 7638D0442B90D010 | sudo apt-key add --
Update package list:
sudo apt-get update
Install PulseAudio and its Bluetooth module:
sudo apt-get -t jessie-backports install pulseaudio pulseaudio-module-bluetooth
Check the version (6 or upper is OK):
dpkg -l pulseaudio pulseaudio-module-bluetooth
ii pulseaudio 7.1-2~bpo8+1
ii pulseaudio-module-blue 7.1-2~bpo8+1
You can jump directly to Step 2.
Method 2: Use PulseAudio sources
Download the sources from Freedesktop.org:
wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-6.0.tar.xz
Unzip and go to the directory:
tar xvf pulseaudio-6.0.tar.xz
cd pulseaudio-6.0
Run bootstrap script:
./bootstrap.sh
I will sum up here all errors I encountered (in case people search them by copy/paste):
./bootstrap.sh: line 46: intltoolize: command not found
configure: error: Unable to find libltdl version 2. Makes sure you have libtool 2.4 or later installed.
configure: error: *** sys/capability.h not found. Use --without-caps to disable capabilities support
No package 'json-c' found
No package 'sndfile' found
So install all above libraries:
sudo apt-get install intltool libtool libcap-dev libjson0-dev libsndfile1-dev
The script should now ends correctly, and in the command line you can see a table of the configuration done, with enabled/disabled parts. On my side: udev, bluez5, ofono, native-headset, alsa, X11, systemd, … were not enabled, so I installed additional libraries:
sudo apt-get install libudev-dev libsbc-dev libbluetooth-dev libx11-xcb-dev libasound2-dev libsystemd-dev libsamplerate0-dev
Re-do the ./ bootstrap, now missing parts are enabled.
Then, make and install PulseAudio (this will take some time, take a coffee).
sudo make
sudo make install
sudo ldconfig
The last command to avoid some errors of shared libs not found.
Step 2: Bluetooth Hardware
To turn off built-in Bluetooth controller (BCM43438), blacklist it:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Add lines:
blacklist btbcm
blacklist hci_uart
CTRL+X, then Y, then Enter
Reboot:
sudo reboot
Now connect your Bluetooth USB dongle, mine is ASUS BT400.
(At this step, the result may differ, maybe your USB dongle is already supported by Raspbian)
For ASUS BT-400, I have to install manually the firmware.
To know if your hardware is correctly called, check it here:
dmesg | grep -i bluetooth
In my case I see the error:
[ 155.924366] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2
Here I need to explain some things. The chipset in USB dongle is from Broadcom (BCM)
Broadcom’s firmwares are proprietary, it means that they are’nt shared as open source, and some times not in Linux repositories.
So to use it, you have to find corresponding .hcd file and store it in /lib/firmware folder.
Easy way is to download ASUS drivers online:
wget http://dlcdnet.asus.com/pub/ASUS/wireless/USB-BT400/UT_USB_BT400_6516000.zip -P /home/pi/Downloads/
Unzip it:
sudo apt-get install zip
cd /home/pi/Downloads/
unzip UT_USB_BT400_6516000.zip
Open .inf file of the drivers and look for ASUS
cd BTW6.5.1.6000_Win7_USB_ASUS/Win32/
cat bcbtums-win7x86-brcm.inf
Search for the driver supporting your hardware. For ASUS BT400 I find the corresponding file:
BCM20702A1_001.002.014.1315.1347.hex
Not that it is .hex, so I need to convert it to .hcd, I’ll use hex2hcd tool:
cd /home/pi/Desktop
sudo apt-get install git
git clone https://github.com/jessesung/hex2hcd.git
cd hex2hcd
make
Here I meet error due to Raspberry Pi configuration
gcc -O2 -march=native hex2hcd.c -o hex2hcd
*** Error in `gcc’: double free or corruption (top): 0x015fdc58 ***
<builtin>: recipe for target ‘hex2hcd’ failed
make: *** [hex2hcd] Aborted
so I modify the Makefile:
sudo nano Makefile
Replace the line:
CFLAGS = -O2 -march=native
By
CFLAGS = -mcpu=cortex-a53 -mfpu=neon-vfpv4
(Source: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=139091&p=922980)
Redo make
command, now you have the executable hex2hcd:
cp /home/pi/Downloads/BTW6.5.1.6000_Win7_USB_ASUS/Win32/BCM20702A1_001.002.014.1315.1347.hex /home/pi/Desktop/hex2hcd/
./hex2hcd BCM20702A1_001.002.014.1315.1347.hex BCM20702A1-0b05-17cb.hcd
Pay attention here to the name of .hcd file, it is the same one missing in above error with dmesg | grep -i bluetooth
Copy it to firmware folder, reboot, and check Bluetooth initiation:
sudo cp BCM20702A1-0b05-17cb.hcd /lib/firmware/brcm/
sudo reboot
dmesg | grep -i bluetooth
The firmware should be correctly called now!
Now we will connect the Bluetooth headset (same steps as for A2DP only post)
Start Bluetoothctl tool and initiate everything:
bluetoothctl
power on
agent on
default-agent
Turn on the headset, for mine I press and hold the button till I see white blinking LED.
Start the scan:
scan on
After some seconds, you will see the headset name and MAC address (xx:xx:xx:xx:xx:xx)
Pair, trust and connect it:
pair xx:xx:xx:xx:xx:xx
trust xx:xx:xx:xx:xx:xx
connect xx:xx:xx:xx:xx:xx
Now the headset is correctly connected to the Raspberry Pi.
If not, it should be PulseAudio daemon that it is not already running.
Open new console and start it:
pulseaudio --start
Go back to the other console and connect again the headset:
connect xx:xx:xx:xx:xx:xx
Now the headset is connected!
Check cards in PulseAudio:
pactl list cards
You can see the Bluetooth card, and the profiles A2DP and HSP available.
For me the default profile was headset_head_unit, if it is not for you, force it:
pacmd set-card-profile 1 headset_head_unit
Tell PulseAudio to use the headset as default “sink” and “source”:
pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx
pacmd set-default-source bluez_source.xx_xx_xx_xx_xx_xx
Record yourself with the microphone:
parecord -v voice.wav
CTRL+C to end it.
Play it back:
paplay -v voice.wav
Are you listening to your voice?!
Final check that A2DP is also working, activate it:
pacmd set-card-profile 1 a2dp_sink
paplay -v voice.wav
Your voice again, that’s all.
This tutorial will for work for any Bluetooth USB dongle that you can find the ASUS driver sources.
If you have any question or remark, feel free to ask me by comment.
THE STORY WHY RASPBERRY PI BLUETOOTH IS NOT WORKING
This part is ongoing because every day I’m learning new things about Bluetooth profiles, hardware architecture, IP issues, …etc.
The aim here is not to blame the Raspberry Pi, but to understand why it is NOK and how to correct it.
Because at the of the day we want to do it by the board only without external add-ons.
Until this, I recommend to use Bluetooth USB dongles if you want to have HSP profile.
Some quick notes and questions:
- Raspberry Pi uses Broadcom BCM43438 “combo” shipset for Wi-Fi and Bluetooth
- Broadcom firmwares are proprietary, not all the time coming with Linux distributions
- Apparently, BCM43438 firmware is the same as BCM43430 (but how to be sure…)
- People report that the use of Wi-Fi & Bluetooth leads to poor audio quality and slow connection
- Raspberry Pi Zero Wi will have the same problem ( same BCM 43438)
- What is the architecture of Raspberry Pi wireless (I know it is not Open Source…)?
- What are the buses and protocols used (HCI, UART, SCO, SDIO…)?
- Did anyone checked that Bluetooth audio will work before agreeing this hardware at Raspberry Pi Foundation?
- Why the BCM43438 is not mentioned in Raspberry Pi hardware list (in the website)?
To be continued.
Hi,
I tried your steps on Raspberry Pi Zero and Orange Pi Zero with USB Bluetooth dongle and I have the same problem on both devices:
[bluetooth]# connect 00:E0:4C:1B:22:F9
Attempting to connect to 00:E0:4C:1B:22:F9
Failed to connect: org.bluez.Error.Failed
grep -i bluetooth /var/log/syslog :
localhost bluetoothd[436]: Sap driver initialization failed.
localhost bluetoothd[436]: sap-server: Operation not permitted ( 1)
localhost NetworkManager[440]: Loaded device plugin: /usr /lib/arm-linux-gnueabihf/NetworkManager/libnm-device-plugin-bluetooth.so
localhost bluetoothd[436]: Confirm name timed out for hci0
localhost bluetoothd[436]: a2dp-sink profile connect failed for 00:E0:4C:1B:22:F9: Protocol not available
Can you please help me ?
I didn’t test with Raspberry Pi Zero, but other people reported that the same setup works for Raspberry Pi (2/3) but it doesn’t work for Raspberry Pi Zero…
http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi#comment-292
http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi#comment-23
Can you check “dmesg | grep -i bluetooth” I think the firmware for your USB dongle is not there (what is the brand?)…
Thanks for quick response, I think that dmesg | grep -i bluetooth is without problem:
[ 7.777636] Bluetooth: Core ver 2.16
[ 7.777817] Bluetooth: HCI device and connection manager initialized
[ 7.777845] Bluetooth: HCI socket layer initialized
[ 7.777865] Bluetooth: L2CAP socket layer initialized
[ 7.777916] Bluetooth: SCO socket layer initialized
[ 13.105176] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 13.105210] Bluetooth: BNEP filters: protocol multicast
I am not sure which brand is USB dongle, it was the cheapest usb dongle on ebay but pairing was successfull. The same issue is described here: https://wiki.archlinux.org/index.php/Bluetooth_headset
but till now I wasnt able to make it running.
Without the name of USB dongle it will be very hard to support it… Send me the eBay link to try find it.
Try: lsusb
To see the USB dongle
Try: dmesg log
And check if there is any error
from lsusb it is: Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
dsmeg logs looks good. I am not sure if the problem is in USB dongle or somewhere else, for example I cannot simply kill or restart the pulseaudio:
root@orangepizero:~# sudo pulseaudio -k
E: [pulseaudio] main.c: Failed to kill daemon: No such process
but it should be running
root@orangepizero:~# ps aux | grep pulseaudio
root 2064 0.0 0.1 3664 748 pts/0 S+ 17:23 0:00 grep pulseaudio
Do: pulseaudio –start
You have to start it manually.
root@orangepizero:~# pulseaudio –start
E: [pulseaudio] main.c: Too many arguments.
Use two – not one long —
Error with my blog settings…
Or use: pulseaudio -D
Without sudo I get Illegal instruction also with – – , but with sudo it is ok, I am not sure if my default permissions are OK.
pi@raspberrypi:~ $ pulseaudio –start
Illegal instruction
pi@raspberrypi:~ $ sudo pulseaudio –start
OK
I think you need to add your username to pulse group.
Check here how to do it: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
I don’t want to copy you the wrong – again 😀
Hello Peter and Younes
I followed instructions, but I have the same issue with RPI3(Stretch) + Asus BT400 (Like Younes)
pi@rpi3:~ $ sudo bluetoothctl
[NEW] Controller 5C:F3:70:87:0A:04 rpi3 [default]
[NEW] Device 78:44:05:99:8B:18 JBL GO
[bluetooth]# connect 78:44:05:99:8B:18
Attempting to connect to 78:44:05:99:8B:18
Failed to connect: org.bluez.Error.Failed
Syslog shows “a2dp-sink profile connect failed for 78:44:05:99:8B:18: Protocol not available”
pi@rpi3:~ $ grep -i bluetooth /var/log/syslog
Nov 25 15:15:23 rpi3 systemd[1]: Failed to start Configure Bluetooth Modems connected by UART.
Nov 25 15:15:23 rpi3 systemd[1]: Starting Bluetooth service…
Nov 25 15:15:23 rpi3 bluetoothd[460]: Bluetooth daemon 5.43
Nov 25 15:15:23 rpi3 systemd[1]: Started Bluetooth service.
Nov 25 15:15:23 rpi3 systemd[1]: Reached target Bluetooth.
Nov 25 15:15:23 rpi3 bluetoothd[460]: Starting SDP server
Nov 25 15:15:23 rpi3 kernel: [ 9.453486] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Nov 25 15:15:23 rpi3 kernel: [ 9.453494] Bluetooth: BNEP filters: protocol multicast
Nov 25 15:15:23 rpi3 kernel: [ 9.453512] Bluetooth: BNEP socket layer initialized
Nov 25 15:15:23 rpi3 bluetoothd[460]: Bluetooth management interface 1.14 initialized
Nov 25 15:15:23 rpi3 bluetoothd[460]: Failed to obtain handles for “Service Changed” characteristic
Nov 25 15:15:23 rpi3 bluetoothd[460]: Sap driver initialization failed.
Nov 25 15:15:23 rpi3 bluetoothd[460]: sap-server: Operation not permitted (1)
Nov 25 15:16:22 rpi3 bluetoothd[460]: a2dp-sink profile connect failed for 78:44:05:99:8B:18: Protocol not available
I think Bluetooth USB is well installed
pi@rpi3:~ $ dmesg | grep -i bluetooth
[ 3.099600] Bluetooth: Core ver 2.22
[ 3.099692] Bluetooth: HCI device and connection manager initialized
[ 3.099712] Bluetooth: HCI socket layer initialized
[ 3.099726] Bluetooth: L2CAP socket layer initialized
[ 3.099763] Bluetooth: SCO socket layer initialized
[ 3.148879] Bluetooth: hci0: BCM: chip id 63
[ 3.164883] Bluetooth: hci0: BCM20702A
[ 3.165849] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 5.063897] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1347
[ 5.079898] Bluetooth: hci0: Broadcom Bluetooth Device
[ 9.453486] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 9.453494] Bluetooth: BNEP filters: protocol multicast
[ 9.453512] Bluetooth: BNEP socket layer initialized
PulseAudio is started
pi@rpi3:~ $ ps aux | grep pulseaudio
pi 696 0.0 0.0 4372 532 pts/0 S+ 15:18 0:00 grep –color=auto pulseaudio
pi@rpi3:~ $ dmesg log | grep -i bluetooth
[ 3.099600] Bluetooth: Core ver 2.22
[ 3.099692] Bluetooth: HCI device and connection manager initialized
[ 3.099712] Bluetooth: HCI socket layer initialized
[ 3.099726] Bluetooth: L2CAP socket layer initialized
[ 3.099763] Bluetooth: SCO socket layer initialized
[ 3.148879] Bluetooth: hci0: BCM: chip id 63
[ 3.164883] Bluetooth: hci0: BCM20702A
[ 3.165849] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 5.063897] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1347
[ 5.079898] Bluetooth: hci0: Broadcom Bluetooth Device
[ 9.453486] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 9.453494] Bluetooth: BNEP filters: protocol multicast
[ 9.453512] Bluetooth: BNEP socket layer initialized
Do you know how to solve this issue ?
Regards
G.
OK I find the issue. I add the pi user to lp group
sudo usermod -a -G lp pi
Thanks for sharing 😉
Hi Guillaume,
I don’t think that PulseAudio is running.
Do this: pulseaudio –start
And then try to connect the headset.
I got error requesting gpg keys. It says the key can’t be retrieved, no valid OpenPGP data found.
Find the following cmd works.
sudo apt-key adv –recv-key –keyserver pgpkeys.mit.edu
You may also want to query over typical port 80
I got this kind of errors before, for me it was the gpg server that was not correctly responding for a moment. Works after some tries with no change.
Thanks for the tip.
Hi, thanks a lot for posting this instruction set. I am going to buy a raspberry pi in the very near future in order to replicate this project. I have been trying to find a dedicated bluetooth Tx/Rx with onboard sound for a while, to no avail. I thought raspberry pi might be a solution; so was very grateful to stumble across your post.
You’re welcome.
Mate you are legend!!! Thank you for sharing you collected knowledge in this post.
🙂
Hi, thank for this post, it helped a lot in making my headset working as ad2p sink to listen music.
Still the built in play/pause buttons on the headset aren’t working. I kinda undertand that AVRCP is needed for this to work but i didn’t undertand what exactly it is and if there is any chance of getting it working on the raspberry. Do you have any hint in this regard ?
Hi, no I didn’t use AVRCP profile. I note your question and will let you know if I find something later.
Thanks.
Hello Youness, everything was working fine until the very end: when I attempt to pair the headset, it tells me that: “failed to connect to device – could not connect to PulseAudio. try to connect again.” I tied pulseaudio –start, but the same error comes up. Any thoughts?
Further to above, I got further now (had to do a clean install of Raspbian 8), but now when I run:
pacmd set-default-source bluez_source.xx_xx_xx_xx_xx_xx (I used the actual MAC address)
I get a response:
Source bluez_source.xx_xx_xx_xx_xx_xx does not exist
The sink command (pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx) worked.
Hi Alex,
Did you set the HSP profile?
Can you check if you have the source in the bluez card?
Just to give you a 3rd method as well.
Add stretch source to the sources and install/update pulseaudio & bluez will work nicely. If you dare you can do a full system upgrade as well but you might end up with some things not working.
hi,
would you mind giving more details ?
Or tutorial ?
thank you
Which details?
hi,
I can reply but can’t write new comment in this topic.
If I write again, It will said duplicate post ?
“Duplicate comment detected; it looks as though you’ve already said that!”
But I can’t find my new comment
If you reload the page does it work?
1. Thank you. your blog is one of most useful instruction on this subject matter.
2. Want to add something. I am using original Raspberry Pi 1 (instead of Raspberry Pi3). Apparently jessie-backport from debian is not compatible with this hardware, so I had to compile pulseaudio on my own. While I running the bootstrap, I noticed that the configuration script failed to detect bluez and udev.
Upon further research, I noticed that you need to install additional development packages
libltdl-dev libsamplerate0-dev libsndfile1-dev libglib2.0-dev libasound2-dev libavahi-client-dev libspeexdsp-dev liborc-0.4-dev libbluetooth-dev intltool libtdb-dev libssl-dev libudev-dev libjson0-dev bluez-firmware libbluetooth-dev libsbc-dev libcap-dev
Once these packages installed, then, the configure script detect bluez and udev successfully.
3. Then, I run into problem. Please help.
Once I compiled and installed it, and when I run anything related to pulseaudio, I got an error. The error is tricky, that if I simply run pulseaudio as a regular user, it will give me “illegal instruction.” If I try to use superuser to execute pulseaudio, it will simply exit the program without giving out any error message.
So, I simply typed “gdb pulseaudio”
and it give me this error Illegal instruction error
0xb6950e30 in ?? () from /usr/lib/arm-linux-gnueabihf/pulseaudio/libpulsecommon-7.1.so
this library is part of the pulseaudio library I compiled and installed, so I am a bit confused.
(yes, I compiled and installed Pulseaudio 7.0… I tried 6.0 and gave me the same error so I thought I might give 7.0 a try since installing via backports method also installs version 7.0)
and, fyi, using method one to install pulseaudio 7 also give me this error.
Any idea what went wrong?
Thanks in advance
Never mind the 3rd point. It was my mistake by trying the jessie-backports repository and that repository only supports ARMv7 instruction sets while my raspberry pi uses ARMv6 CPU. Since I massively updated my system using jessie backports thus many software are no longer usable. I have to reinstall everything again.
Thanks.
Your instruction is clearest so far in terms of explaining why you do things certain way, thus, very helpful. I am still trying to install pulseaudio so I don’t know my next steps are. Conceptually, though, I am a bit confused. It seems that pulseaudio need to connect to the alsa somehow anyway.
if u have extra time, do consider explain this to rest of us?
much appreciated.
Hi
Sorry for not answering earlier, I wasn’t online.
Your request is how to install PulseAudio in a Raspberry Pi 1?
If yes, I can’t do it before some weeks because I’m not at home.
I can give it a try asap 🙂
Currently,I’m trying to implement HSP and HFP in raspberry pi3 using inbuilt bluetooth controller. I’m using Bluez5.23,Pulseaudio 7 and ofono 1.15 . But failed miserably.. However A2DP is working fine.
Is it possible to implement HSP and HFP? If so , could you please share the steps and required commands?
Thanks in advance..
Unfortunately I don’t see any solution to implement HSP and HFP using built-in Bluetooth controller. You really need to buy a Bluetooth USB dongle as I explained in the tutorial.
I tried to implement HSP and HFP with a bluetooth dongle. But failed. SCO audio packets are flowing between pi and phone. I verified that with the command btmon -S. But still no audio is coming from pi. I can’t understand where the actual problem is!! Is it possible to have any issue with bluez or pulseaudio?? Please help.. Thanks in advance…
I can only answer you for HSP profile because I didn’t yet check for HFP.
Can you tell me what is the profile that you are using? Is it HSP sink or source?
We are trying to implement both. We tried to record using bluetooth headset microphone. It seems like that microphone is not even get identified as an input device. Totally confused!!
I used a USB bluetooth dongle also and tried implementing HSP and HFP. Using ofono, I’m able to do dial,answer call etc…. But there is no audio from either pi or phone. Is there any way to resolve this??
[…] on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle […]
Both
“pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx”
“pacmd set-default-source bluez_source.xx_xx_xx_xx_xx_xx”
does not exist.
Also when I check:
“pactl list cards”
it does “Assertion ‘pthread_mutex_lock(&m->mutex) == 0’ failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.” at the very end
After following these instructions to a tee, I get my bluetooth headset to connect to my USB dongle yet I dont see them in “pactl list cards”.
Im at a loss as to why this is occuring..
Thank you
I don’t see what can be the problem here. I recommend you to try again with a fresh Raspbian version.
Hello
Quick question, at the end of your instructions you mention to record yourself with the microphone. Which microphone do you use? does your headset have a built in microphone or did you use a separate bluetooth microphone to record your voice? I’m trying to connect a headset with built in mic and I can get A2DP working to listen to audio but I cannot get HSP/HFP working for audio or recording. I figured I could try whichever bluetooth headset microphone you are using.
Thanks
I’m using Phillips SHB5600 headset, there is built-in microphone.
Thank you!
hi, Youness, thank you for providing this article, it’s the most informative tutorial about setting up bluetooth headset on pi3. one thing I really want to know is that, is there any information that raspbian will update its bluetooth firmware to support mic?
My current understanding is that the problem comes from the link (hardware/software) between the chip and the rest of Raspberry Pi, not the Raspbian. It is a close-source board so we can’t do much without the help of the suppliers…
oh…..so this means that we probably can’t get access to the Bluetooth microphone with the builtin BCM43438 chipset… that’s bad….
Hell Youness,
Thanks for the time taken to do this, and its very much appreciated.
I have followed your instruction with 3 different Bluetooth adapters, even purchasing the exact ASUS one you used (just be be certain) and I still get the same result; that is AD2P works, but not HSP.
Is there something I am missing, as my headset profile is not working and I can’t set it as source as expected.
Kind regards
Your’e welcome.
Did you use a new Raspbian version? It is the only thing that may be different in our setups.
Hello Youness,
Well I don’t think I did, but I have done a update and apt-get dist-upgrade and still nothing. Isn’t that supposed to solve any issues in terms of differences?
Regards
No I just said that, if you are using the same hardware like me, then the difference may be in software part.
Can you check with pacmd list-cards if your headset had all profiles available?
Hello,
I really appreciate the speedy responses.
Below is what I get when I run the command specified “pacmd list-cards”
2 card(s) available.
index: 0
name:
driver:
owner module: 6
properties:
alsa.card = “0”
alsa.card_name = “bcm2835 ALSA”
alsa.long_card_name = “bcm2835 ALSA”
alsa.driver_name = “snd_bcm2835”
device.bus_path = “platform-soc:audio”
sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
device.string = “0”
device.description = “bcm2835 ALSA”
module-udev-detect.discovered = “1”
device.icon_name = “audio-card”
profiles:
output:analog-mono: Analog Mono Output (priority 200, available: unknown)
output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
off: Off (priority 0, available: unknown)
active profile:
sinks:
alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
sources:
alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
ports:
analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
properties:
index: 1
name:
driver:
owner module: 22
properties:
device.description = “iLuv MobiOne”
device.string = “BC:12:06:00:86:54”
device.api = “bluez”
device.class = “sound”
device.bus = “bluetooth”
device.form_factor = “headset”
bluez.path = “/org/bluez/hci0/dev_BC_12_06_00_86_54”
bluez.class = “0x240404”
bluez.alias = “iLuv MobiOne”
device.icon_name = “audio-headset-bluetooth”
device.intended_roles = “phone”
profiles:
a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no)
off: Off (priority 0, available: yes)
active profile:
sinks:
bluez_sink.BC_12_06_00_86_54/#1: iLuv MobiOne
sources:
bluez_sink.BC_12_06_00_86_54.monitor/#1: Monitor of iLuv MobiOne
ports:
headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
properties:
headset-input: Headset (priority 0, latency offset 0 usec, available: no)
properties:
Regards
I’m using my smartphone so no problem to answer quickly 🙂
OK, so you see for a2dp_sink the availability is unknown, and for headset_head_unit it is no…
With that you have no audio at all…
Just to not waste time, did you already use your speaker with another PC to check if it works well? It may be the speaker that is saying to Raspberry Pi that it has no profiles. For your information I’m facing a similar problem with the speaker Amazon Echo, that works well with a phone, but never works with a Linux PC.
Hello,
Actually I do have audio and it sounds fine using your test command “paplay -v …..wav”
I have used ti with my iPhone and it works fine over bluetooth. but mic and speaker.
Well on you last point, I am also beginning to suspect the speaker but will look into getting another one to test and get back to you.
Thanks for the help
Yes and keep in mind that this is unstable solution, so it will work sometimes with no clear reason why.
What I said before is that there is a problem for “speakers”, they are OK with phones but KO for Linux PC.
For headsets they are OK for both phones and PC.
Good luck and feel free to ask.
You are tha man bro !! keep it up
Thanks 🙂
Hi
I used my phone(Galaxy) and proceeded in order
$ pactl list cards
Profile
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 10, available: yes)
headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
$ pacmd set-card-profile 1 headset_audio_gateway
Failed to set card profile to ‘headset_audio_gateway’.
I need your help.
Thank you.
Hi,
As you can see, the availability of the profile headset_audio_gateway is “no”.
Try to remove the smartphone and pair it again, and check if the availability is ” yes”.
Hi Youness,
Thanks for the great post.
I was able to connect with my “handsfree” bluetooth device as HSP.
I can play .wav files but when I tried to record my voice using the microphone of this “handsfree” device the file is recorded but no sound.
I have tested the microphone of this device using my phone, and I am sure the mic is working.
Any thoughts?
Hi,
When you do the command:
paplay -v voice.wav
What do you see as verbose?
I think you should see some information about ongoing recording.
hi pablo,
Which PulseAudio version you are using ?
I tried both 2 method but still cannot connect to my bluetooth device.
Hi Khoa, I used the same version Youness mention on the post. Version7.
I used the method number 1.
This is what I get when I record.
pi@raspberrypi:~ $ parecord -v voice.wav
Opening a recording stream with sample specification ‘s16le 2ch 44100Hz’ and channel map ‘front-left,front-right’.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, fragsize=352800
Using sample spec ‘s16le 2ch 44100Hz’, channel map ‘front-left,front-right’.
Connected to device bluez_source.FC_58_FA_1C_89_DC (index: 2, suspended: no).
^CGot signal, exiting.cy: 64504 usec.
pi@raspberrypi:~ $
And this is what I get when I play:
pi@raspberrypi:~ $ paplay -v voice.wav
Opening a playback stream with sample specification ‘s16le 2ch 44100Hz’ and channel map ‘front-left,front-right’.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, tlength=352800, prebuf=349276, minreq=3528
Using sample spec ‘s16le 2ch 44100Hz’, channel map ‘front-left,front-right’.
Connected to device bluez_sink.FC_58_FA_1C_89_DC (index: 1, suspended: no).
Stream started.
Playback stream drained.: 31750 usec.
Draining connection to server.
pi@raspberrypi:~ $
Hi Youness,
Your tutorial is very great and detailed. Thank you for supporting us.
I want to use a bluetooth dongle and connect it with a bluetooth headset or audio bluetooth module so that I can call Alexa from far away. I tried with my pi zero W and my raspberry pi 3.
My usb dongle AP Link 4.0:
https://www.amazon.ca/Bluetooth-Computer-Earphone-Transmitter-Receiver/dp/B01L34KMYK.
My audio bluetooth module:
https://www.eprolabs.com/product/csr8630-bluetooth-4-0-audio-stereo-receive-module/
My bluetooth headset Bluetooth Sony MDR-XB50BS
http://www.sony.com.sg/electronics/in-ear-headphones/mdr-xb50bs
On raspberry pi 3:
Method 1: Install PulseAudio from Debian Backports
I did sudo apt-get install libudev-dev libsbc-dev libbluetooth-dev libx11-xcb-dev libasound2-dev libsystemd-dev libsamplerate0-dev
but after ran ./ bootstrap, the udev, bluez5, ofono, native-headset, alsa, X11, systemd, … still were not enabled.
Then I follow next steps.
In bluetoothctl, I got error when I connect my audio bluetooth module:
[bluetooth]# pair 54:01:01:02:23:32
Attempting to pair with 54:01:01:02:23:32
[CHG] Device 54:01:01:02:23:32 Connected: yes
[CHG] Device 54:01:01:02:23:32 UUIDs:
0000110b-0000-1000-8000-00805f9b34fb
0000110c-0000-1000-8000-00805f9b34fb
0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 54:01:01:02:23:32 Paired: yes
Pairing successful
[CHG] Device 54:01:01:02:23:32 Connected: no
[bluetooth]# trust 54:01:01:02:23:32
[CHG] Device 54:01:01:02:23:32 Trusted: yes
Changing 54:01:01:02:23:32 trust succeeded
[bluetooth]# connect 54:01:01:02:23:32
Attempting to connect to 54:01:01:02:23:32
Failed to connect: org.bluez.Error.Failed
[bluetooth]#
So my problem is udev, bluez5, ofono, native-headset, alsa, X11, systemd, … were not enabled , right ?
Method 2: Use PulseAudio sources
I got
pi@raspberrypi:~ $ dpkg -l pulseaudio pulseaudio-module-bluetooth
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii pulseaudio 7.1-2~bpo8+1 armhf PulseAudio sound server
ii pulseaudio-mod 7.1-2~bpo8+1 armhf Bluetooth module for PulseAudio s
But can’t connect my module too.
[bluetooth]# pair 54:01:01:02:23:32
Attempting to pair with 54:01:01:02:23:32
Failed to pair: org.bluez.Error.AlreadyExists
[bluetooth]# trust 54:01:01:02:23:32
Changing 54:01:01:02:23:32 trust succeeded
[CHG] Device DA:94:4A:70:84:52 RSSI: -70
[bluetooth]# connect 54:01:01:02:23:32
Attempting to connect to 54:01:01:02:23:32
Failed to connect: org.bluez.Error.Failed
Both method I’ve already added my pi to pulse group
Would you mind helping me ?
Hi,
I installed the new raspbian image 5/7/2017 and follow all the step again.
Now I can connect to my audio bluetooth module but I can’t find HSP or headset_head_unit.
pi@raspberrypi:~ $ pactl list cards
Card #0
Name: alsa_card.platform-soc_audio
Driver: module-alsa-card.c
Owner Module: 6
Properties:
alsa.card = “0”
alsa.card_name = “bcm2835 ALSA”
alsa.long_card_name = “bcm2835 ALSA”
alsa.driver_name = “snd_bcm2835”
device.bus_path = “platform-soc:audio”
sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
device.string = “0”
device.description = “bcm2835 ALSA”
module-udev-detect.discovered = “1”
device.icon_name = “audio-card”
Profiles:
output:analog-mono: Analog Mono Output (sinks: 1, sources: 0, priority: 200, available: yes)
output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6000, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:analog-stereo
Ports:
analog-output: Analog Output (priority: 9900, latency offset: 0 usec)
Part of profile(s): output:analog-mono, output:analog-stereo
Card #1
Name: bluez_card.54_01_01_02_23_32
Driver: module-bluez5-device.c
Owner Module: 22
Properties:
device.description = “KRC-86B V4.0”
device.string = “54:01:01:02:23:32”
device.api = “bluez”
device.class = “sound”
device.bus = “bluetooth”
device.form_factor = “speaker”
bluez.path = “/org/bluez/hci0/dev_54_01_01_02_23_32”
bluez.class = “0x240414”
bluez.alias = “KRC-86B V4.0”
device.icon_name = “audio-speakers-bluetooth”
Profiles:
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: a2dp_sink
Ports:
speaker-output: Speaker (priority: 0, latency offset: 0 usec)
Part of profile(s): a2dp_sink
speaker-input: Bluetooth Input (priority: 0, latency offset: 0 usec, not available)
What should I do ?
Would you mind helping me ?
Thanks
Hi Khoa, as you can ser un your profiles list, YouTube Bluetooth device is justo a receiver, si you once Have the a2dp profile available, try to connect your headphone instead.
Hi Pablo,
Thank you for your help
I tried with my Zenphone 2 , Iphone 5s, Sony M4 Aqua and always get
headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
When I run bluetooth scan ,I can’t find my bluetooth headset Bluetooth Sony MDR-XB50BS
http://www.sony.com.sg/electronics/in-ear-headphones/mdr-xb50bs
Haizz, May be I have to buy a new bluetooth headphone.
Which one you are using , Pablo ?
May Be your headphones needs to be “visible”, do you have the manual of your headphones?
I am using a “hands free” speaker, Chinese, no brand.
Pretty much like this one, but no leds light.
https://m.aliexpress.com/s/item/32819921968.html?spm=a2g0n.search-cache.0.0.7f25570frLIse4
Hi, Pablo.
The Bluetooth version on my Sony MDR-XB50BS is “4.1”. My usb bluetooth dongle is “4.0”
I think that is the reason why I can’t find my bluetooth headphone. Their bluetooth version doesn’t match each other.
I tried with my friend’s bluetooth headphone “Anker SoundBuds Sport Bluetooth Headphone” and the bluetooth version is 4.0.
It works perfectly.
I’m really sad because my bluetooth headphone is more expensive but can’t work.
Anyway, many thanks to Youness for making such a great tutorial.
Hi,
I think maybe the problem is the driver that you have to install manually in Raspbian, did you find it and copy it to firmware folder?
Hi Youness,
you mean the driver of the bluetooth dongle ? or my bluetooth headphone MDR-XB50BS ?
I found the guide: https://docs.sony.com/release//Help_4595529111.pdf
In section “Pairing and connecting with other BLUETOOTH devices” has note:
“When pairing with a BLUETOOTH device that cannot display a list of detected devices or that has no display, you may pair the device by setting both the headset and the BLUETOOTH device to pairing mode. At this time, if passkey is set other than “0000” on the BLUETOOTH device, pairing cannot be done with the headset”
I don’t understand anh know how to “setting both the headset and the bluetooth device to pairing mode” ?
Hi,
I mean the driver for the dongle.
I got another idea: I think your headset is not working because it waits for a confirmation of pairing code from the Raspberry Pi, like a screen where you see a code and accept it. Are you using a screen?
I’m trying to find how we can confirm the pin code by commands, but maybe the Raspberry Pi will show you a pop up, try with screen or with VNC.
Additionally: Trust the headset with the command trust xx.xx.xx…..
But I still don’t understand.
My phone’s bluetooth support “4.0, A2DP, EDR” but it can connect to my Sony MDR-XB50BS.
Is it because of A2DP feature ?
are there any usb bluetooth dongle 4.1 ?
Hi Youness,
I can connected with my headphone.
The problem is I have to press and hold the button on my headphone to change it to mode “BLUETOOTH pairing”.
But now I have another problems.
1/ On my Pi zero W: I got error
pi@raspberrypi:~ $ pulseaudio -D
Illegal instruction
I type all commands follow the link you gave: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
sudo addgroup –system pulse
sudo adduser –system –ingroup pulse –home /var/run/pulse pulse
sudo addgroup –system pulse-access
# Some distributions restrict access to the sound devices to a group audio
sudo adduser pulse audio
# Add a user to the pulse-access group
sudo adduser pi pulse-access
But still not works.
2/ On my pi 3: I already “runpulseaudio –start” and able to connect with my headphone
I got this after typed “pactl list cards”
Card #2
Name: bluez_card.00_18_09_9F_D8_BC
Driver: module-bluez5-device.c
Owner Module: 24
Properties:
device.description = “MDR-XB50BS”
device.string = “00:18:09:9F:D8:BC”
device.api = “bluez”
device.class = “sound”
device.bus = “bluetooth”
device.form_factor = “headset”
bluez.path = “/org/bluez/hci0/dev_00_18_09_9F_D8_BC”
bluez.class = “0x240404”
bluez.alias = “MDR-XB50BS”
device.icon_name = “audio-headset-bluetooth”
device.intended_roles = “phone”
Profiles:
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off
Ports:
headset-output: Headset (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit, a2dp_sink
headset-input: Headset (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit
pi@raspberrypi:~ $ pacmd set-card-profile 2 headset_head_unit
Failed to set card profile to ‘headset_head_unit’.
pi@raspberrypi:~ $ sudo pacmd set-card-profile 2 headset_head_unit
No PulseAudio daemon running, or not running as session daemon.
I used to use pavucontrol to drive the sound but now I got
pi@raspberrypi:~ $ sudo apt-get install pavucontrol
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
pavucontrol : Depends: libpulse-mainloop-glib0 (>= 0.99.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
How do you drive sound to bluetooth to work with Alexa after installed pulseaudio 7.1-2~bpo8+1 ?
I don’t use pavucontrol and I think it will not work for you, because it is not yet supporting Bluez and PulseAudio that we are using.
For my Alexa I use PulseAudio commands like set default sink, source…etc.
Of course you have to press and hold the button to pair it the first time 🙂
I don’t use Pi Zero W and I don’t recommend you to use it because of Bluetooth audio issues.
For Raspberry Pi 3 it seems everything is OK your profiles are displayed. Try to switch from a2dp to off and then from off to hsp. At this level random problems occur so you just keep trying to switch profiles…
Haiz,
my speaker Jabra speal 510 works perfectly, The profine is already headset_head_unit
http://www.jabra.com/business/speakerphones/jabra-speak-series/jabra-speak-510
My raspberry still can’t change the profine of my headphone
pi@raspberrypi:~ $ pacmd set-card-profile 0 a2dp_sink
pi@raspberrypi:~ $ pacmd set-card-profile 0 off
pi@raspberrypi:~ $ pacmd set-card-profile 0 headset_head_unit
Failed to set card profile to ‘headset_head_unit’.
Hi, did anything change now that Raspbian stretch is out?
Hi, I just see that now there is Stretch with PulseAudio v10, I’ll test it and let you know. (Theorically, only the part for manually install PulseAudio will be skipped)
Now that blue-alsa is recommended and supported solution on rasbian stretch. Have you tried to get this to work on bluealsa instead of pulseaudio.
Can you give me the link to this information please?
https://www.raspberrypi.org/blog/raspbian-stretch/
Ah… I didn’t expect such a change. I’ll give it a try soon, even if I know that the problem is BT firmware and nothing changes for it.
[…] on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle […]
On amazon it says the ASUS USB Bluetooth only works with windows and mac.
Your SURE it works with Linux?
I personally took an Asus BT400 from Amazon to do that, so yes it works, but you see that there is a preparation to do so.
Hi Youness, I am still having troubles trying to connect my RPi2 with usb dongle to my SONY SRS X11 bluetooth speaker.
Most of the times I have troubles with bluetoothctl trying to pair and connect to the speaker. But removing the devices from the list and start all the process again sometimes I am able to connect to the speaker again, some other times don’t, so I have to reboot the RPi.
When I am able to connect to the speaker, using the headset_head_unit profile, and I try to play or record, it seems the pulseaudio get bussy and did not respond and I am not able to change the profile, neither a2dp_sink nor off profile.
This is what I get when I try to record:
pi@raspberrypi:~ $ parecord -v voice.wav
Opening a recording stream with sample specification ‘s16le 2ch 44100Hz’ and channel map ‘front-left,front-right’.
Connection established.
When this happend I have to ctrl+c or wait for at least 2 minutes until I get an error message.
Only once I could record an audio, but then after 3 or 4 tests it stopped working.
Which is more strange is the bluetoothctl does not respond neither, I can’t even remove the device from the list of devices.
I am suspecting my dongle is not good enough, my dongle is bluetooth 2.0 and my speaker is 3.0.
Did you have any clue of what can be happening?
I have bought a new Bluetooth dongle, this new is 4.0 (generic) and it works fine. So the issue was the Bluetooth dongle.
I think it is excellent that Youness has put up these instructions and takes the time to work on this. Thank you!
I followed the instructions and I was able to pair and connect with the device. However I have had only partial success but not complete success. I can send music to my bluetooth device, but the microphone does not work.
I think that either:
1) there is some additional step that is sometimes needed to make the instructions work,
or 2) the instructions work for some Bluetooth adapters but not others,
or 3) the instructions work for some Bluetooth devices but not others.
My adapter is the Kinivo BTD-400 (Bluetooth 4.0) device from Amazon.
My device is the Anker SoundCore Mini with speaker and microphone. Both speaker and microphone work with my desktop computer.
I began with a copy of 2017-07-05-raspbian-jessie.
The only variation from the instructions was that I had to use a different driver. When I looked at dmesg output I got
[ 3.075953] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2
instead of what is listed in the instructions. So I had to inspect the bcbtums-win7x86-brcm.inf file for the matching driver, which was
BCM20702A1_001.002.014.0889.0896.hex (slightly different number).
But following the conversion to .hcd and the rest of the instructions, I restarted and then dmesg said the correct driver was present, so I think that I got those steps OK.
The problem comes when after following all directions, I still could not use microphone. I tried many things, restarting, re-pairing, etc., but still no go.
I think this is explained when I do “pactl list cards” and I see:
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
I suspect that unless I can see “available: yes” the microphone will not work.
The question is, what must I change in order to get “available: yes”?
Did I make a mistake in following the directions? Is there some software that needs to be updated? Do I need to use the exact adapter from the instructions (ASUS BT-400)? Or do I need a different bluetooth speaker/microphone? These are hard questions, maybe no one can know the answer yet.
I believe that bluetooth and sound on the raspberry pi is a tricky problem, however, and we will all have to work and share whatever we find out about it. If you have success with the instructions, please post the brand of adapter and device you are using, so perhaps we can see the pattern.
Hi Michael,
I have the same problem.
And I think it depends on the device.
my speaker Jabra speal 510 works perfectly, The profine is already headset_head_unit. The device automatically change to headset_head_unit after connected to me Bluetooth dongle.
http://www.jabra.com/business/speakerphones/jabra-speak-series/jabra-speak-510
But my bluetooth headset Bluetooth Sony MDR-XB50BS
http://www.sony.com.sg/electronics/in-ear-headphones/mdr-xb50bs
the headset_head_unit is not available and I still don’t know how to deal with it.
Hope someone can find the solution.
非常感谢,你的文章成功帮助我解决了问题!thanks!
Needed Google Translate to understand that comment, you are welcome 🙂
I tried the instructions using raspbian stretch instead. It is now easier to install pulseaudio; simply by doing this:
sudo apt-get install pulseaudio
sudo apt-get install pulseaudio-module-bluetooth
which installs pulseaudio v10. (No longer necessary to use backport or build manually.) Also it is no longer necessary to modify the makefile for hex2hcd.
Also, I borrowed an older Jawbone Jambox bluetooth speaker/microphone. This now works perfectly with the instructions above (using bluetooth dongle), both speaker and microphone, and reports the available profile with “pactl list cards”:
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
My Anker SoundCore speaker still does NOT work.
So I conclude: 1) the instructions work for some audio devices but not others, 2) it is not necessary to use the exact same BT dongle that Youness used, 2) updating to stretch and pulseaudio 10 will not help if your device is not compatible, 3) use “pactl list cards” to see if your device is compatible.
Hi Michael,
Thanks for your great feedback, I appreciate it.
I confirm that with Stretch you can install PulseAudio v10, but, Raspbian Foundation is now using another interface: bluez-alsa, I have to write a post to explain the instructions, since the community will now have this as support.
I confirm also that the instructions should work with other dongles, you just need to figure out how to install their Linux drivers.
People reported before that some devices may not work 100%, I think this is related to the devices themselves, if they don’t implement Bluetooth profiles correctly, sometimes they are not sending the correct information about profiles, or maybe they are not doing well the pairing process. I recommend to not use cheap or unknown brand speakers.
One more comment: I had some trouble playing through the speaker when I had the system boot into the GUI. This may be due to having two different interfaces to control the audio source active at the same time. The problem went away when I changed the preferences to boot directly to the command line.
I’m not sure, but some GUI tools used for Bluetooth are not up-to date with PulseAudio, that’s why I recommend to do everything by CLI.
I have learned the reason some devices work and some do not. According to this note from August 2016 https://www.mail-archive.com/pulseaudio-discuss@lists.freedesktop.org/msg16445.html
“When all headsets supported both HSP and HFP, life was good and we
only needed to implement HSP in the native backend. Unfortunately
some headsets have started supporting HFP only.”
This is from a developer on the pulseaudio-discuss list. He was working on a fix, but it is not done yet.
I can confirm that this is the problem, from my experience.
The Jawbone Jambox speaker works. It is older. It supports both Headset and Handsfree.
The SoundCore Mini speaker does not work. It is newer. It supports both Handsfree only.
(To find out what is supported, use bluetoothctl and the ‘info xx:xx:xx:xx:xx:xx’ command.)
There is a complicated workaround that is mentioned for this at https://freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index5h2 for the pulseaudio 11.0 release. I was not able to have success with this workaround, which uses ofono and phonesim.
Hi Michael,
Your remark is correct, HFP devices will not without oFono, I wrote about that in my first blog post.
But I doubt that this is the main reason, for me most of headsets are made for internet calls, so no need to have HFP, that is dedicated to cellular calls (start call, end call…)
So better to check if the headset supports HSP before purchasing it.
I found the way to solve build-in BCM4343 modules problem, you should change the operation baud rate, default is 115200.
Now I can play music with good sound quality.
Hi Lym,
Can you please give me more information on how you did that? Using some specific commands to configure the chipset? And what is the baudrate value that you made?
Hi Lym,
Did this fixed the HSP/HFP profile (microphone)?
Post some instructions please!
Thanks,
Attila
1. My platform is NanoPi M1 Plus(Wiki http://wiki.friendlyarm.com/wiki/index.php/NanoPi_M1_Plus),with WIFI/BT module AP6212A(BCM4343A0),use serial interface to connect the module in hardware;
2. I try the way above, and I can connect my phone, play the music which with terrible sound quality,and usb BT module do not have this problem;
3. I fix the BT driver bug which in /kernel/driver/bluetooth/, include hci_ldisc.c & hci_bcm.c, I change the baud rate to 512000, and it really fix the terrible sound quality.
4. My kernel version is 4.14.0, you can consult my kernel patch below:
— a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -128,6 +128,7 @@ static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
kfree_skb(skb);
}
+ BT_INFO(“— zztest Set Controller UART speed to %d bit/s”, speed);
bt_dev_dbg(hdev, “Set Controller UART speed to %d bit/s”, speed);
param.zero = cpu_to_le16(0);
@@ -344,6 +345,7 @@ static int bcm_open(struct hci_uart *hu)
mutex_unlock(&bcm_device_lock);
out:
+
return 0;
}
@@ -383,6 +385,7 @@ static int bcm_close(struct hci_uart *hu)
kfree(bcm);
hu->priv = NULL;
+ BT_INFO(“—– zztest bcm_close init_speed = %d oper_speed = %d”, hu->init_speed, hu->oper_speed);
return 0;
}
@@ -414,17 +417,17 @@ static int bcm_setup(struct hci_uart *hu)
if (err)
return err;
– err = request_firmware(&fw, fw_name, &hu->hdev->dev);
– if (err hdev, “BCM: Patch %s not found”, fw_name);
– return 0;
– }
+ // err = request_firmware(&fw, fw_name, &hu->hdev->dev);
+ // if (err hdev, “BCM: Patch %s not found”, fw_name);
+ // return 0;
+ // }
– err = btbcm_patchram(hu->hdev, fw);
– if (err) {
– bt_dev_info(hu->hdev, “BCM: Patch failed (%d)”, err);
– goto finalize;
– }
+ // err = btbcm_patchram(hu->hdev, fw);
+ // if (err) {
+ // bt_dev_info(hu->hdev, “BCM: Patch failed (%d)”, err);
+ // goto finalize;
+ // }
/* Init speed if any */
if (hu->init_speed)
@@ -452,7 +455,7 @@ static int bcm_setup(struct hci_uart *hu)
}
finalize:
– release_firmware(fw);
+ // release_firmware(fw);
err = btbcm_finalize(hu->hdev);
if (err)
@@ -461,6 +464,7 @@ static int bcm_setup(struct hci_uart *hu)
if (!bcm_request_irq(bcm))
err = bcm_setup_sleep(hu);
+ BT_INFO(“—– zztest bcm_setup init_speed = %d oper_speed = %d”, hu->proto->init_speed, hu->proto->oper_speed);
return err;
}
@@ -489,7 +493,7 @@ static const struct h4_recv_pkt bcm_recv_pkts[] = {
static int bcm_recv(struct hci_uart *hu, const void *data, int count)
{
struct bcm_data *bcm = hu->priv;
–
+ // BT_INFO(“—– zztest bcm_recv init_speed = %d oper_speed = %d”, hu->proto->init_speed, hu->proto->oper_speed);
if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
return -EUNATCH;
@@ -900,6 +904,7 @@ static const struct hci_uart_proto bcm_proto = {
.name = “Broadcom”,
.manufacturer = 15,
.init_speed = 115200,
+ .oper_speed = 512000,
.open = bcm_open,
.close = bcm_close,
.flush = bcm_flush,
diff –git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
old mode 100644
new mode 100755
diff –git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
old mode 100644
new mode 100755
index a746627..ba8caff
— a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -361,7 +361,7 @@ void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed)
/* tty_set_termios() return not checked as it is always 0 */
tty_set_termios(tty, &ktermios);
– BT_DBG(“%s: New tty speeds: %d/%d”, hu->hdev->name,
+ BT_INFO(“—– zztest %s: New tty speeds: %d/%d”, hu->hdev->name,
tty->termios.c_ispeed, tty->termios.c_ospeed);
}
@@ -373,30 +373,30 @@ static int hci_uart_setup(struct hci_dev *hdev)
unsigned int speed;
int err;
– /* Init speed if any */
– if (hu->init_speed)
– speed = hu->init_speed;
– else if (hu->proto->init_speed)
– speed = hu->proto->init_speed;
– else
– speed = 0;
–
– if (speed)
– hci_uart_set_baudrate(hu, speed);
–
– /* Operational speed if any */
– if (hu->oper_speed)
– speed = hu->oper_speed;
– else if (hu->proto->oper_speed)
– speed = hu->proto->oper_speed;
– else
– speed = 0;
–
– if (hu->proto->set_baudrate && speed) {
– err = hu->proto->set_baudrate(hu, speed);
– if (!err)
– hci_uart_set_baudrate(hu, speed);
– }
+ // /* Init speed if any */
+ // if (hu->init_speed)
+ // speed = hu->init_speed;
+ // else if (hu->proto->init_speed)
+ // speed = hu->proto->init_speed;
+ // else
+ // speed = 0;
+
+ // if (speed)
+ // hci_uart_set_baudrate(hu, speed);
+
+ // /* Operational speed if any */
+ // if (hu->oper_speed)
+ // speed = hu->oper_speed;
+ // else if (hu->proto->oper_speed)
+ // speed = hu->proto->oper_speed;
+ // else
+ // speed = 0;
+
+ // if (hu->proto->set_baudrate && speed) {
+ // err = hu->proto->set_baudrate(hu, speed);
+ // if (!err)
+ // hci_uart_set_baudrate(hu, speed);
+ // }
if (hu->proto->setup)
return hu->proto->setup(hu);
@@ -454,7 +454,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
{
struct hci_uart *hu;
– BT_DBG(“tty %p”, tty);
+ BT_INFO(“—- zztest tty %p”, tty);
/* Error if the tty has no write op instead of leaving an exploitable
* hole
@@ -717,6 +717,7 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file,
struct hci_uart *hu = tty->disc_data;
int err = 0;
+ arg = HCI_UART_BCM;
BT_DBG(“”);
/* Verify the status of the device */
5. By the way, I also fix this problem in old kernel version(3.4.9) which just use the H4 protocol, you should add your own baud set function.
6. Any questions please feel free to contact me, my email is xiezhipeng@iot-tw.com.
Hi Lym,
Did this fixed the HSP/HFP profile (microphone)?
Post some instructions please!
Thanks,
Attila
Hi Youness,
When You investigated the problem with the BCM4343 firmware / driver, did you managed to find out what exactly the problem is?
I’m trying to use a JBL Go Bluetooth speaker with the HSP/HFP profile.
The pacmd listing shows the device, with both the a2dp_sink and headset_head_unit profiles. The a2dp_sink works, but the headset_head_unit not.
$ pacmd list-cards
…
index: 2
name:
driver:
owner module: 26
properties:
device.description = “JBL GO”
device.string = “78:44:05:4B:4F:FF”
device.api = “bluez”
device.class = “sound”
device.bus = “bluetooth”
device.form_factor = “headset”
bluez.path = “/org/bluez/hci0/dev_78_44_05_4B_4F_FF”
bluez.class = “0x240404”
bluez.alias = “JBL GO”
device.icon_name = “audio-headset-bluetooth”
device.intended_roles = “phone”
profiles:
headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
off: Off (priority 0, available: yes)
active profile:
sinks:
bluez_sink.78_44_05_4B_4F_FF.headset_head_unit/#6: JBL GO
sources:
bluez_sink.78_44_05_4B_4F_FF.headset_head_unit.monitor/#8: Monitor of JBL GO
bluez_source.78_44_05_4B_4F_FF.headset_head_unit/#9: JBL GO
ports:
headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
properties:
headset-input: Headset (priority 0, latency offset 0 usec, available: unknown)
properties:
When I select the a2dp_sink profile with
$ pacmd set-card-profile 2 a2dp_sink
I’m able to successfully play the sample file:
pi@raspberrypi:~ $ paplay -v -d bluez_sink.78_44_05_4B_4F_FF.a2dp_sink /tmp/h2g2.ogg
I can activate the headset_head_unit profile too:
$ pacmd set-card-profile 2 headset_head_unit
, but when I trying to replay something the paplay command gets stuck and I must exit with Ctrl+C:
$ paplay -v -d bluez_sink.78_44_05_4B_4F_FF.headset_head_unit /tmp/h2g2.ogg
Opening a playback stream with sample specification ‘float32le 1ch 32000Hz’ and channel map ‘mono’.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, tlength=256000, prebuf=253444, minreq=2560
Using sample spec ‘float32le 1ch 32000Hz’, channel map ‘mono’.
Connected to device bluez_sink.78_44_05_4B_4F_FF.headset_head_unit (index: 12, suspended: no).
Time: 0.000 sec; Latency: 2000000 usec. #gets stuck here
The same happens with parecord:
$ parecord -v /tmp/rec.wav
Opening a recording stream with sample specification ‘s16le 2ch 44100Hz’ and channel map ‘front-left,front-right’.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, fragsize=352800
Using sample spec ‘s16le 2ch 44100Hz’, channel map ‘front-left,front-right’.
Connected to device bluez_source.78_44_05_4B_4F_FF.headset_head_unit (index: 19, suspended: no).
Time: 0.025 sec; Latency: 25327 usec.
Is this behaviour similar to what you have experienced?
Thanks,
Attila
Hi Everyone,
Seems that, we have a SOLUTION to use the HSP profile with Raspberry Pi 3’s built in BCM43438 chip. The culprit was the so called SCO audio routing. HSP / HFP uses SCO audio packets to transmit audio and in order to make PulseAudio work the packets must be routed to HCI interface. This can be done with the following command:
sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01
After issuing this command, both paplay and parecord should work with the HSP profile.
More details:
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index8h3
https://www.spinics.net/lists/linux-bluetooth/msg73883.html
Enjoy!
Hi Atilla, can’t try this on my side for the moment, but if this command is what is we need to configure BCM chip to correctly route audio input, I think that we are finally solving this headache. Thank you so much for your feedback. I’ll let you know when I get it myself.
Hi Atilla,
Tested today, I confirm that it works! New post to come this week. Thanks again.
Any chance of that Raspbian-Stretch version of this guide soon? Im working on a project that needs this
For sure this month, I just took back my hardware stuff.
Hi John, check the new post: https://youness.net/raspberry-pi/how-to-connect-bluetooth-headset-or-speaker-to-raspberry-pi-3
Thank you so much
Ironically, I thought Id never see a solution on this, so I went out and ordered a Bluetooth hat for my project in early February. Couldnt have been more than a day or two before you posted the final solution for connecting headsets to the standard RPI3 bluetooth . Oh well haha
The Bluetooth hat stays good if you care about audio quality, better than using internal one with. Bluetooth and Wifi. 🙂
Im guessing the data rate for the PI3s Bluetooth is bottlenecked by the USB controller the same way the Ethernet port is then?
Out of curiosity, why exactly does Bluetooth have such a complicated setup for its audio profiles? I get why A2DP exists as a way of prioritizing audio playback quality when the connection between bluetooth player and speaker can potentially be so thin, but HSP and HFP seem like two redundant, really complicated ways of just setting up the bluetooth speaker as a speaker/microphone device for the PC to interact with.
There are hardware and software problems.
Hardware: We want to minimize costs and devices, so we will use the same channel for different signals, including simple speakers, headsets and hands-free earphones. All of them shall be compatible with the same hardware, and switch from one to another using configurations, that what the command hcitool… does, it configures the hardware in such way to route for HSP.
Software: As we use open source packages, no one can ensure you the compatibility after every update, the same thing for support, for example Bluetooth profiles were supported in Bluez+ALSA but then they chose to drop it, so PulseAlsa is now supporting it.
You’ll not find this kind of issues in commercial products, if you use your headset in Windows it will handle A2DP and HSP with no problem and switch between them according to what you are doing.
Can we make a list of USB microphones that are working fine? I am planning to buy a JBL Go to make Alexa work. But, the ASUS mic you mentioned is even costlier than that. Please give me some suggestions.
For me all USB devices should work if you find the right software. I used the ASUS because I found its driver easily and someone else already tested it. For sure there are cheaper microphones but I can’t ensure that their drivers will be available for download.
I recommend you to look if others already installed JBL Go on a Linux distro (Debian will be great).
Hi Attila
Were you able to make JBL Go work for you? Both speaker & microphone?
MAJOR UPDATE
Thanks to Attila, the command mentioned on this page actually worked with my JBL Go speaker with an inbuilt mic.
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index8h3
Also, I have found some nice GUI tools which can I am using to manage Bluetooth & audio devices easily.
https://www.raspberrypi.org/magpi/bluetooth-audio-raspberry-pi-3/
Here are some issues I am facing right now:-
-I have to run fix command every time I start my raspberry pi.
-The audio is not clear. A lot of noise & playback speed is slow ( maybe because of processing issue)
-I want to use my speaker as PnP device. But, every time I power on my speaker after pairing. It connects but I have to disconnect & reconnect in headset profile manually to make the audio play.
I hope Attila or Youness or someone else can guide me in the right direction.
Thanks,
Divyadeep
Thanks for the confirmation.
For the problem, I think because you use at the same time the Bluetooth and Wifi. I didn’t improvement for that issue.
Which problem of mine are you referring to?
Also, when I play a youtube video, the playback speed is kind of slow. Why is that?
Are you using WiFi for Raspberry Pi?
Yes, I am using WiFi for Internet connectivity.
I know that WiFi on impacts Bluetooth audio quality, if possible use Ethernet instead.
Hi Attila
Are you facing same issues as I mentioned in my previous comment? I read in following thread that it worked for you. I am eager to know your results.
https://www.spinics.net/lists/linux-bluetooth/msg73883.html
Let’s collaborate on this if you are ok to do so.
Thanks,
Divyadeep
[…] 最近跟树莓派连接蓝牙杠上了,新入的树莓派安装叮当希望通过蓝牙音响播放声音,但是通过alsa配置连接的蓝牙根本没法正常使用,播放音乐勉强可以,但是叮当的语音完全听不到,或者磕磕绊绊只能听到最后几个字。看了这个文章《Connect Bluetooth Headset To Raspberry Pi 3 (A2DP & HSP)》,决定还是放弃板载蓝牙,用usb蓝牙适配器试一下。跟着这个文章折腾了很久,完全坑爹了,pulseaudio自己编译的就是不带pulseaudio-module-bluetooth,不知道这个东西的代码在哪,谷歌半天也没找到,只找到了二进制版本。最后掀桌重装系统,重新来,不听他胡比比了。 […]
Hey man love that you have gone to so much work to get this done for everyone!
I have got everything you are using in this tutorial but in the setup I am getting the error
sudo apt-get install intltool libtool libcap-dev libjson0-dev libsndfile1-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libjson0-dev
I’ve tried troubleshooting alot of this myself but I’m new to all of it so I’m a little lost, If anyone knows how I can solve this please let me know, I know I’m deep in the comment section haha
Cheers
Can you please check that latest post here ? http://youness.net/raspberry-pi/how-to-connect-bluetooth-headset-or-speaker-to-raspberry-pi-3 We don’t need anymore to compile PulseAudio.
[…] Pi3’s on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle […]
[…] Pi3’s on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle […]
[…] Pi3’s on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle […]
[…] Connect Bluetooth Headset To Raspberry Pi 3 (A2DP & HSP) […]
[…] 最近跟树莓派连接蓝牙杠上了,新入的树莓派安装叮当希望通过蓝牙音响播放声音,但是通过alsa配置连接的蓝牙根本没法正常使用,播放音乐勉强可以,但是叮当的语音完全听不到,或者磕磕绊绊只能听到最后几个字。看了这个文章《Connect Bluetooth Headset To Raspberry Pi 3 (A2DP & HSP)》,决定还是放弃板载蓝牙,用usb蓝牙适配器试一下。跟着这个文章折腾了很久,完全坑爹了,pulseaudio自己编译的就是不带pulseaudio-module-bluetooth,不知道这个东西的代码在哪,谷歌半天也没找到,只找到了二进制版本。最后掀桌重装系统,重新来,不听他胡比比了。 […]
I got the error make: *** [Makefile:1101: install] Error 2 when I tried to make on the second way. what should I do?
You can now install PulseAudio with apt.
I have iPhone 12 Pro. Fully updated Raspbian.
I do not have a USB bluetooth dongle, but I am able to connect my iPhone 12 pro to my raspberry pi 3B+ via bluetooth and instally automatically I hear sounds on raspberry pi produced from my iPhone’s Soundcloud and can also hear sounds which make phone calls on Viber App. The only time I can not hear any sound on raspberry pi is when I make or receive regular calls from my iPhone.
I would like get the audio sounds on to my raspberry pi when I receive and make calls on my iPhone 12 via bluetooth.
I ordered some USB 4.0 Bluetooth dongle from amazon for like $7… it will arrive tomorrow, will let you guys know if it works.
Good luck!
Alright, I just test it on the Raspberry Pi 3B+ of the USB bluetooth, it did plug and play and was able to connect with the iPhone 12 Pro, but still same problem like before with no sound from phone cellular calling.
I guess I will follow your instructions and see if it would work with the USB dongle.
If not its not a big deal, there are many ways to sink a cat, another plan is to buy a “bluetooth transmitter” which I think it can solve this meaningless Bluetooth issue, the bluetooth transmitter has a male Audio jack plug which can connect to the iPhone 12 pro (yes Apple forces us to buy a special cable which converts the “lighting” jack into an Audio female jack), by doing so it forces the iPhone to output all sounds from the iPhone to the audio jack, all outgoing sounds will be analog into the bluetooth transmitter which it will convert it to digital Bluetooth signal and pass that through the Raspberry Pi.
The bluetooth transmitter will connect to the raspberry pi via bluetooth.
Now the raspberry pi will be able to get all sounds even the cellular calling sound from the iPhone.
One big issue of this is the microphone, while all sound is coming out from the audio jack, iPhone might use it’s microphone while using cellular phone call. So it is really weird, the only way for the person who you are talking with on the iPhone to be able to hear you will be from the iPhone’s microphone.
This is however not always true, since it is possible for the audio jack on the iPhone to use both microphone and headphone, so this is really tricky, therefore I think a good Bluetooth transmitter might be able to use the microphone from the iPhone’s audio jack.
I know this since I saw there are plenty of “3 in 1 – Bluetooth transmitter and receiver” all in one package unit on Amazon.
The theory is that the “3 in 1 Bluetooth” device will allow a user to connect their bluetooth headphone to it, the bluetooth headphone has a built in microphone, thus it should be able to use the full calling feature on the iPhone while the “3 in 1 Bluetooth” device is connected with the Audio jack to the iPhone.
Here is the “3 in 1 Bluetooth device which is both a transmitter and receiver”, its only $18 and uses Bluetooth 5.0, I’ll buy it and let you know if it works:
https://www.amazon.com/gp/product/B0829S6K1X/ref=ox_sc_act_title_1?smid=A81DMK9A77IGW&psc=1
My main goal is to record the audio of my voce and the callers voice while on a phone call on the iPhone 12 Pro.
I want to make it very easy and organized to have the Raspberry Pi to record the calls and put a proper timestamp and upload it into a cloud storage for archiving.
I currently use a TASCAM professional handheld audio recorder to do this but it is extremely annoying, bulky and very messy with tons of wires. Worst of them all which I think is extremely pathetic, the TASCAM DR-40X does not have a built in real time clock which is powered by a small battery. Which means every time I change the batteries of the Tascam device, it will always erase and reset the time and settings.
I got it to work!
All of the following works perfectly: “Soundcloud”, “VOIP” apps and “cellular calling” to stream the sounds from iPhone 12 Pro to the Raspberry Pi.
I used this tutorial, completed everything before Step 5, then I simply hooked up a wired headphone to the Raspberry Pi’s headphone Audio jack and I made a simple phone call on my iPhone 12 Pro and I was able to hear the ringing and the person who I was speaking with on the headphone, therefore everything works:
https://scribles.net/hfp-on-raspberry-pi/
To make things clear, I’m only using a USB dongle to get everything to work.
Here is the link where I bought the USB dongle from, it was only $8, the sound quality is excellent for both steaming music and making phone calls. It is plug and play, no hassle for installation on Raspberry Pi:
https://www.amazon.com/gp/product/B0775YF36R/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
Glad that it works for you. I have a question about the sound quality, do you have a good quality while listening to SoundCloud? Or is it the same as a phone call? I’m asking this question to know if the Raspberry Pi switches between A2DP and HSP profiles depending on the application.