{"id":18610395,"url":"https://github.com/aluedtke7/piradio","last_synced_at":"2026-05-01T04:37:34.791Z","repository":{"id":57661760,"uuid":"225161453","full_name":"aluedtke7/piradio","owner":"aluedtke7","description":"Internet radio player for the Raspberry PI written in GO","archived":false,"fork":false,"pushed_at":"2022-04-02T10:05:31.000Z","size":7930,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T23:11:36.262Z","etag":null,"topics":["go","golang","radio","raspberry-pi"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aluedtke7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-01T12:56:07.000Z","updated_at":"2022-12-27T07:33:28.000Z","dependencies_parsed_at":"2022-09-13T00:31:59.603Z","dependency_job_id":null,"html_url":"https://github.com/aluedtke7/piradio","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/aluedtke7/piradio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aluedtke7%2Fpiradio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aluedtke7%2Fpiradio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aluedtke7%2Fpiradio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aluedtke7%2Fpiradio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aluedtke7","download_url":"https://codeload.github.com/aluedtke7/piradio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aluedtke7%2Fpiradio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32485297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","radio","raspberry-pi"],"created_at":"2024-11-07T03:09:48.392Z","updated_at":"2026-05-01T04:37:34.755Z","avatar_url":"https://github.com/aluedtke7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Internet radio player for the Raspberry PI written in GO\n\nThis project describes what is neccessary to build an internet radio player with GO for the Raspberry Pi.\nThere is a [documentation file](doc/development.md) about some aspects of the software design\n(i.e. _why do you use an extra channel for the display?_).\n\n![breadboard](doc/breadboard.jpg)\n\nThe wiring is also documented with a fritzing sketch.\n![Fritzing](doc/schematic.png)\n\n### Hardware\n\nFor the development I'm using a model 3B+ but the final target will be a Raspberry PI Zero WH.\nThis is the cheapest model that has WIFI. An internet radio without WIFI doesn't makes sense\nin my opinion.\n\nThe documentation about that version can be found [here](doc/raspi_zero.md).\n\n#### Displays\n\nAs display you can choose between two differnt types: a 20x4 LCD or a 0,96\" OLED both with i²c interface. The program\ncan handle both of them but not simultaneously. There's a flag to switch between LCD and OLED (hint try `piradio -help`).\n\n![LCD](doc/lcd.jpg)\n\n![OLED](doc/oled.jpg)\n\n#### Speaker\n\nIt's up to you what you use as loudspeakers. I'm using a pair of cheap usb speakers. It's absolutely neccessary to\nhave a galvanic isolation between the loudspeaker input and the raspberry pi. Otherwise you will hear any possible\ninterferences in the speakers. I bought the noise filter (ground loop isolator, the black round tube at the bottom of\nthe photo) from a big american online warehouse.\n\nIt's also possible to connect a Bluetooth speaker to the raspberry pi, but that\nis documented in the [readme of the Raspi Zero W](doc/raspi_zero.md).\n\n### Software\n\nThe software is written in GO (1.18) and it uses the `mplayer` for the heavy lifting part (music streaming etc.).\nThere are currently 5 (self describing) buttons:\n\n- next station\n- previous station\n- increase volume\n- decrease volume\n- mute/unmute\n\nThe list of stations is loaded at the start from the location `~/.piradio/stations`. If this file doesn't exist or is\nempty, a default list with 3 stations is created. This part was inspired by the\n[goradio](https://github.com/jcheng8/goradio) project.\n\nThe last played station will be remembered. The actual list index is stored in\n`~/.piradio/last_station`. On the next start, the last used station index is loaded. When a station\nchange is made, the actual index is delayed written to the file (see `debounceWrite`).\n\nThe software will always use a 4 line layout on both displays. The LCD can show 20 characters per line and the OLED\nis able to show 18,5 characters.\nThe first line shows always the station name. The second line will display the artist and the title is in the third line.\nThese two lines automatically scroll in case of long strings. The scroll speed is configurable via flag\n`-scrollSpeed`. It's also possible to scroll the station name, but that has to be enabled via flag `-scrollStation`.\n\nThe fourth line shows the stream bitrate and the volume level. When the station is changed, the current time and date is\ndisplayed while the next station is loaded. When the first station in the list is selected, the ip address is displayed\ninstead.\n\n### Preparation of the Raspberry PI\n\nThe following paragraphs imply that your raspberry pi is already configured with raspbian and set up in a way that\nyou can ping him (at 10.7.7.43 in my case) from another pc.\n\n#### enable ssh for login\n\nIn file `/etc/ssh/sshd_config` on the raspberry pi change/add the line\n\n    PermitRootLogin yes\n\nSave the file (you probably should use `sudo` for this). After that execute the next two lines\n\n    sudo systemctl start ssh\n    sudo systemctl enable ssh\n\nThen execute on the pc\n\n    ssh-copy-id -i ~/.ssh/id_rsa.pub pi@10.7.7.43\n\n\nThis will ensure that you don't need a password for connecting.\n\nOn the raspberry pi enter\n\n    sudo passwd\n\nto set a new password for user **root**. After that, enter the following line on the pc:\n\n    ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.7.7.43\n\nThis way, you also don't need a password when connecting as user root.\n\n#### Enable i²c\n\nStart program `sudo raspi-config` and select menu `5 Interfacing Options` and there the sub menu\n`P5 i²c` via cursors and press ENTER. Move to `\u003cYES\u003e` via cursor keys and press ENTER again.\n\nRestart now the raspberry via `sudo reboot`.\nLogin and test via tool `i2cdetect` the i²c bus:\n\n    sudo i2cdetect -y 1     # or ...-y 0\n\nThis is the output when both displays are connected (LCD is at 27 and OLED is at 3c):\n\n         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f\n    00:          -- -- -- -- -- -- -- -- -- -- -- -- --\n    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n    20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --\n    30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --\n    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n    70: -- -- -- -- -- -- -- --\n\nIn case the tool is not installed:\n\n    sudo apt update \u0026\u0026 sudo apt install i2c-tools\n\n#### Start binary with parameters\n\nPiradio comes with several command line parameters. When no parameters are given, the LCD will be used.\nAll parameters are case sensitive.\n\n    cd /home/pi\n    ./piradio           # uses the LCD\n    ./piradio -oled     # uses the OLED\n    ./piradio -help     # shows all options\n    Usage of ./piradio:\n      -backlightOff\n        \tset to switch off backlight after some time\n      -backlightOffTime int\n        \tbacklight switch off time in s (3s...3600s) (default 15)\n      -camelCase\n        \tset to format title\n      -debug\n        \tset to output mplayer info on stdout\n      -lcdDelay int\n        \tinitial delay for LCD in s (1s...10s) (default 3)\n      -noBluetooth\n        \tset to only use analog output\n      -noise\n            set to remove noise from title\n      -oled\n        \tset to use OLED Display\n      -scrollSpeed int\n        \tscroll speed in ms (100ms...10000ms) (default 500)\n      -scrollStation\n        \tset to scroll station names\n\nDescription of the options:\n\n- backlightOff: if set and if using the LCD, the backlight will be switched off after NN seconds, when no button\n  is pressed during this time.\n- backlightOffTime: the time in seconds the backlight is on. Will be reset with every button press.\n- camelCase: if set, the Title will be formatted in a _camel case_ way\n- debug: in case of problems set this option a see what happens on the comand line. `piradio` has to\n  be started manually in the shell to see the output.\n- lcdDelay: sometimes the LCD will not be correctly initialized and the display shows funny characters.\n  In this case increase this value. Only needed for the LCD.\n- noBluetooth: when set, no bluetooth connection will be tried.\n- noise: some stations transmit very long title names with the remix name in round brackets. If you\n  enable this option these strings will be removed and the title will most probably fit on the display without\n  scrolling.\n- oled: set this option to use the OLED display.\n- scrollSpeed: the scrolling is set by default to a speed of 500ms. If this speed is too fast or too\n  slow for you, please set a different value here.\n- scrollStation: if you want the station name to scroll in case of long names, please enable\n  this option.\n\nVarious options set:\n\n    ./piradio -oled -camelCase -scrollStation -scrollSpeed=300\n    ./piradio -camelCase=false -debug=false -scrollSpeed=300 -scrollStation=false -oled=true\n    ./piradio -camelCase=false -debug=false -scrollSpeed=750 -scrollStation=false -lcdDelay=5 -noise=true\n\n### Start piradio on boot\n\n#### Start\n\nIn order to start piradio on every boot, we have to add a line in `/etc/rc.local`:\n\n     su pi -c '/home/pi/piradio -oled -scrollSpeed=300 \u0026'\n\nPlease put this line **before** the line containing `exit 0`!\n\nThis will start `piradio` as a background task of user `pi`. The user switch is needed because otherwise\n`piradio` would run with `root` priviliges.\n\nThe parameter used are just one possibility to start `piradio` and can also be omitted. It's important\nto end the line with an `\u0026` and that the user has the right to start `piradio` in that folder.\nThe file `rc.local` needs admin rights to be changed:\n\n    sudo nano /etc/rc.local\n\n#### Stop\n\nIf you need to stop the automatically started `piradio`, please proceed as follows. First, get the\n`Process Group ID (PGID)` of piradio and the mplayer processes:\n\n    ps -o pgid,cmd -U pi\n\n    PGID  CMD\n     561  /lib/systemd/systemd --user\n     561  (sd-pam)\n     570  /home/pi/piradio -oled -scrollSpeed=300\n     570  mplayer -quiet http://tuner.m1.fm/chillout.mp3\n     570  mplayer -quiet http://tuner.m1.fm/chillout.mp3\n     981  sshd: pi@pts/0\n     993  -bash\n    1044  ps -o pid,ppid,pgid,cmd -U pi\n\nThe line containing `/home/pi/piradio ...` has a number (570) in column `PGID`. This PGID number is also\nshown in the lines containing `mplayer ...`. To stop all these processes in one go, enter the following:\n\n    kill -- -570\n\nNow you can copy your fresh version of `piradio` to your Raspberry Pi.\n\n### See title/interpret in terminal\n\nIf you want to see the actual title/interpret in a remote terminal, you should\nrun the following command to see the log of piradio:\n\n    less ~/.piradio/log/piradio.pi.INFO\n\nPress `\u003cshift\u003e+\u003cf\u003e` to let less update the log constantly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faluedtke7%2Fpiradio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faluedtke7%2Fpiradio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faluedtke7%2Fpiradio/lists"}