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.
- 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)
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.
[all commands in your user space: /home/pi
unless its explicit declared]
- flash Raspbian Lite on a micro sd card
touch ssh
in the root dir on the micro sd card- connect via ssh and run
raspi-config
- System Options > Wireless LAN
- System Options > Password
- System Options > Boot / Auto Login > Console Autologin
- remove boring booting stuff (optional)
- add
disable_splash=1
at the end of/boot/config.txt
and save - add
logo.nologo quiet
and changeconsole=tty1
toconsole=tty3
in/boot/cmdline.txt
and save
- add
- 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
dpkg-reconfigure tzdata
and set your correct location for timegit clone https://github.com/p4cx/optaradio.git
in your user directory/home/pi
- run
pip3 -r install requirements.txt
in the freshly cloned optaradio repo - 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". ./optaradio/build.sh
to get fonts and emojis from external repositorys
-- have to test this
- create a crontab for autostart
sudo crontab -e
- insert
@reboot sh /home/pi/optaradio/radio_startup.sh >/home/pi/optaradio/logs/cronlog 2>&1
- test it and if it runs: be happy
- 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!
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 | -- |
cd ./optaradio
python3 ./init.py
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
: inputup
: updown
: down1
-7
: Favourite buttonsq
: go backw
: audio on/offe
: LED on/off (future project)r
: settingsESC
: exit
control with real buttons:
- look at gpio usage, it should be self explaining
- get an old radio
- get rid of all old crap inside
- put a nice lcd and other fancy electronic stuff inside
- jump in 🌙 light around the radio
- squeeze your Raspberry Pi in the housing
- turn it on and have fun