Tuesday, August 5, 2025

0

Bluetooth LE Audio on Raspberry Pi with BlueZ

 Summary

In this post I share my experience testing LE Audio (next generation Bluetooth audio broadcasting) on Raspberry Pi 5 with an external Bluetooth module and utilizing recent developments in BlueZ (Linux Bluetooth stack) and PipeWire (Linux multimedia framework) which brings the support for LE Audio

Raspberry Pi  - LE Audio Experimental Setup 

  •  Hardware

For this experiment I aimed for the Raspberry Pi due to its low cost. In addition I can run Linux with BlueZ on it for free and do not have to buy any software. I had already a Raspberry Pi 5 lying around which has an on-board RF module supporting both Bluetooth Low Energy and Bluetooth Classic. However, it only supports Bluetooth 5.0 and hence LE Audio was not available.

Then the search process started for a RF module which supports LE Audio and could run on the Pi. I came accross an interesting post on PipeWire wiki page providing info on LE Audio support. There the Intel AX210 was mentioned as an example Bluetooth adapter supporting LE Audio.

By doing more research on the Intel AX210, I found out that someone on YouTube already tested the Wifi functionality of the same module on the Raspberry Pi and it worked with the latest Linux kernel.

This motivated me to purchase the Intel AX210 module (costed me around 35 Euros) integrate it into my Raspberry Pi 5 and try to get the Bluetooth functionality to work. 

In order to connect the new RF module, I had to get a special PCIe M.2 adapter which supplies the RF module with power from the Pi along with PCIe and USB connections so Wifi and Bluetooth would work.

  • Software 

After assembling the required hardware components it was time to start the Pi and install required drivers and software to test the Bluetooth functionality with the new RF module. First I flashed the latest Raspbian OS version on the SD card of the Pi and enabled SSH for remote access.

After logging in to the Pi via SSH. I made sure that I am on the latest stable kernel by upgrading to the latest software. so simply running in bash terminal:

  • sudo apt update
  • sudo apt upgrade

Following the update process, I checked whether the new Bluetooth module is recognized on the USB interface by running: lsusb command and I found it listed which indicate that my hardware setup is correctly connected.

 The next step then was to make sure the Bluetooth driver (firmware) is available for the module to run. This was a bit tricky as the Intel firmware files were not available on the Raspbian OS distribution and had to download them manually from the Linux kernel repository and copy them to the required location on the Pi. In short I had to perform the following steps:

  • Download the Intel firmware files named: ibt-0041-0041.sfi , ibt-0041-0041.ddc

  • Create a directory named "intel" inside the /lib/firmware folder on the Pi

  • Copy the above downloaded files to the respective directory: 

    • sudo cp ibt-0041-0041.sfi /lib/firmware/intel

    • sudo cp ibt-0041-0041.ddc /lib/firmware/intel

  • Restart the Pi: sudo reboot now

After reboot, the Intel AX210 Bluetooth adapter is up and running!.

We can confirm that using the following command and reading the adapter status: hciconfig -a

Now that the Intel AX210 Bluetooth adapter is running with the Pi, we still need to install the latest version of BlueZ , PipeWire , WirePlumber  and configure them to test the LE Audio functionality. 

To do that, I simply built and installed those libraries from source (latest stable releases). You can find the build instructions on the respective libraries github repositories. At the time of making this post. I used the following versions: BlueZ 5.83, Pipewire 1.4.6 and WirePlumber 0.5.10.

  • Configuration & Testing

Following the assembly of hardware and installation of required software components, I needed to do some configurations for BlueZ and Wireplumber so LE Audio streaming would work.

For BlueZ, the following options need to be set in the "/etc/bluetooth/main.conf" file:

  • ControllerMode = le # use low energy mode

  • Experimental = true # enable experimental features

  • KernelExperimental = 6fbaf188-05e0-496a-9885-d6ddfdb4e03e # enable ISO sockets

For WirePlumber, I created a configuration file: "~/.config/wireplumber/wireplumber.conf.d/80-bluez-properties.conf" according to the wiki documentation to set the Bluetooth audio profiles. For LE Audio streaming: bap_sink needs to be available.

After performing the above configurations, I restarted the Pi and began testing !. 

For testing my goal was to stream audio from the Pi to a headset device supporting LE Audio. 

To do so I had to pair and connect my headset to the Pi via bluetoothctl (BlueZ interactive command lines tool)

From the above logs, you could see that the device is successfully paired and connected. In addtion, the controller (i.e: Intel AX210 Bluetooth adapter) discovers the UUID service: Published Audio Capabilities (00001850-0000-1000-8000-00805f9b34fb) which means LE Audio is supported and recognized by BlueZ!

After connection is successful with the headset, I see the following endpoints are registered which indicate that BlueZ recognizes the headset as an audio source and sink simulatenously. I can also see the same thing when checking available audio devices in the system.

To test audio streaming to the headset, I simply played a wav file to the target node of the headset and observed the status info in BlueZ:

pw-play -v --target "bluez_output.DE_AD_BE_EE_EE_EF.1" path/to/wav/file.wav

 Great now my Raspberry Pi is successfully streaming LE Audio. Goal accomplished !

References

https://www.bluetooth.com/learn-about-bluetooth/feature-enhancements/le-audio/

https://www.analog.com/en/resources/design-notes/the-basics-of-bluetooth-le-audio.html 

https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/LE-Audio-+-LC3-support

https://www.intel.com/content/www/us/en/products/docs/wireless/wi-fi-6e-ax210-module-brief.html 

Saturday, August 2, 2025

0

pytest-analog a python plugin for electronics experiments and test automation

Introduction

pytest-analog is a python library / pytest plugin for simple experimentation with electronics and embedded systems.

It is also a great tool for low cost test automation of low power IOT devices.

The library provides an easy to use wrapping layer to perform mulitple measurement and testing workflows utilizing two multifunctional instruments:

Supported Workflows: 

  • Power measurements:

    • The ADALM1K two SMU channels (A, B), can power up your project and measure its power consumption simulatenously. the ADALM1K channels cuurent operation ranges from -200 to +200 mA. The voltage range operation is from 0 to 5 V 

    • The Analog Discovery Supplies channels (V+, V-) you can supply both positive and negative voltages with the range of (0.5 V to 5 V , -0.5 V to -5 V) . In the Analog Discovery 3, each supply raile can supply up to 800 mA

    •  Due to ADALM1K (2-quadrant) operation, its two SMU channels (A, B) could be used to source and sink currents ± 200 mA. This could particulaly be useful for testing batteries charge and discharge profiles and DC characterstics of a circuit

  • Analog Inputs / Outputs:

    • When configured in high impedance modes, ADALM1K analog channels (A, B) could be used to probe analog signals 

    • The Analog Discovery Supplies channels (V+, V-) you can supply both positive and negative voltages with the range of (0.5 V to 5 V , -0.5 V to -5 V) . In the Analog Discovery 3, each supply raile can supply up to 800 mA

    •  Due to ADALM1K (2-quadrant) operation, its two SMU channels (A, B) could be used to source and sink currents ± 200 mA. This could particularly be useful for testing batteries charge and discharge profiles and DC characteristics of a circuit

Example Setup with Raspberry Pi 5: 

To demonstrate a practical application of the pytest-analog plugin, I built a small test setup with the Raspberry Pi 5 acting as a low cost computer. 

Below is the list of used hardware and software components for reproducibility:

  • Hardware

  1. Raspberry Pi 5 Model as the test station mini PC 
  2. ADALM M1K Board as a mini power supply / source measure unit (SMU) 
  3. Analog Discovery 3 as a USB Oscilloscope, Waveform Generator, Logic Analyzer, and Variable Power Supply
  • Software 

    1.Raspbian OS: 12 (bookworm) 64 bit lightweight Linux distribution for ARM architecture

    2. Python: 3.11.2 Python interpreter which is shipped as part of Raspbian OS
    3. libsmu: 1.0.4 library and python bindings for ADALM1K SMU
    4. WaveForms: 3.23.4 GUI application for measurements with Analog Discovery devices
    5. Adept: 2.27.9  Runtime library for communication with Analog Discovery devices
    6. pytest-analog: 0.2.0  python library / pytest plugin for test automation with the above hardwae