Skip to main content
edited title
Link

Issues when Using a Pi Zero 2W as a Bluetooth Headset

Source Link

Issues when Using a Pi Zero 2W as a Headset

I'd like to use my Raspberry Pi Zero 2W as a Bluetooth headset to connect with my Android phone with an HSP profile. The speaker and microphone are connected via an external USB soundcard.

After following a few guides, nothing seems to be working for me. I have tried the process below with various versions of Pulseaudio and Ofono with no luck either. I'm running Raspberry Pi OS Bullseye.

Any advice would be greatly appreciated!

Followed Steps (reproducible error):

  1. Initial Setup of the Pi

    • Sudo raspi-config
    • Set localization settings
    • Enable and Setup Wifi
    • Enable SSH
  2. Make Speaker Default? : /lib/modprobe.d/aliases.conf and comment out the line options snd-usb-audio index=-2

    • sudo nano /lib/modprobe.d/aliases.conf
  3. Test Speaker:

    • aplay /usr/share/sounds/alsa/Front_Center.wav
  4. Install Ofono

    • sudo apt-get install pi-bluetooth ofono
  5. Change Ofono dbus policy:

    • sudo nano /etc/dbus-1/system.d/ofono.conf
    • change deny send_destination="org.ofono" to allow send_destination="org.ofono
  6. Install Git:

    • sudo apt-get install git
  7. Fetch Pulseaudio:

    • git clone git://anongit.freedesktop.org/pulseaudio/pulseaudio
  8. change src/modules/bluetooth/backend-native.c and src/modules/bluetooth/backend-ofono.c:

    • sudo nano on each
    • modified *imtu = xx; to *imtu = 60;
      • Done to ensure the HSP SCO is the same as android
  9. Install Pulseaudio Dependencies:

    • sudo apt-get build-dep pulseaudio
  10. Compile Pulseaudio:

    • meson build
    • ninja -C build
    • sudo ninja -C build install
    • sudo ldconfig
  11. Force HSP in Pulseaudio:

    • sudo nano /etc/pulse/default.pa
      • Add headset=ofono
      • .ifexists module-bluetooth-discover.so
        
         load-module module-bluetooth-discover headset=ofono
        
         .endif
        
  12. Connect Bluetooth:

    • bluetoothctl
    • power on
    • scan on
    • pair XX:XX:XX:XX:XX:XX
    • trust XX:XX:XX:XX:XX:XX
    • connect XX:XX:XX:XX:XX:XX
  13. Testing:

    • Called a number on the connected Android phone
    • The Raspberry Pi device's bluetooth status became 'active' on the phone
    • Bluetooth appeared as an option inside the call
    • When the Bluetooth menu option is selected, the app immediately reverts back to the phone's speaker

Note: This question from a few years ago had a different issue but the same goal: Pi as Bluetooth headset