Bluetooth Audio with Raspberry Pi

Learn to use a bluetooth speaker with your Raspberry Pi

Written By: Cherie Tan

Dash icon
Difficulty
Easy
Steps icon
Steps
4
One of the best features on the newer models of the Raspberry Pi such as the Raspberry Pi 3 Model B+ and Pi Zero W, is its on-board bluetooth capability.

In this guide, we will learn to connect the Raspberry Pi to a portable bluetooth speaker and play music from it! This guide will work for any bluetooth-enabled Raspberry Pi board. For the older models, a USB to Bluetooth Dongle can be used.

After this is done, you will be able to play music wirelessly from your Raspberry Pi.

Step 1 Using omxplayer

Before we begin with playing audio through a bluetooth speaker, let us look at another way you could go about playing audio files on the Raspberry Pi.
Over on the command line, omxplayer can be used by typing the following: omxplayer ~/Music/Insert_Your_Audio_File_Name_Here.mp3

As you can probably tell, it is rather tedious.

Step 2 Installing VLC

So what are the other options? We could use VLC media player. With it, you will be able to double click on audio files to get them to automatically play without using the terminal at all.

To install it, type the following in the terminal:sudo apt-get update then sudo apt-get upgrade 
This process might take a while, for convenience sake, you you may want to use the one command so that one runs after the other without any further input from you. You can do so by using:  sudo apt-get update -y && sudo apt-get upgrade -y

update - updates the list of packages but does not install
upgrade - install new versions of packages if new versions are available
option -y does not request for permission on every step
Next, use the command: sudo apt-get install vlc
The installation may take awhile, and you may be asked if you would like to allow metadata network access. What this does is add cover artwork and track listings to the files. You may choose to allow or don't allow it if it's unnecessary. 
Click continue

Step 3 Connect to Bluetooth

Now that we have got VLC media player installed, the next step is to connect the Bluetooth speaker to the Raspberry Pi.
With most bluetooth speakers, there will be a function to put it into pairing mode with another device. If you are using the same speaker as the one used in this guide, hold down to put the device into pairing mode.
Next, click on the Bluetooth icon on the top right hand corner and select 'Add a Device', then select your speaker and click on 'Pair'.

Step 4 Select Audio Device

Click on the audio device icon and select your device from the drop down menu. For this guide, the device is 'XC5209'.
Wait for it to connect and finally, you should see a green tick next to the device. It is now connected to the Raspberry Pi, so play the audio file on VLC player and it should output to the speakers!