Skip to content

Latest commit

 

History

History
246 lines (204 loc) · 4.36 KB

File metadata and controls

246 lines (204 loc) · 4.36 KB

Quick Start Commands

Copy these commands to your Raspberry Pi. Run them in order.

Option 1: Automated Installation

# 1. Copy project files to your Pi (from your computer)
scp -r /path/to/AirplayPortable pi@<your-pi-ip>:~/airplay

# 2. SSH into your Pi
ssh pi@<your-pi-ip>

# 3. Run installer
cd ~/airplay
chmod +x install.sh
sudo ./install.sh

# 4. Reboot
sudo reboot

Option 2: Manual Step-by-Step

Step 1: Update System

sudo apt update && sudo apt upgrade -y

Step 2: Enable I2C and SPI

sudo raspi-config nonint do_i2c 0
sudo raspi-config nonint do_spi 0

Step 3: Install Dependencies

sudo apt install -y build-essential git autoconf automake libtool \
    libpopt-dev libconfig-dev libasound2-dev libavahi-client-dev \
    libssl-dev libsoxr-dev libplist-dev libsodium-dev libavutil-dev \
    libavcodec-dev libavformat-dev libgcrypt20-dev libxxhash-dev \
    uuid-dev xmltoman xxd python3-pip python3-venv python3-dev \
    python3-smbus python3-pil i2c-tools hostapd dnsmasq avahi-daemon

Step 4: Configure I2S DAC

Edit boot config:

sudo nano /boot/firmware/config.txt

Add at the end:

# I2S DAC
dtparam=i2s=on
dtoverlay=hifiberry-dac

Comment out onboard audio:

#dtparam=audio=on

Step 5: Install NQPTP

cd ~
git clone https://github.com/mikebrady/nqptp.git
cd nqptp
autoreconf -fi
./configure --with-systemd-startup
make -j$(nproc)
sudo make install
sudo systemctl enable nqptp
sudo systemctl start nqptp

Step 6: Install Shairport Sync

cd ~
git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi \
    --with-ssl=openssl --with-systemd --with-airplay-2
make -j$(nproc)
sudo make install
sudo systemctl enable shairport-sync

Step 7: Configure Shairport Sync

sudo nano /etc/shairport-sync.conf

Paste this configuration:

general = {
    name = "Portable AirPlay";
    interpolation = "soxr";
    output_backend = "alsa";
    mdns_backend = "avahi";
    volume_range_db = 60;
};

alsa = {
    output_device = "hw:0";
    mixer_control_name = "Digital";
    mixer_device = "hw:0";
};

Step 8: Create ALSA Config

sudo tee /etc/asound.conf << 'EOF'
pcm.!default {
    type hw
    card 0
}
ctl.!default {
    type hw
    card 0
}
EOF

Step 9: Setup Python Environment

cd ~/airplay
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install RPi.GPIO adafruit-circuitpython-ssd1306 adafruit-blinka \
    Pillow rpi_ws281x adafruit-circuitpython-neopixel flask alsaaudio

Step 10: Install Services

sudo cp ~/airplay/services/airplay-ui.service /etc/systemd/system/
sudo cp ~/airplay/services/wifi-portal.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable airplay-ui

Step 11: Reboot

sudo reboot

Testing Commands

Test Audio

# Check DAC is detected
aplay -l

# Test audio output
speaker-test -t sine -f 440 -c 2 -D hw:0

Test OLED Display

# Check I2C device
sudo i2cdetect -y 1
# Should show 0x3C

# Test display
cd ~/airplay
source venv/bin/activate
python3 -c "
import board
import adafruit_ssd1306
from PIL import Image, ImageDraw
i2c = board.I2C()
oled = adafruit_ssd1306.SSD1306_I2C(128, 64, i2c)
oled.fill(0)
image = Image.new('1', (128, 64))
draw = ImageDraw.Draw(image)
draw.text((10, 25), 'Hello AirPlay!', fill=255)
oled.image(image)
oled.show()
print('Display working!')
"

Test LED

sudo python3 -c "
import board
import neopixel
pixels = neopixel.NeoPixel(board.D10, 1, brightness=0.2)
pixels[0] = (0, 255, 0)
print('LED should be green')
input('Press Enter to turn off...')
pixels[0] = (0, 0, 0)
"

Check Services

# Check Shairport Sync
sudo systemctl status shairport-sync

# Check UI service
sudo systemctl status airplay-ui

# View logs
journalctl -u airplay-ui -f

Troubleshooting

No Sound

# Check if DAC overlay loaded
dmesg | grep -i hifiberry

# Check ALSA
amixer -c 0

OLED Blank

# Check I2C enabled
ls /dev/i2c*

# Check wiring and address
sudo i2cdetect -y 1

Service Won't Start

# Check Python environment
~/airplay/venv/bin/python3 --version

# Run manually for errors
cd ~/airplay
source venv/bin/activate
python3 src/main.py