Skip to content
/ optaradio Public

software and other stuff for my personal internet radio side project

License

Notifications You must be signed in to change notification settings

p4cx/optaradio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# optaradio


software and other stuff for my personal internet radio side project

WORK IN PROGRESS


what have i done:

My father tidied up his basement and found a Loewe Opta R115 radio. It worked but had an annoying noise in the background and along with the fact that UKW (FM), "Ultrakurzwelle" will be turned off in the future, I decided to rip out all of the stuff and turn it into an internet radio.
It took quite a while. But now I reached a step in which the software and hardware is usable!

I try to document everything, so if you want to recreate this (aka. wake up the dragon): Good luck 🍀
This is no step to step instruction, so you should take your time and think yourself.


hardware i used 🕹

  • Raspberry Pi 3 Model B V1.2
  • 1024x600px Display with HDMI
  • cheap USB Soundcard (3.5 plug on RPI is crap)
  • Amplifier with TPA3116D2 (have to check it out first, if it works fine)
  • Monacor SP-13/4 speaker
  • MeanWell RS-75-12 power supply (hope it delivers enough power for everything)

how i use/make/run that:

You can run the radio software as standalone on your desktop, buts that a bit stupid, because there are way better tools to play internet radio on your pc.

prepare 🥧

[all commands in your user space: /home/pi unless its explicit declared]

  1. flash Raspbian Lite on a micro sd card
  2. touch ssh in the root dir on the micro sd card
  3. connect via ssh and run raspi-config
    • System Options > Wireless LAN
    • System Options > Password
    • System Options > Boot / Auto Login > Console Autologin
  4. remove boring booting stuff (optional)
    • add disable_splash=1 at the end of /boot/config.txt and save
    • add logo.nologo quiet and change console=tty1 to console=tty3 in /boot/cmdline.txt and save
  5. install everything needed
    • apt update
    • apt upgrade
    • apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit
      (i know, i could use framebuffer with pygame, but I want to grab the pygame window over ssh and therefore I need xserver)
    • apt install git python3-pip vlc imagemagick pulseaudio libsdl-ttf2.0-0 python3-rpi.gpio
  6. dpkg-reconfigure tzdata and set your correct location for time
  7. git clone https://github.com/p4cx/optaradio.git in your user directory /home/pi
  8. run pip3 -r install requirements.txt in the freshly cloned optaradio repo
  9. grab an api url from openweathermap and paste it into nano weater.cfg - it should look like this: http://api.openweathermap.org/data/2.5/weather?q=munich&units=metric&appid=1234567890abcdefghijklmnopqrstuv
    Attention: get sure, that units is metric: "units=metric".
  10. ./optaradio/build.sh to get fonts and emojis from external repositorys

-- have to test this

  1. create a crontab for autostart
    • sudo crontab -e
    • insert @reboot sh /home/pi/optaradio/radio_startup.sh >/home/pi/optaradio/logs/cronlog 2>&1
  2. test it and if it runs: be happy

developing 💻

  • activate X11 fowarding on your host machine (sshd config)
    ssh [email protected] -Y on your machine and you will get the pygame window on your desktop
  • how do get radiothumbnails on the pi? Copy it manually with filezilla!

gpio usage 💡

USAGE PIN PIN USAGE
Power for all buttons 3V3 5V --
Favourite button 1 2 5V Power for rotary encoder
Favourite button 2 3 GND Ground for rotary encoder
Favourite button 3 4 14 Rotary encoder button
-- GND 15 Data channel rotary encoder
Favourite button 4 17 18 Clock rotary encoder
Favourite button 5 27 GND Ground for relais
Favourite button 6 22 23 Channel 1 for relais
-- 3V3 24 Channel 2 for relais
-- 10 GND --
Favourite button 7 9 25 Setting button 1
-- 11 8 Setting button 2
-- GND 7 Setting button 3
Update button 0 1 Setting button 4
-- 5 GND --
-- 6 12 --
-- 13 GND --
-- 19 16 --
-- 26 20 --
-- GND 21 --

run the 🐍 radio software

  1. cd ./optaradio
  2. python3 ./init.py

control optaradio

basic idea of controlling the radio: Like iDrive from BMW, rotate the wheel (in my case the KY-040 rotary encoder) to go up and down und press it to activate menu entry.

control on desktop:

  • return: input
  • up: up
  • down: down
  • 1-7: Favourite buttons
  • q: go back
  • w: audio on/off
  • e: LED on/off (future project)
  • r: settings
  • ESC: exit

control with real buttons:

  • look at gpio usage, it should be self explaining

build 📻

  1. get an old radio
  2. get rid of all old crap inside
  3. put a nice lcd and other fancy electronic stuff inside
  4. jump in 🌙 light around the radio
  5. squeeze your Raspberry Pi in the housing
  6. turn it on and have fun

About

software and other stuff for my personal internet radio side project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published