50 Responses

  1. Peter at | | Reply

    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 ?

  2. windyfly at | | Reply

    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

  3. Phil at | | Reply

    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.

  4. Diego at | | Reply

    Mate you are legend!!! Thank you for sharing you collected knowledge in this post.

  5. b789 at | | Reply

    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 ?

  6. Alex at | | Reply

    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?

    1. Alex at | | Reply

      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.

  7. Emil Borconi-Szedressy at | | Reply

    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.

  8. Harvey King at | | Reply

    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

  9. Harvey King at | | Reply

    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.

  10. Irvaan Sid at | | Reply

    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..

  11. Irvaan Sid at | | Reply

    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??

  12. HFP on Raspberry Pi at |

    […] 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 […]

  13. Said at | | Reply

    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

    1. Frank at | | Reply

      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

  14. Balurdo at | | Reply

    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

  15. David at | | Reply

    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?

  16. Odianosen Ejale at | | Reply

    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

  17. Odianosen Ejale at | | Reply

    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

  18. Odianosen Ejale at | | Reply

    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

Please comment with your real name using good manners.

Leave a Reply