Raspberry Pi Bluetooth Speakers

In this guide, we will be showing you how you can turn any speaker into a Bluetooth capable speaker by using a Raspberry Pi

Raspberry Pi Bluetooth Speaker

By connecting your Raspberry Pi to a set of speakers, you can significantly extend their functionality.

This project allows you to modernize any old speaker or hi-fi system by bringing the ability to stream audio directly to them.

Besides adding Bluetooth audio support to our Raspberry Pi, we will also be adding support for Apple AirPlay, Spotify Connect, and synchronized multi-room audio.

To add all of this extra functionality to our Raspberry Pi, we are going to make use of a balena image called balenaSound.

Typically getting Bluetooth audio, AirPlay, Spotify, and synchronized audio to work on a Raspberry Pi can be tricky.

This image provided by Balena dramatically simplifies the setup process and should reduce the likeliness of running into errors.

Equipment List

Below we have included a list of the equipment that you will need to set up your Raspberry Pi powered Bluetooth speakers.

Recommended

Optional

For this Raspberry Pi Bluetooth Speaker tutorial, we made use of a Raspberry Pi 4 running the latest version of balenaOS.

Downloading the balenaSound image for Bluetooth Audio

In this section, we will be walking you through the process of setting up the balenaSound operating system on your Raspberry Pi. This software will allow you to stream audio to your speakers using your Raspberry Pi’s Bluetooth.

To proceed, you will need to have signed up for a free Balena account.

1. Our first step is to create an application within the Balena web interface.

To make this process quicker, you need to click this deploy with Balena link.

This link passes the balenaSound GitHub repository to the deploy dialog.

2. On this screen, use the “Default Device Type” (1.) option to select the Raspberry Pi that you want to set as the default device.

Once you have selected the default device, click the “Create and deploy” button (2.) to proceed.

Raspberry Pi Bluetooth Speaker Deplyoing With Belana Sound

3. You will be taken to a page that lists all the devices that you have deployed with balenaSound.

As we have not yet added the Bluetooth Speaker software to our Raspberry Pi, you will need to click the “Add device” button.

Create new Balena Raspberry Pi Device for Bluetooth Audio

4. This popup will allow us to generate the balenaOS image for our chosen device.

Your first task is to select the “device type” (1.) If the default setting is incorrect, click the box and select your device.

Next, you need to decide what version of the balenaOS image you want to use (2.). For our purposes, we are going to select the Production option.

You can use the Development image to help troubleshoot any issues you might be having.

If you want to use WiFi, click the toggle underneath the “Network Connection” header (3.).

If you enabled WiFi, you must specify the SSID and Passphrase for the connection (4.).

With all your settings configured, click the “Download balenaOS” option (5.).

Writing the balenaSound image to your Raspberry Pi

In this section, we will show you how to write the image you downloaded in the previous section to your Raspberry Pi.

To write the balenaSound image to our Raspberry Pi’s SD card, we will be making use of Etcher. This is a useful tool that also happens to be developed by balena.

1. Within the Etcher software, click the “Select Image” button.

This button will bring up a file dialog that will allow you to select the image you want to write to your SD card. In our case, this is the balenaSound image.

Select balenaOS Image to write to Raspberry Pi

2. Once you have selected an image, you will now choose the device you want to write the image to.

If you only have one compatible device, it will be chosen automatically by the Etcher software.

Select Drive to Write BalenaOS image to

3. With everything set, we can click the “Flash” button to write the image to your SD card.

Flash balenaSound image to Raspberry Pi

Before you click this button, make sure that you have the correct drive selected as this process will wipe the drive.

Once the image has finished being written to your SD card, you can now plug it into your Raspberry Pi and turn it on.

Checking your Raspberry Pi Bluetooth Speakers on Balena

Now that you have balenaOS up and running on your Raspberry Pi, it will start to download and prepare the Bluetooth Audio service.

In this section, we are going to quickly show you how you can use the Balena interface to check the status of your Raspberry Pi.

1. Start by going to the Balena dashboard page.

On this page, click the “balena-sound application.

Balena Dashbaord showing BalenaSound

2. This page will list out all devices that you are running with the BalenaSound application.

Using this list, you can quickly see the status of your devices. As you can see from the image below, our Raspberry Pi is currently updating.

You should see the Raspberry Pi that we set up in the previous step listed here, click the listing to bring up more information.

Raspberry Pi in the Balena Dashboard

3. On this page, you can see various details of the BalenaSound image running on your Raspberry Pi.

Within the services section, you can see that the Bluetooth audio service up and running on your Pi, as well as the additional services like Spotify and Airplay.

Using this interface, you can stop, restart, and start any of these services with relative ease.

balenaSound Dashboard Showing Bluetooth Speaker Service

Connecting to your Raspberry Pi Bluetooth Speakers

Thanks to the balenaSound image, we have three ways to play music through our connected speakers.

These three methods for playing audio is Bluetooth, AirPlay, and Spotify Connect.

Streaming Audio over Bluetooth

Connecting to your Raspberry Pi speakers over Bluetooth is a straightforward process.

balenaSound helps this process by continually broadcasting itself over Bluetooth. Any Bluetooth capable device can connect to our Raspberry Pi and play music through the connected speakers.

1. To find our Raspberry Pi’s Bluetooth speakers, perform a scan from your Bluetooth capable device.

For our example, we are going to show you how the device would appear on an iPhone.

Raspberry Pi Bluetooth Speaker showing on iPhone

You should see the device appear with the name “balenaSound” followed by a unique ID.

2. As your Raspberry Pi presents itself as a Bluetooth speaker, you can now send any audio output over the connection to be played through your speakers.

Sending Music over AirPlay

BalenaSound also comes with built-in support for Apple AirPlay.

AirPlay is a protocol for sending things like music over a network to another device. This protocol is popular amongst Mac and iPhone devices.

Raspberry Pi BalenaSound Showing on AirPlay

Within the AirPlay devices list, you can identify your Raspberry Pi by finding “balenaSound AirPlay“, followed by a unique identifier.

Connecting using Spotify Connect

Instead of using Bluetooth to connect to your Raspberry Pi’s speakers, you can also make use of Spotify.

The balenaSound software has a Spotify connect client built-in, meaning you will be able to find it listed as a possible audio output device.

balenaSound Spotify Connect Client

Like with Bluetooth, you can find your Raspberry Pi speakers by looking for “balenaSound” followed by a unique ID.

Setting up Multi-Room Audio

The balenaSound software that we are utilizing for this tutorial has built-in support for multi-room audio.

This means you can play audio to one Raspberry Pi and that audio will be synchronized to all other Pi’s on the same network.

The software running on the Raspberry Pi will automatically search for and connect to any other Raspberry Pi’s running the balenaSound operating system.

To make this work, each Raspberry Pi needs to be a device under the same application within Balena.

As a bonus, this feature works with Bluetooth, Spotify, and Airplay.

Hopefully, at this point, you will have successfully set up your Raspberry Pi Bluetooth Speaker.

If you have run into any issues with getting the balenaSound software to run on your Raspberry Pi, please drop a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

4 Comments

  1. Avatar for Gene
    Gene on

    Is there an Audio In to the RasPi? I would like to connect an older stereo and send music over Bluetooth to my headphones or remote speakers.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Gene,

      Unfortunately, the Raspberry Pi does not have an audio in, and the Raspberry Pi 5 actually does away with the audio jack entirely.

      Your best way to work around this would be to invest in a cheap USB audio dongle that supports audio in.

      Kind regards,
      Emmet

  2. Avatar for Lennart
    Lennart on

    But how do you connect speakers to the RP Zero W?

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Lenmart,

      To connect wired speakers to your Raspberry Pi Zero W you would need to look into using a HAT such as Adafruit’s I2S Audio Bonnet.

      Other option would be to use speakers that accept audio over a HDMI connection, or a device that will split the audio connection out of the HDMI feed.

      Cheers,
      Emmet