Thank you for your donation!


Idea: Automatically disable WiFi when using Bluetooth
#1
Hey together,

when using the builtin bluetooth module on the Pi Zero 2 to stream audio to it, you have a problem of interference with WiFi (as mentioned in this post). A possible solution to this is disabling WiFi while using bluetooth streaming.

It would be nice, if the changes I manually did in this post could be included in the configuration page of the bluetooth renderer.

I thought about adding an optional parameter to the a2dp-autoconnect script, which includes the interface name to disable. This name can be set in the bluetooth renderer config section and might default to "wifi0".

If this problem is exclusive to the Pi Zero 2, maybe only show this option when using this device.

What do you think about that?
Reply
#2
If in fact there were a hardware issue of this nature that generally affected the Zero 2 W I would think there would be a lot of posts talking about it in the Raspberry Pi Forums but I can't find any.

The problem with turning off WiFi when incoming BT connects is that it leaves the user without access to UI or SSH. If something goes wrong then the only way out is power cycle. Its a no-go for me.
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply
#3
It's actually a quite well known problem that also affects the Pi3, Pi4 and Zero W:
- https://github.com/raspberrypi/linux/issues/1402
- https://github.com/Arkq/bluez-alsa/issues/205
- https://github.com/nicokaiser/rpi-audio-.../issues/38

But I totally understand your point with the access.
Maybe there is another way to solving this behavior.

Edit: I mixed something up - the Pi3 had hardware issues that are not the reason for the choppy audio on the Pi4 and zero w 2
Reply
#4
A quick 30 minute listening test with my Zero W and no audio glitches whatsoever.

- Integrated WiFi and BT
- IQaudIO DACZero
- Stock moOde 7.6.1
- iPhone SE (2017)
- Amazon Music HD

This indicates to me that there is no intrinsic hardware or RF issue on Zero W due to simultaneous BT and WiFi operation. I've had same results on the other Pi platforms with Bluetooth and WiFi -- no audio glitches.
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply
#5
how about disabling the integrated wifi and using a wifi dongle?
Reply
#6
So I fired up a test platform.

Pi Zero 2 W
moOde 7.6.1
onboard WiFi connected in client mode
audio out: white box USB-headphone adapter -> earbuds
BT source: Qubuz app on Pixel 3a phone (Android 12)

I'm getting a  roughly 1-second audio dropout roughly every 3 seconds (but the periodicity seems to vary).

If I disable WiFi until next boot (sudo ifconfig wlan0 down)  then the dropouts cease.

Finding the WiFi signal strength and link quality is trivial but it's harder to find analogous BT measures to help diagnose, at least using the BT tools I'm aware of. I haven't found any telltale traces in syslog.

I get similar behavior if I run moOde in AP mode (the periodicity seems longer but I'm not measuring carefully).

I'm wondering if our differing experiences might be down to the WiFi channel being used. (Confession: naively, I thought adaptive frequency hopping would take care of this.)

My new, ISP-provided router/access point insists on using channel 1 (2.412 GHz) which falls in the lower part of the BT band (2.4GHz - 2.483GHz) and I haven't figured out yet how to force it up to, say, channel 11. [In the interest of domestic tranquility I'm waiting to experiment until my partner is reading a book IRL].

All my moOde players capable of 5GHz WiFi are connecting at to the AP at 5GHz and have been immune to this effect.

External USB dongles change the equation, of course, but make the Zero with its single microUSB port a poor choice.

Regards,
Kent
Reply
#7
The 3A+ is so much better than any of the Zero's.
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply
#8
(01-15-2022, 05:06 PM)Tim Curtis Wrote: The 3A+ is so much better than any of the Zero's.

+1
Reply
#9
(01-15-2022, 04:51 PM)TheOldPresbyope Wrote: So I fired up a test platform.

Pi Zero 2 W
moOde 7.6.1
onboard WiFi connected in client mode
audio out: white box USB-headphone adapter -> earbuds
BT source: Qubuz app on Pixel 3a phone (Android 12)

I'm getting a  roughly 1-second audio dropout roughly every 3 seconds (but the periodicity seems to vary).

If I disable WiFi until next boot (sudo ifconfig wlan0 down)  then the dropouts cease.

Finding the WiFi signal strength and link quality is trivial but it's harder to find analogous BT measures to help diagnose, at least using the BT tools I'm aware of. I haven't found any telltale traces in syslog.

I get similar behavior if I run moOde in AP mode (the periodicity seems longer but I'm not measuring carefully).

I'm wondering if our differing experiences might be down to the WiFi channel being used. (Confession: naively, I thought adaptive frequency hopping would take care of this.)

My new, ISP-provided router/access point insists on using channel 1 (2.412 GHz) which falls in the lower part of the BT band (2.4GHz - 2.483GHz) and I haven't figured out yet how to force it up to, say, channel 11. [In the interest of domestic tranquility I'm waiting to experiment until my partner is reading a book IRL].

All my moOde players capable of 5GHz WiFi are connecting at to the AP at 5GHz and have been immune to this effect.

External USB dongles change the equation, of course, but make the Zero with its single microUSB port a poor choice.

Regards,
Kent

if this issue is gone with a wlan dongle it doesnt seem to be frequency problem, also (from what i know) bt does a good job at avoiding "populated channels/frequencys" (they get basicly blacklisted and wont be used for bt)
it sounds like a problem with the bt/wlan chip itself then OR 
because of the very close proximity of the wlan antenna OR
maybe bt gets problematic if you live in an very wlan populated area? (maybe the internal bt antenna isnt strong enough to compete, does wlan/bt share the same antenna? (i think so))

probably a external bt donge will solve the issue too (and i think, in the end, using a external bt or wlan dongle is a way better fix than disabling wlan if bt is used, but maybe tim wants to support the pi`s "as is" Smile )
Reply
#10
Better to just get a 3A+ with it's 5GHz WiFi capability.
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply


Forum Jump: