Spotify Internet Radio: Part 1 2013/02/01

Jan 22 2013


A few years ago I spotted the MightyOhm Wifi Radio post on HackaDay, and fell in love with that project.

Years ago I’ve played with the Squeezeserver software of Logitec. But as much as I loved the idea, I hated the experience every second of it.
The software was slow, laggy and a real resource hog. Apart from that, I didn’t had the money to buy an overpriced unit.

In the case of the MighyOhm however it was mainly the lack of a decent router, my knowledge of embedded systems and the fact that me and routers don’t see eye to eye.

Since that day a lot has changed. Well, internet radio’s are still overpriced, but we listen to other streaming services. The best example being Spotify. And in all honesty, paying 10€ a month is nothing compared with the price it would cost me to buy all those CD’s records online.

Another new thing that came along is the Raspberry pi. A dirt cheap all in one ARM system that’s more than heavy enough to run decent code.

The Idea

The goal is to make a variant of the MightyOhm radio, but playing spotify music, local music and webstreams. Also the systems needs to have control buttons and be controllable via remote.
As for the design, I’ve got some things in mind….. 😉


The power will come from a raspberry pi running mopidy, an mpd server with spotify enabled.

I’ll hook a display up to it, probably a standalone ATMEGA328 with an arduino bootloader (I love the simplicity of arduino’s, but dumping a whole one in would be overkill).
The display will consist of (about) 10 5×7 LED matrixes.

The goal is to give them a mix of these two effects:

So I’ll be placing the matrixes behind the thinnest veneer I can possibly find.

I also want to have control over the unit without the need of a seperate device. therefor I’ll be using another ATMEGA or ATTINY, keeping things seperate and not getting myself into trouble with to little pins.
I was thinking about including these buttons:
Volume, next, prev, play, pause, stop. I want them to be icons on the veneer with capacitive touch buttons underneath so they don’t actually click.
This can be done by this technology:

The AVR chips will talk to the raspberry pi via it’s GPIO pins using the I²C protocol.

Parts list

  • Raspberry pi
  • Case
  • 10x 5×7 LED matrixes
  • ATMEGA328 (2 of them)
  • some multiplexers, decade counters…
  • touch buttons
  • 3,3 to 5V i²C conversion chip “n i2c-level-shifter”
  • LED’s
  • resistors
  • crystal
  • caps
  • Donor amp & speaker

Cost calculation

  • Raspberry pi:         €36
  • atmega’s, amp & stuff:    €30
  • case :                       €40
  • displays:                   €20
  • veneer:                      €20

Total:                     +/- €150
That’s more than I want it to cost. I’ll try to see if I can keep the price under €80.

Jan 27 2013


Quick update: I went to the thrift store and picked up 2 mini speakers for €1.5 each.
Their audio isn’t perfect, but it’s good enough for a start. I also made a render of what it might turn as..

Feb 1 2013

Exams are over

So I just finished my last exam today. So I finally had some time to experiment. I don’t have a Raspberry pi at hand, so I used an old laptop to get Mopidy running.
It turned out to be fairly easy.. Although their wiki settings page isn’t in a logical order.

Here are the correct steps, assuming you’re running Ubuntu.


Install Mopidy
Just copy these lines. They’ll add the mopidy repo and install it:

wget -q -O – | sudo apt-key add – sudo wget -q -O /etc/apt/sources.list.d/mopidy.list sudo apt-get update sudo apt-get install mopidy

Configure your system

Keeping things simple, the next thing you want to do is tell Mopidy what to listen to by making and editing the Mopidy settings.

First make a new settings file by making the folder

mkdir ~/.config/mopidy

And then touching the file

touch ~/.config/mopidy/

Your file is now created and we can edit it. You do this by typing:

nano ~/.config/mopidy/

Now enter the following text. Everything behind the # is just comments.

MPD_SERVER_HOSTNAME = u'::’   #Tells your system to listen to all IPV4 and IPV6 addresses, and by this enabling control by other computers in the network
SPOTIFY_USERNAME = u’XxXxXxxxxxx’  #Your Spotify username. This can be found in you “account” menu on the spotify website
SPOTIFY_PASSWORD = u’**************’ #Your Spotify password.

LOCAL_MUSIC_PATH = u’/media/some/folder/Music’ #This is where your music stands. If you use the default location, use “$XDG_DATA_DIR”
LOCAL_PLAYLIST_PATH = u’$XDG_DATA_DIR/mopidy/playlists’ #this refers to the mopidy local data storage folder with playlists
LOCAL_TAG_CACHE_FILE = u’$XDG_DATA_DIR/mopidy/tag_cache’ #this refers to the mopidy tag_cache file

Okay, so the first 3 settings are pretty obvious. You tell the server to listen to all ip addresses and you give them your Spotify PREMIUM account details.
The last 3 basically specify the folder where your music is, and the folder where the playlists are and the tag_cache file.

With $XDG_DATA_DIR they basically mean: ~/.local/share/
I suggest you just keep this folder to dump everything

Tell Mopidy what you have and don’t have locally

So this step I forgot, and it took me a half an hour to figure it.. We specified where the folders with playlists etc are, but they aren’t created yet. So start by creating the playlist folder:

mkdir ~/.local/share/mopidy

Great, that’s one error less on startup! 😉

Now go to the mopidy shared data folder and let it scan your music folder

cd ~/.local/share/mopidy
mopidy-scan > tag_cache

This makes the tag_cache file in the right folder.

Start it and connect to it

Now start Mopidy by running it:


And finish off by connecting to it from your favorite MPD client. (I use GMPC)


The latest version of Mopidy at this stage is 0.11. This version doesn’t support webstreams of icecasts or shoutcasts. However, I learned from twitter that this option is will be in the 0.12 build. Apart from that the Mopidy server is running fairly well on my system. I did experience some connection drops, but I think it was because my tag_cache was in the wrong folder.

The computer system I’m testing this on is old but really powerful when compared with the raspberry pi. I hope this won’t turn in to a problem.

Feb 1 2013

Not on Raspbian

I spotted this article:

It shows how to install Mopidy on a Raspberry Pi. However, it looks like it can’t be run from the Raspbian OS because of a floating point difference in the kernel. This gives problems with libspotify.