Bluetooth Speaker + Raspberry PI – The ultimate guide. Now with WiFi support!

Leave a comment

June 25, 2015 by aubreykloppers

Note: Complete installation script available here: Installation Script Once logged into yourRaspberry, just run:
and run the script (after sudo su and chmod 777). Open web-browser with IP assigned.



I purchased a BlueTooth Speaker called a D-Link DBS-2012 Portable Stereo Speaker (Review) with the hope of getting RuneAudio or Volumio streaming to the speaker, but no such luck.  The developers of both states outright they do not support the technology, which I find a bit of a lack of vision.  Please note, you will also need a BT Dongle.

This said, here follows a guide getting a rather nice, light-weight distribution with a web front-end manageable via cell-phone or any web-browser:

Wheezy Installation

  • Download and install Rasbian Wheezy (This is based on 2015-05-05 release)
  • Commands:

– Check if your BTDongle is listed:
– Update your OS:
apt-get update
– Install all the dependencies:
apt-get install bluetooth bluez bluez-utils bluez-alsa mpd mpc python-mpd
– Edit audio.conf and add after [General]:
vi /etc/bluetooth/audio.conf
– Save and reboot

  • Test and Connect Speaker:

hciconfig hci0 up
hcitool scan
– This will give you a MAC-ID.  Mine is 30:22:00:2F:C1:E0 – Write yours down
bluetooth-agent – – adapter hci0 0000 nnn  # change this MAC address to the one you wrote down (0000 = pass) (Double minus before adapter no spaces!)
bluez-simple-agent hci0 nnn  # change this MAC address to the one you wrote down
bluez-test-device trusted nnn yes # change this MAC address to the one you wrote down
bluez-test-device trusted nnn  # change this MAC address to the one you wrote down
– This should give you one (1)

  • Create /etc/asound.conf:

vi /etc/asound.conf
pcm.bluetooth {
type bluetooth
device nnn  # change this MAC address to the one you wrote down
profile “auto”

  • Edit /etc/mpd.conf and change the a”audio_output”:

vi /etc/mpd.conf
audio_output {
type “alsa”
name “bluetooth”
device “bluetooth”
mixer_type “software”
– Save and reboot

At this stage you should be able to play a playlist by loading one and playing it with mpc:

mpc load
mpc volume 70
mpc play

For reference:
Your MPC.CONF file you edited and changed the values on has the path for your playlists stored (default is /var/lib/mpd/playlists).  You can save playlists in this directory and do a mpc ls to display the lists…

Configuring your web-client

For this installation, I used ympd.  It is a light-weight, no-nonsense web-client written in C, not needing any installation of apache2 or any other web-software.  It just works!  Description from GitHub: Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS. 

mkdir /home/pi/yp
cd /home/pi/yp
tar -xvf ympd-1.2.3-armhf.tar.bz2 /home/pi/yp/

  • Create an init.d startup script called yweb:

vi /etc/init.d/yweb

#! /bin/sh

# Provides: yweb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple Start Web Service for MPD
# Description: Start Web Service for MPD: Program gotten from


set -e

case "$1" in
 # Clear MPD Log File, Start the web-service, Wait for 30 seconds and then start mpc:
 > /var/log/mpd/mpd.log
 /usr/bin/sudo $N --webport 80&
 sleep 30 && /usr/bin/mpc play
 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
 exit 1

exit 0
  • Enable startup of yweb:

chmod 755 /etc/init.d/yweb
update-rc.d yweb defaults



  • Open your web-browser and point it to the IP of your PI.
  • Use mpc to playback a stream.

Hope this helps.

Adding WiFi:

Adding WiFi is quite easy.  First off, you have to add a WiFi USB dongle (I use the D-Link DWA-121 that works out-the-box for all my distros.  It is not only small, but also cheap) then scan for your SSID’s and then add it to your WiFi configuration.  Let me explain:

    • Scan your WiFi SSID’s with:

iwlist wlan0 scan|grep ESSID

      • Add your configuration with:

wpa_passphrase “SSID” “PASSPHRASE” >> /etc/wpa_supplicant/wpa_supplicant.conf


(ps: You can add multiple SSID’s with the above command)

If you want a static IP, just change the /etc/network/interfaces file to look like this:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet static
address YOUR_IP


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: