Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth connection drops intermittently #173

Open
georgar70 opened this issue Jul 1, 2024 · 1 comment
Open

Bluetooth connection drops intermittently #173

georgar70 opened this issue Jul 1, 2024 · 1 comment

Comments

@georgar70
Copy link

georgar70 commented Jul 1, 2024

I have installed Bluetooth software on two PIs, and it works. Unfortunately, the Bluetooth connection drops at irregular intervals (15 - 25 minutes). The distance between the sender and receiver does not change and is not very large. If I deactivate and reactivate Bluetooth on my sender (mobile phone), the connection is reestablished. Do you have any suggestions on what could be causing this? Where can I look?

@georgar70
Copy link
Author

georgar70 commented Jul 1, 2024

Could it be that power management sometimes turns off the Bluetooth connection? Could the following suggestion (ChatGPT) be a solution:

Step-by-Step Guide to Disable Power Management

  1. Create or Modify the btusb.conf File

    • Create or edit the file /etc/modprobe.d/btusb.conf to disable power management for the Bluetooth adapter.
    sudo nano /etc/modprobe.d/btusb.conf
  2. Add the Following Line

    • Add the following line to the btusb.conf file:
    options btusb enable_autosuspend=0
    
  3. Save and Close the File

    • Save the changes and exit the editor. In nano, you can do this by pressing Ctrl+X, then Y, and then Enter.
  4. Reboot the Raspberry Pi

    • Reboot your Raspberry Pi for the changes to take effect.
    sudo reboot

Verifying the Changes

After the system reboots, you can verify that the power management settings have been applied correctly:

  1. Check Bluetooth Power Management Status

    • You can check the current power management status by inspecting the Bluetooth adapter details. Use the following command:
    sudo cat /sys/module/btusb/parameters/enable_autosuspend
    • It should return N if the autosuspend is disabled.

Additional Power Management Settings

If you are using Wi-Fi along with Bluetooth and suspect power management issues, you might also want to check the power management settings for the Wi-Fi adapter:

  1. Disable Wi-Fi Power Management

    • Open the configuration file for the wireless interface (typically wlan0).
    sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
  2. Set Wi-Fi Power Management to Off

    • Ensure the file contains the following setting:
    [connection]
    wifi.powersave = 2
    
  3. Save and Close the File

    • Save the changes and exit the editor.
  4. Restart Network Manager

    • Restart the Network Manager to apply the changes.
    sudo systemctl restart NetworkManager

By following these steps, you should be able to manage and disable power management for the Bluetooth adapter on your Raspberry Pi, which may help resolve the intermittent connection drops.


Does this help or is it not applicable because I am using a USB Bluetooth adapter?

USB Bluetooth Adapter Considerations

The solution can still be helpful if you are using a USB Bluetooth adapter, as the described settings can also be applied to USB Bluetooth adapters. Here are the steps, slightly adjusted for USB Bluetooth adapters:

Step-by-Step Guide to Disable Power Management for USB Bluetooth Adapter

  1. Create or Modify the btusb.conf File

    • Create or edit the file /etc/modprobe.d/btusb.conf to disable power management for the Bluetooth adapter.
    sudo nano /etc/modprobe.d/btusb.conf
  2. Add the Following Line

    • Add the following line to the btusb.conf file:
    options btusb enable_autosuspend=0
    
  3. Save and Close the File

    • Save the changes and exit the editor. In nano, you can do this by pressing Ctrl+X, then Y, and then Enter.
  4. Reboot the Raspberry Pi

    • Reboot your Raspberry Pi for the changes to take effect.
    sudo reboot

Verifying the Changes

After the system reboots, you can verify that the power management settings have been applied correctly:

  1. Check Bluetooth Power Management Status

    • You can check the current power management status by inspecting the Bluetooth adapter details. Use the following command:
    sudo cat /sys/module/btusb/parameters/enable_autosuspend
    • It should return N if the autosuspend is disabled.

Additional Power Management Settings

If you are using Wi-Fi along with Bluetooth and suspect power management issues, you might also want to check the power management settings for the Wi-Fi adapter:

  1. Disable Wi-Fi Power Management

    • Open the configuration file for the wireless interface (typically wlan0).
    sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
  2. Set Wi-Fi Power Management to Off

    • Ensure the file contains the following setting:
    [connection]
    wifi.powersave = 2
    
  3. Save and Close the File

    • Save the changes and exit the editor.
  4. Restart Network Manager

    • Restart the Network Manager to apply the changes.
    sudo systemctl restart NetworkManager

By following these steps, you should be able to manage and disable power management for the Bluetooth adapter on your Raspberry Pi, which may help resolve the intermittent connection drops, even if you are using a USB Bluetooth adapter.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant