Broadcast Assistants
From: the Bluetooth SIG page on Auracast:
Auracastâ„¢ assistants scan for Auracastâ„¢ advertisements and provide a user interface (UI) to enable users to select an Auracastâ„¢ broadcast to join, similar to the UI commonly used to connect to Wi-Fi networks in public spaces.
In the most normal setup, available in the market today, a user would need:
- A pair of Auracast enabled earbuds (broadcast sinks)
- A phone with Auracast assistant functionality
- Being near one or more Auracast transmitters (broadcast sources)
As the number of phones including assistants is very limited at the moment - and those assistants having very limited functionality - it could be interesting to try to build one of our own to explore this new and interesting technology.
NOTE: For more details on this and LE Audio Broadcast and Unicast in general, Nick Hunn wrote an excellent book on LE Audio: Introducing Bluetooth LE Audio, 2nd Edition
Limitations in Android
Since Android 13, 3rd party applications have been prohibited from accessing LE Audio related Bluetooth GATT Services.
Looking at the list of these services, we see that the Broadcast Audio Scan Service (BASS) is included as one of the restricted services.
This means that if we want to create an application that acts as a broadcast assistant on a modern Android phone, we need to look for another solution.
Web and Zephyr for the Win!
Luckily, WebUSB, that works on both mobile and desktop browsers, can be used to communicate with external hardware doing all the Bluetooth LE communication (unrestricted), while a nice and functioning UI can then be made as a pure web application.
WebUSB is part of Project Fugu (Web Capabilities), consisting of a range of Web APIs, narrowing the gap between native apps and web. To learn more, check out this great showcase of what it can be used for: https://developer.chrome.com/docs/capabilities/fugu-showcase
As mentioned in an earlier post on building a broadcast audio source, the Zephyr RTOS contains some awesome Bluetooth LE Audio related samples. It also contains a Bluetooth LE Audio stack with great API support available to build a functioning broadcast assistant.
Again, using the Nordic Semiconductor nRF52840 Dongle for the Zephyr firmware part of the application, allows the user to get broadcast assistant functionality on any Android phone with a fairly recent browser and a small dongle attached via USB.
Modern Web
We decided to build the web application, using pure vanilla web technology (no frameworks) as things like Web Components, which is supported in all major browsers, make it very easy to build UI elements.
Also, being able to make custom classes, extending EventTarget, eliminates the need for any special framework based event system.
We also decided not to "build" (or minify) the code, as we would then be able to run the application directly from the source "as is", either using a local web server, or when hosted from github.
Some of the web technologies used:
- Web Components for UI elements
- WebUSB to connect to hardware
- Web Share API to share details of detected sources
- Barcode Detection API to read Broadcast Audio URIs
Using the Web Broadcast Assistant
When the web application is loaded, it prompts the user to connect to a USB device, running the assistant firmware, made with the Zephyr RTOS:
Click connect and select the device:
And after granting permission to connect, the app should look something like this:
Let's play some music!
Here, we will use the broadcast source described in detail in this previous post, where audio data is stored in flash on an nRF52840 Dongle, playing forever in a loop.
As a broadcast audio receiver, a pair of Samsung Galaxy Buds2 Pro are used.
First, scan for Auracast sources:
Then for receiver devices:
Connect the earbuds:
And press play to listen to the broadcast source in the connected earbuds:
Multiple subgroup support
The broadcast source used above is a simple, single-subgroup source, but as described in this previous post, the Zephyr RTOS stack supports multiple subgroups for both sources (transmitters), sinks (receivers) and assistants (check the BAP broadcast samples here).
Let's try to scan for sources, using the multi language source described here.
When the web assistant discovers a broadcast source with multiple subgroups, an extra selection layer becomes available:
Now, if you would like to hear the Spanish stream, just select it and press play:
Unfortunately, the earbuds used to listen to the single-subgroup source above, don't seem to support multiple subgroups yet (the sound doesn't seem to play at least - maybe with a future firmware update?).
However, if you want to try out a working setup, the BAP Broadcast Sink sample does actually support multiple subgroups. But that's a topic for another post.
Conclusion
Combining the Zephyr RTOS stack, running on an affordable nRF52840 Dongle with the power of modern web technologies turned out quite well and it has also allowed us to experiment with multiple subgroups, supported by the specs, but not yet by many devices in the market (at the time of writing at least - be sure to keep an eye out for that!).
Top comments (0)