RaspberryPi Internetradio
- Raspberry Zero WH
- plus Pirate Audio Line-Out HAT with LCD-Display 240x240 pixel
- Hardware: https://shop.pimoroni.com/products/pirate-audio-line-out
https://www.berrybase.de/pirate-audio-hat-fuer-raspberry-pi-line-out - Software:
sudo apt install python3-rpi.gpio python3-spidev python3-pip python3-pil python3-numpy
sudo apt install pigpio python3-pigpio
https://github.com/pimoroni/pirate-audio
ST7789 display driver https://github.com/pimoroni/st7789-python
pip install st7789
sudo systemctl disable rsyslog
# disable loggingsudo systemctl enable pigpiod
# make sure to havepigpiod -t 0
in /lib/systemd/system/pigpiod.servicesudo systemctl start pigpiod
sudo raspi-config
: → Interface Options → enableSPI
for the LCD-display and enableI2C
for the DACsudo nano /boot/config.txt
:The DAC can be configured by adding dtoverlay=hifiberry-dac to the /boot/config.txt file.dtoverlay=hifiberry-dac gpio=25=op,dh # You can also disable onboard audio if you're not going to use it. # This sometimes helps applications find the right audio device without extra prompting: dtparam=audio=off
There is a DAC enable pin—BCM 25— that must be driven high to enable the DAC. You can do this by adding gpio=25=op,dh to the /boot/config.txt file.
The buttons are active low, and connected to pins BCM 5, 6, 16, and 24.
The display uses SPI, and you'll need to enable SPI through the Raspberry Pi configuration menu.
If you want to use these boards with a Pibow Coupé case (either for the Zero / Zero W or Pi 4), then you'll need to use a booster header to raise it up a little.
https://shop.pimoroni.com/products/pirate-audio-line-out
- Hardware: https://shop.pimoroni.com/products/pirate-audio-line-out
- Audio output using
mpv
engine- libmpv-dev
- python3-mpv library wrapper
sudo apt install mpv libmpv-dev python3-mpv
- advanced Icy-Title rendering:
trying to display the title with maximum font size and hyphenation in Python on the 240x240 pixel display
pip install pyphen
- medium long (< 3 seconds) volume-decrement-button press → mute
- long ( > 3 seconds) volume-decrement-button press → controlled shutdown
- time display every minute
- display of basic network connection info (hostname, IP, SSID, signal strength)
- key press signalling with beeps
-
code
: certain hard-coded key press sequences (à la port knocking) can trigger special actions or change certain program settings.
Example: the key sequenceA B A B
→ restarts the WiFi adapter and networking; this takes about 2 seconds. - WiFi and networking can be manually restarted by a special key sequence (
code A B A B
) - Mplayer can be restarted by 2-key-press
XA
- display of basic network information (SSID, IP address, hostname and RSSI/signal strength)
- ALSA: configured for multi-channel use with
dmix
plugin and equaliser plugin.pinetradio
sends its one (stream) or two (beeps etc.) audio signals viaalsa/plugmixequal
to the dmixer which mixed signal is finally equalised, see.asoundrc
for details and setup.
sudo apt install libasound2-plugin-equal
-
chime
: 1, 2, 3, 4 beeps at every hourly quarter (usingapscheduler
:pip install apscheduler
) - Activity (ACT) LED indicates "on" (1x flash) or "muted" (2x flash ) every 5 seconds
- Soundbox/Sound machine function: play stored sound files
-
cronplay
(autoplay
): a station-play-scheduler for autoplaying certain station/s at certain times similar tocron
Example: switch from the currently played first station to a certain second (e.g. news) station every hour minutes 00…05 and then switch back to the first station. - permanently show current network strength rssi (value in dB)
-
kitchen timer
function (a set of preprogrammed countdown timers like 2'30" for green tea etc.) can be started by 2-key-pressYB
- text-to-speech: informational messages with synthetic speech like station name, time and timer announcements
- controlling the onboard ACT LED for signalling purposes
-
code B A B A
→ code updating from git repo and reboot only when code has changed - update script checks and updates the code on every restart
- text-to-speech output (offline generated texts) when updating or restarting code or WiFi
- add two rotary encoders for station / volume control
- Enable/disable
cronplay
with another specialcode
. - permanently show current network strength rssi (as a bar)
- reboot if rssi is too low
- check whether stream/mpv is still alive; watchdog; restart mpv.play()
- add a quick
record
function with or without a timeout: basically, this is as easy as only adding or removing on-the-flyplayer.stream_record="filename"
-
record
if certain Icy texts are detected: basically, it is only adding & removingplayer.stream_record="filename"
- playing randomly selected "Wurfsendungen" (Kurzhörspiele; short audio drama) at random times or as a random play list continuously.
- ALSA Equalizer: interface to show and control the equalizer settings
- add loudness on/off
- alarm clock function with sound and/or internet radio stream, increasing volume
- method (other than ssh-ing) of setting up WiFi credentials (
captive portal
60 seconds after boot) - method (other than ssh-ing) of setting up stations (station names and their stream urls)
- optional mode: Bluetooth audio receiver
- replay (or time-shift) function to quickly replay the last xx seconds
ST7789 library