Control an LCD display and amplifier relay for use in an AirPlay Raspberry Pi server.
Project description
qbee-gpio
A python script to control an LCD and amplifier relay for use in an AirPlay and/or Spotify Connect Raspberry Pi server.
- Detect sound ouput and turn on the amplifier power supply.
- Get the track information and display it on an LCD.
- Auto turn off amplifier power supply and/or shutdown after set period of inactivity.
Installation
python -m pip install qbee-gpio
For first time usage:
~/.local/bin/qbee --init-config
then change what you need in ~/.qbee.yaml
.
Usage
~/.local/bin/qbee
Pass a -v
flag for verbose logging.
Detailed setup
Setting up Hifiberry DAC
Edit /boot/config.txt
to add:
dtparam=audio=on
dtoverlay=hifiberry-dac
To disable the built-in sound card, edit /etc/modprobe.d/raspi-blacklist.conf
to add:
blacklist snd_bcm2835
Edit /etc/asound.conf
to set the default sound card for alsa, add:
defaults.pcm.card 0
defaults.ctl.card 0
Setting up shairport-sync
You can follow instructions here. Here is what I used.
Install required packages:
sudo apt install --no-install-recommends build-essential git autoconf automake libtool \
libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev
Install shairport-sync:
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-metadata
make
make install
cd ../ && rm -rf shairport-sync
Edit /etc/shairport-sync.conf
file, uncomment the metadata block to enable:
metadata =
{
enabled = "yes";
include_cover_art = "no";
pipe_name = "/tmp/shairport-sync-metadata";
pipe_timeout = 5000;
};
Enable to run on boot: sudo systemctl enable shairport-sync
.
Setting up Librespot
For starting up automatically, create /lib/systemd/system/librespot.service
file with (adjust users/paths):
[Unit]
Description=Librespot
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service
Wants=network-online.target
After=network.target network-online.target
[Service]
User=qbee
Group=qbee
EnvironmentFile=/etc/librespot.env
ExecStart=/usr/bin/librespot
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
Qbee
For starting up automatically, create /etc/systemd/system/qbee.service
file with (adjust users/paths):
[Unit]
Description=Qbee
After=network-online.target
StartLimitIntervalSec=500
StartLimitBurst=5
[Service]
User=qbee
Group=qbee
ExecStart=/home/qbee/.local/bin/qbee
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
Enable to run on boot: sudo systemctl enable qbee
.
Optionally, specify a CONFIG
env variable when running the script:
CONFIG="/etc/qbee.yaml" ~/.local/bin/qbee ...
.
The default config will be located at ~/.qbee.yaml
.
Disable Pi GPU
This should help give more power to the CPU, useful for older Pis.
Edit /boot/config.txt
and add:
gpu_mem=16
disable_l2cache=0 # For pi 1 only
gpu_freq=250
Full circuit diagram
The relay turns on the 24 VDC power supply, which powers the amplifier, the LCD backlight and a green status LED.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for qbee_gpio-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb85d6ea349055661bc5bbcb2d12b25169aae16a0ed8d04ae93270c7fd113ad1 |
|
MD5 | 6a5a6d8798bb2c988a9f5302ce32b831 |
|
BLAKE2b-256 | 9bec4c926ca60a6119c2982a99e58d7ea954240d368431148895ec82f7333d39 |