Skip to content

Latest commit

 

History

History
100 lines (90 loc) · 6.78 KB

README.md

File metadata and controls

100 lines (90 loc) · 6.78 KB

pinetradio

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 logging
    • sudo systemctl enable pigpiod # make sure to have pigpiod -t 0 in /lib/systemd/system/pigpiod.service
    • sudo systemctl start pigpiod
    • sudo raspi-config: → Interface Options → enable SPI for the LCD-display and enable I2C for the DAC
    • sudo nano /boot/config.txt:
      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
      
      The DAC can be configured by adding dtoverlay=hifiberry-dac to the /boot/config.txt file.
      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
  • Audio output using mpv engine
    • libmpv-dev
    • python3-mpv library wrapper
      sudo apt install mpv libmpv-dev python3-mpv

Implemented features

  • 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 sequence A 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 via alsa/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 (using apscheduler: 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 to cron
    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-press YB
  • 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

TODO / Brain storming section

  • add two rotary encoders for station / volume control
  • Enable/disable cronplay with another special code.
  • 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-fly player.stream_record="filename"
  • record if certain Icy texts are detected: basically, it is only adding & removing player.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

special requirements

ST7789 library

IMG_20230725_135840 IMG_20230725_140013 IMG_20230725_135914 IMG_20230725_135825

Example for Soundbox function (play stored sound/s): IMG_20230725_140200

IMG_20230725_140310 IMG_20230725_140320_pyxelate

It's time to say goodbye (shutdown has finished): IMG_20230725_162818_edit_203241560851799