Mason Fleck
Published © GPL3+

RPi Zero 2 W Audio Gadget

The basics of turning a Raspberry Pi Zero 2 W into a USB OTG audio interface using the Linux gadget g_audio driver.

IntermediateProtip4 hours11,455
RPi Zero 2 W Audio Gadget

Things used in this project

Hardware components

Raspberry Pi Zero 2 W
Any Pi (or really any Linux-compatible ARM board) with USB OTG capability should work.
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Data cable for streaming audio.
Micro SD Card
5V Power Supply (Micro USB)

Software apps and online services

Raspberry Pi OS Lite
Raspberry Pi Imager


Read more


Wiring Schematic


Enable USB OTG, g_audio, Kernel Build on RPi Zero 2 W

A (mostly) copy/paste-able version of the guide. Note: this leaves out a few configuration and verification steps that technically aren't required, but they are recommended.
sudo apt update && sudo apt upgrade -y
echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
echo "dwc2" | sudo tee -a /etc/modules
echo "g_audio" | sudo tee -a /etc/modules
sudo apt install screen git bc bison flex libssl-dev make libncurses5-dev -y
git clone --depth=1 --branch rpi-5.18.y
cd linux
make bcm2709_defconfig
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
sudo reboot


Mason Fleck

Mason Fleck

4 projects • 6 followers
I enjoy building electronics such as computers, audio amps/systems, and some random projects. I am currently majoring in CE & EE at Mizzou.