Archive | Raspberry Pi RSS feed for this section

Internet Radio Project

I want to share my latest DIY project with everyone: A Raspberry Pi based internet radio. Making this has been a blast and I’m very happy with the results. It performs nicely and sound pretty good. (It’s not Audiophile by any means).

I had a few specific goals for this project:

  1. It had to look good. Or at least, it shouldn’t look like I just stuffed a raspberry pi into an ice cream container and gave up. It had to be something I could put on a shelf or table in the lounge and have it not look out of place. I went for the retro vibe and built a timber box. The point color is called “Feisty Red” and I love it. You might be surprised but this was, by far, the hardest part of the whole project.
  2. It had to be simple to use. My initial goal was to be able to have music playing with the press of a single button.


The project uses the Pi MusicBox distribution for the Pi. This provides a solid base with all the bits you need already installed. It also has great support for many popular DACs already built in. At the core of this is the Mopidy music server. This is what does most of the heavy lifting and through the use of special extensions, you can enable your Raspberry Pi to play or stream from a wide variety of music services like Spotify or Google Play Music as well as local or networked files. I’m using the Spotify service in particular but I also want access to other internet radio streaming services like SomaFM and

Basic operation

The entire radio is driven from a single rotary encoder. A short press on the rotary encoder will start or stop playing. If no playlist is loaded, we load a default playlist automatically and start playing. Turning the rotary encoder will adjust the volume. If you long press the rotary encoder button, a menu will be displayed.

I built a simple frontend extension for Mopidy which hooks into their core API and allows receiving of events (like the currently playing track). This extension is also responsible for receiving input from the rotary encoder, updating the LCD and driving the menu.

If you need to do anything fancier, you can connect via your phone or web browser and control the radio using the full interface.

If you’re interested in the python LCD menu system, the code is available here. The code for the extension (warning: work in progress and in need of cleanup) is available here.


  • A Raspberry Pi Model B
  • A 2.2inch 240×320 TFT LCD (ILI9341 controller). This particular LCD works with the Adafruit library available here.
  • The amplifier is rated at about 3W which I built from a kit (available from Jaycar electronics)
  • A dodgy speaker that I pulled out of an old Logitech subwoofer.
  • I built my own power supply board with dual rails of 5V for powering the Pi and +-12V for powering the amplifier.
  • A rotary encoder


Here you can see the bits and pieces mounted inside the case. The power supply to the left, the amplifier board to the middle and the Pi (with USB sound card) up on side in the middle. The black box on the right is a ground loop isolator which helps reduces noise from the power supply getting into the signal. If I was more skilled at power supply design I might have been able to get away without this… but alas.

I would like to try and capture a video of the menu in operation… but for now, here is another picture. J

Comments { 0 }

Share a folder on your Raspberry Pi using Samba

I often need to share a folder on one of my Raspberry Pi computers. Here is the process I use:

Install the software:

sudo apt-get install samba samba-common-bin

Check that the daemons have been started:

sudo service samba status

Make a folder to share:

mkdir ~/share

Add your share to /etc/samba/smb.conf

[My Share]
  comment=My Share
  only guest=no 
  create mask=0777 
  directory mask=0777 

Set a samba password:

smbpasswd -a pi

Restart samba daemons:

sudo service samba restart

Test it

Now you should be able to see your share over the network and log in using your user/password entered above.


If you cannot see the share, make sure that you have restarted the daemons and that they started back up. If you can see the share but cannot access it, check that the path you entered actually points to a valid location and that your user has the rights to access it.

The next step is to have a look in the log files which are located under /var/log/samba

Comments { 0 }

Raspberry Pi: Clean Install to SSH Headless Box

Ever since I got hold of a Raspberry Pi computer, I’ve been singing its praises to anyone unlucky enough to be standing close to me. Not only is it affordable (even after you’ve bought/repurposed all the supporting gear) but it’s cheap to run 24/7 because of the low power consumption of the hardware.

I mostly use my Pi’s headless (no monitor, mouse or keyboard) and then use SSH / Remote desktop to connect to the machines over the network from my Uber desktop machine.

If you want to do the same, you can follow these steps but just tweak them for your own requirements.

Install Raspbian

Follow the instructions here on how to download and install the NOOBS Software onto your SD card. From there you can install a wide range of specialist operating system designed for the Pi. I generally stick to the recommended Raspbian distribution.

Configure Basic System Settings Using “raspi-config”

  • Update raspi-config to the latest in case they’ve made any bug fixes.
  • Set your password.
  • Set your host name. The host name is how your new machine will be identified on the network. Give it a nice, descriptive name because you’ll use it often.
  • Enable SSH. This will allow you to connect to the machine over the network and get to the console.
  • Set locale options : Locale – “en_US.UTF-8 UTF-8″

To get back in to the config program once you’ve quit, enter the following
sudo raspi-config

Change keyboard layout from “UK” to “US”

The keyboard layout is set to the UK by default. If you’re not in the UK, this will cause some issues (e.g.: tying “#” will give you a “£” instead). Let’s fix this.

sudo nano /etc/default/keyboard

Change XKBLAYOUT to “us”


sudo reboot

Configure Networking

By default, your Pi will be configured to use DHCP. I prefer to set up static IP address for my servers. Change these to match your network.
sudo nano /etc/network/interfaces

iface eth0 inet static

Assign a .local domain (Multicast DNS)

Install the Avahi-daemon so that you can refer to your Pi by name rather than use an IP address. There are other ways of doing this but I’ve found that this approach works nicely.

sudo apt-get install avahi-daemon

Now, if you don’t have it already, download and install Bonjour on your Windows machine from here. This will allow windows to be able to discover multicast DNS services like the one published by Avahi.

After you’ve installed Avahi (on the Pi) and Bonjour on your windows machine, you should be able to locate your raspberry pi on the network by its multicast name. (Your host name with a “.local” on the end).

Note: If you get an error from Avahi which mentions an existing unicast .local domain, fix it by doing the following:

sudo nano /etc/default/avahi-daemon


Connect to your Pi remotely via SSH

If you’re on a windows box, download and install Putty.

You should be able to connect via SSH using the default settings.

Enter your username and password and you’ll get to the SSH console.

Install Remote Desktop

sudo apt-get install xrdp
You can now connect to your Pi and get an X desktop environment using remote desktop.

Enter your username and password when prompted and you’ll be treated with a remote X session.


Congratulations, you can unplug your monitor and keyboard and hide your Pi under the desk or in a cupboard.

Now, time to get a second Pi?

Comments { 1 }