FM / DAB+ / INTERNET / MP3 Player Powered by an Arduino Nano and a Raspberry Pi 3 Model B+ Full source code available here: https://github.com/jjintokyo |
A small self-powered USB hub will come in handy too and don't forget the remote control to drive the radio. Any cheap infrared remote should work, even the one from your TV! |
Basically the Arduino (program radio.ino) handles the remote, the leds and the LCD screen then sends commands through serial communication to the Raspberry Pi (program radio.sh). The Pi then executes the commands. Then if requested, the Pi will return some data to the Arduino, like title being played and URL being played. An application on the Pi, NGSoftFM, handles the FM mode thanks to the RTL-SDR dongle. And another application, dab-cmdline, handles the DAB mode, again with the RTL-SDR dongle. For the internet radio mode, including the random mode and of course playing MP3s, I am using VLC. It's a robust / mature software that plays pretty much anything you throw at it! In the web interface (see below for more info and a screenshot), the 40 presets buttons are handled by MPC / MPD, instead of VLC. This is great because it uses very little CPU resources, so your Raspberry Pi stays cool. Unfortunately it doesn't play all the links! VLC is a bit more resource-intensive but also plays more links. |
Couple of other important files: |
playlist.db is the file that contains the 40 internet presets. It's a text file so you can edit it directly on your Raspberry Pi. One URL per line! Use SSH to login to your Pi, or better use the web interface to update the links very easily (see below for more info and a screenshot). special.db is another text file with just ONE internet radio link. A special / seasonal / favorite radio that can be activated with the push of just one key on the remote, regardless of the mode you're in. presets is a bash script to handle the ALSA equalizer. You should edit it and enter you own values to match your speakers / preferences and enhance the sound. init.sh is another bash script and takes care of the random internet radio. It is launched once and automatically, every time you power the radio on. It will download the icecast data from the internet (yp.xml) and populate a small SQL database on the Pi (channels.db) for the random internet radio mode to function. The script runs in the background at boot time and will take anywhere between 2 to 15 minutes to complete, depending on the speed of your micro SD card and the number of entries in the database (could vary quite a bit). |
You will have to update in radio.ino sketch, the codes to match your own remote. The Arduino IDE has a built-in example to help you displaying your remote control codes. |
Then install & configure in your Raspberry Pi: NGSoftFM - https://github.com/f4exb/ngsoftfm dab-cmdline - https://github.com/JvanKatwijk/dab-cmdline VLC (sudo apt-get install vlc) MPC / MPD (sudo apt-get install mpc mpd) APACHE (sudo apt-get install apache2) ALSA equalizer (sudo apt-get install libasound2-plugin-equal) |
Finally, make the radio.sh
script automatically run at boot time:
nano .bashrc (then add those 4 lines at the end) ### RADIO ### if [ $(tty) == /dev/tty1 ]; then /home/pi/radio.sh & fi |
ArduiPi Radio! Quick Overview - The Box | ArduiPi Radio! Quick Overview - The Features |
Bits & Pieces - Test #1 | Smooth Scrolling! |
OpenWrtRadio - Internet Radio On A Tight Budget! |
|||
August 2020: If you cannot buy an Arduino or a Raspberry Pi for some reason, you can still make yourself an Internet Radio for cheap. Thanks to OpenWrt, you can turn a router into a Linux box, including shell scripting, Busybox, Python, Apache, MPC / MPD and so much more... Kudos to the guys at OpenWrt who made this possible! |
|||
Before getting the router, make sure (1) it is compatible with OpenWrt and (2) it has a USB port so you can plug a USB sound card dongle to get audio. I’m using a NETGEAR R6220, it’s inexpensive and has decent hardware specs. The latest version of OpenWrt (19.07.3) is very stable (24/7) and runs well on it. |
|||
My router-radio can be controlled with a USB keypad, a wireless mouse (poor man's remote!) and the full-featured web interface, including the Random Mode, thanks to Icecast and its database (more or less 20,000 links right now!). Full source code for this project is in the OpenWrtRadio folder :-) |
PC.RADIO! |
||||
Just finished porting my little Raspberry Pi internet radio web interface to Windows. I wanted to be able to listen to my 40 favorite radio links + the random by genre feature on my Windows box, standalone and easily. | ||||
All my Linux shell scripts have been rewritten in Python 2, so you will need it in Windows 10. You can download Python 2.7.10 HERE, it's a ZIP file that is only 22 megabytes. No installation needed, just extract to "C:\Program Files\GNURadio-3.7\gr-python27", it will expand to 160 megabytes and that's it, you're good to go! For the radio player, I'm still using MPD & MPC, both work well under Windows 10 too :-) Check out the PC.RADIO folder! |
From Android To Linux... Hello Ubuntu!March 2021: New radio in the house. NO Raspberry Pi, Arduino or router needed this time ;-) |
||
The radio was made from an Android TV box. Thanks to the great work from the folks at Armbian, you can replace Android with Linux, and it's compatible with many types of ARM based devices. My TV box is based on the Amlogic S905X CPU. Perfect way to recycle an older box that was gathering dust! Best of all, the whole system fits into internal storage (eMMC), so no more worrying about messing up your setup and corrupting your fragile micro SD card, when power gets cut for example. |
Mini LEGO Radio: Another Android box (Strong SRT 2023), smallest box I have seen. It's an older design with only 1 GB of RAM and came with Android version 7.1 (Nougat), on clearance sale right now for dirt cheap! | ||
15 hours non-stop playing DAB+ (most CPU intensive), no hiccups, CPU temperature is reasonable, box stays cool... LINUX ROCKS! Here's the radio main script: my_radio.sh |
Back to OpenWrt this summer with my new (tiny) friend!Stumbled upon a TP-LINK TL-WR902AC V3 travel router at my local store that was inexpensive and had a USB port. I knew right away I had to have it and YES it's compatible with OpenWrt :-) |
||
But it has only 8 megabytes of flash storage. So had to use OpenWrt Image Builder feature to make a custom firmware, including the packages I needed (mpc / mpd-mini, triggerhappy, curl, apache + my config and scripts...) and removing all the other stuff I didn't need. | ||
video | I ended up connecting to the router a small USB hub with 4 devices. A wireless mouse, a wireless keypad, the USB sound card of course, but also a 32 GB flash drive to hold my MP3 files. | video |
That welcome extra storage allowed me to install additional packages that couldn't possibly fit into the router's flash (python-light for the random mode, espeak / svox for voice announcement and mpg123 to play MP3s). The router can go portable and runs a long time on a 5V 10000mAh power bank. The Wi-Fi coverage is excellent too. Here's the main script: my_radio.sh |
OpenWrtRadio --- Xmas 2021 --- Christmas Jukebox! |
||||
Just made a Jukebox for Xmas to put beside the Christmas tree. It plays Christmas radio stations (68 links from Icecast right now) and all my other favorite links as well. Powered by a TL-WR902AC router, with small built-in speakers and a built-in wired mouse for easy control. | ||||
It also has a wireless keypad for advanced access, a 32 GB USB flash drive for MP3s and a USB LED light for decoration. All this plugged into the router's single USB port! |
|
|||
Running smoothly on OpenWrt 19.07.8, thanks guys!
video-1
video-2
Ended up connecting my Bose entry-level bookshelf speakers for room-filling experience... Very nice (^_^) |
OpenWrtRadio - Oldies but Goodies Jukebox! |
||
Made another build still powered by a TP-LINK TL-WR902AC V3 travel router, customized for oldies radio stations and a built-in 6 buttons gaming mouse for full control with cool light effects.
video-1 video-2 Just having a little bit too much fun with LEGO while listening to some fine tunes! |
The "NoPi" Radio!August 2023: Built a new radio for the kitchen optimized for DAB reception. Getting over 100 DAB stations here, YEAH!No Raspberry Pi in this one, just a Strong SRT 2023 Android board flashed with Armbian + Ubuntu. I replaced the program dab-cmdline with welle-cli which gives me a better DAB performance. And I can easily show the artist name / song title playing on the 2x16 LCD display. One year later, still using this radio and very happy with it. SWEET! |
||||||
¯\_(ツ)_/¯