Published

Raspberry Pi Zero AirPlay Speaker

A combination of modern and classic touches in this Pi Zero AirPlay speaker.

IntermediateFull instructions provided49,946
Raspberry Pi Zero AirPlay Speaker

Things used in this project

Hardware components

Raspberry Pi Zero
Raspberry Pi Zero
×1
Adafruit Mono 2.5W Class D Amplifier
×1
Speaker: 3W, 4 ohms
Speaker: 3W, 4 ohms
×1
Wifi USB dongle
×1
USB OTG cable
×1
pHAT DAC
Pimoroni pHAT DAC
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

pHAT DAC

Code

Code snippet #1

Plain text
sudo diskutil list
sudo diskutil unmountDisk /dev/disk3
sudo dd if=Downloads/2015-11-21-raspbian-jessie.img of=/dev/disk3 bs=1m
sudo diskutil unmountDisk /dev/disk3

Code snippet #2

Plain text
sudo apt-get update
sudo apt-get upgrade

Code snippet #3

Plain text
pi@raspberrypi:~ $ sudo nano /boot/config.txt

# pHAT DAC
dtoverlay=hifiberry-dac

Code snippet #4

Plain text
pi@raspberrypi:~ $ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

Code snippet #5

Plain text
pi@raspberrypi:~ $ sudo nano /etc/asound.conf

pcm.!default {
  type hw
  card 1
}

ctl.!default {
  type hw
  card 1
}

Code snippet #6

Plain text
pi@raspberrypi:~ $ sudo apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl

Code snippet #7

Plain text
pi@raspberrypi:~ $ git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp
pi@raspberrypi:~ $ cd perl-net-sdp/
pi@raspberrypi:~/perl-net-sdp $ perl Build.PL
pi@raspberrypi:~/perl-net-sdp $ sudo ./Build
pi@raspberrypi:~/perl-net-sdp $ sudo ./Build test
pi@raspberrypi:~/perl-net-sdp $ sudo ./Build install

Code snippet #8

Plain text
pi@raspberrypi:~ $ git clone https://github.com/hendrikw82/shairport.git
pi@raspberrypi:~ $ cd shairport/
pi@raspberrypi:~/shairport $ make

Code snippet #9

Plain text
pi@raspberrypi:~/shairport $ ./shairport.pl -a AirPi

Code snippet #10

Plain text
pi@raspberrypi:~/shairport $ sudo make install
pi@raspberrypi:~/shairport $ sudo cp shairport.init.sample /etc/init.d/shairport
pi@raspberrypi:~/shairport $ sudo chmod +x /etc/init.d/shairport
pi@raspberrypi:~/shairport $ sudo update-rc.d shairport defaults

Code snippet #11

Plain text
pi@raspberrypi:~/shairport $ sudo nano /etc/init.d/shairport

#DAEMON_ARGS="-w $PIDFILE"
DAEMON_ARGS="-w $PIDFILE -a AirPi"

Credits

Comments