External Non USB Audio DAC ES9023, PCM5102, etc. - MiczFlor/RPi-Jukebox-RFID GitHub Wiki
Introduction
USB-based DAC offer plug and play convenience, but suffer in the low cost range often from low EMI resistance (e.g. you may hear noise from WLAN or CPU load changes etc. Additionally there is only a single USB port on a Pi Zero (W) and PI A types, which might not ne available for this purpose. The Raspberry Pi offers a digital interface called I2S to output audio data in a common format accepted by may audio DACs like ES9023, PCM5102, PCM1794 etc.. I have chosen the ES9023 mainly because I did find a nicely designed pcb on ebay. In a recent setup I switched to the PCM5102. Popular plug and play solutions like those from justboom, Hifiberry, etc use the same connection.
Hardware Connections
Please follow the hardware with fixed pin assignment
If your board has a crystal oscillator or other internal clock source, do not connect the MCLK signal to the pi anywhere. It is best to even remove the wire and do not leave it open, because it carries a high frequency signal that might cause trouble elsewhere.
Software setup
/boot/config.txt
add the following line
dtoverlay=hifiberry-dac
/etc/mpd.conf
part of the mpd configuration (relevant snip only)
audio_output {
type "alsa"
name "My ALSA Device"
mixer_control "Master"
}
/etc/asound.conf
complete file
pcm.hifiberrydac {
type softvol
slave.pcm "plughw:0"
control.name "Master"
control.card 0
}
pcm.!default {
type plug
slave.pcm "hifiberrydac"
}