- build your own internet radio -

Internet radios that i have bought had all different drawbacks:

- too few or too many buttons -> use too complicated
- too many options on top of user interface
- too few options in depth of user interface
- display too bright
- volume adjustment too rough
- press-button too strong so that radio is pushed away

If you think that i am picky or over-critical i would like to defend myself:
Usually i am neither of that.
But when it comes to internet radio this is different.
When you build your own internet radio there is nothing to complain about.
Why? Because you would have to criticise your own work. Who would do that?

The internet radio i want to present here is

- based on raspbery pi
- programmed in python
- can be mono or stereo
- can use rotary encoder knob and/or buttons

I am mostly presenting my own radio and in some cases i am mentioning alternatives.
The following features have not (yet) been realized in my radio:
- bluetooth connectivity
- play music from USB stick
- integration of streaming services (e.g. spotify)
- many more


My radio is based on the raspberry pi zero because this is just powerful enough for whhat i have used it so far.
It is cheaper and uses less power that the bigger raspberries.

The amplifier that i use is based on I2S which is fully digital.
The built-in audio of the raspberry is told to be relatively LoFi.
I have not tested that but i want to be sure that when i hear disturbances that they do not come from my signal path.
I have already used these amplifiers:
- Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A
- Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi - Mini Kit
Both work well.
As a speaker i used the Visaton FRS8
As rotary encoder i used a KY-040 that can be bought from many sources.
As a display i have used two different TFT displays so far:
- 1.8" Color TFT LCD display based on ST7735-chip

- 2,2" TFT LCD Display Modul 240x320 pixel based on ILI9341-chip

- any other display can be used. Easy-to-use python libraries exist for most of them. SOFTWARE:

In short, the radio software uses
- python
- mpd (music Player Daemon)
- interrupts for encoder and button evaluation
- libraries from Adafruit for the display

The name "Pi" is the abbreviation for "Python interpreter"
So i think using python for this radio is appropriate.
I think python is a nice and easy, yet powerful language for beginners (I do not know if i am a beginner or already advanced).

mpd is a music play demon. It is a service that, once installed, runs on your computer and plays music from your own hard disk as well as from internet radio stations.
mpd can be commanded over a python interface. You will see how to use it.

interrupts are software and hardware functions that make a certain piece of software run very urgently by interrupting most or all software that was previously running as fast as possible. The interupt is triggered by a hardware event - usually a state change in an input signal of a processor. This is needed for very time critical tasks. A time critical task in our software is the reaction to the press of a button. So the programm code that is supposed to occur when a certain button is pressed must be connected to that event. This is a special thing that is very important for programming a radio. I think it is really annoying if buttons do not react instantly. In many devices that we use, the reaction to user input takes very long. I have experienced that i have become used to that so much, that, if a reaction to a button press comes without delay, i almost have the impression that it came even before the press of the button.
Even more important than for the buttons, the interrupt is needed for an encoder wheel. These are used in almost any radio for volume control. When turned, they produce a fast series of signals that the computer needs to detect properly without missing a state.

display libraries/drivers:
Controlling a display is complicated. Only very advanced users would like to write this software completely on their own. So it is convenient that good programmers have written libraries/drivers that make it easy for users like me to control a display. My task is only to tell the display driver through which pins my display is connected to the raspberry. As soon as i have done that properly, i can tell the driver which text or graphics i want to print in which position (in which size and colour) and the driver does all the complicated things for me. I think the companies (e.g. Adafruit) that pay people for writing display libraries/drivers should be rewarded by users of these drivers by bying their products.

design considerations.
Be aware of the fact that you are the designer of the functionalities. you can decide what the radio can do and cannot do. There are radios that can only play one station in one volume and that is all. No display needed. Only one button (on/off).
Complexity can be a burden. Many users are very grateful for simplicity.
I have a radio that has only one encoder knob with integrated pushbutton.
Another radio i have has one encoder knob with pusbutton and additional 8 small buttons that all look the same and are arranged in an 2x4 array.
One radio i have built has no buttons at all and is controlled vie IR-remote. It has no display and tells you by voice which station has been chosen.
Think of those systems for children, where the content is commanded by the plastic figure that is placed in a certain position on top of the device.
Think of those alexa systems that are completely commanded by voice!
Imagine a system that plays your favorite music in the ideal volume before you even think of it!

I believe it is nice to press a button if the button is big, visible and easily accessible, if the function of the button is known, clear and obvious and if that button reacts as expected.

My radio needs to have a display because i need it to show me the time when i wake up at night. It is important that that display is big and bright enough but not too bright.

Many radios built by hobbyists that can be seen on the internet have a rather poor housing. The reason is probably that people that like building electronics and software are not equally interested, skilled or equipped to build housings. That is a pity, because it makes your radio a complete device and adds a lot of value. It can make it a work of art. Another important reason for building a housing is the sound of the radio. A speaker sounds much better when integrated in a massive wooden chest than when sitting in a thin-walled plastic box.

So now after all this introduction which i hope you found interesting and inspiring, let me come to the description of how i built my radio.



A button is an element that closes and opens an electric cirquit. The buttons that i allways use are normally open (just like the one in the above graphic) and are only closed as long as i push them. They are called "normally open pushbuttons".
Wire (a) must be conneted to an input pin and wire (b) must be connected to ground. In reality the button looks like this:

Next thing is to connect the button to the raspberry. The following picture shows the pinout of the raspberry:

Encoder --> Raspberry:
GND ---> GND
+ ---> 3.3V
SW ---> 17
DATA ---> 6
CLK ---> 5

Display --> Raspberry
LED ---> 12 (via resistor or poti)
SCK ---> CLK
DC/RS ---> 24
RESET ---> 25
CS ---> CE0
GND ---> GND
VCC ---> 3.3V

back to main page