Skip to content

Instantly share code, notes, and snippets.

@autr
Last active June 30, 2021 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autr/921c1d1b8e5f4ee15e39123b3f774052 to your computer and use it in GitHub Desktop.
Save autr/921c1d1b8e5f4ee15e39123b3f774052 to your computer and use it in GitHub Desktop.
PCM5102A Audio on Raspberry Pi (Zero)

Circuits

Any PCM5102A board connected up to pins:

VIN = 3.3V (NOT 5V)
GND = GND
LCK = GPIO19/35 (PCM FS)
DIN = GPIO21/40 (PCM DOUT)
BCK = GPIO18/12 (PCM CLK)
SCK = GND

NB: 3.5mm on these boards will snap off so epoxy it down or route to another jack

Config

# edit /boot/config.txt, and add:
dtoverlay=hifiberry-dac
# and remove:
dtparam=audio=on

Permissions

# I M P O R T A N T
su root && aplay -l

# only root will see device, until:
sudo usermod -aG audio [user]

Optional

sudo nano /etc/modprobe.d/alsa-blacklist.conf
# add:
blacklist snd_bcm2835

sudo nano /etc/asound.conf
# add:
pcm.!default {
	type hw card 0
}
ctl.!default {
	type hw card 0
}

Working

aplay -l
# -> should list sound output

speaker-test -D default -c 2 -twav
# -> left right voice

omxplayer -o alsa path/to/you/video.mov
# -> play video with sound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment