Raspberry Pi Bluetooth Speaker

From Alpine Linux

How To Build a Raspberry Pi Bluetooth Speaker

This articles describes how to build a Bluetooth speaker. This article is being actively written.

Before You Start

You’ll need:

  • A Raspberry Pi
  • A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)
  • An active speaker or sound card and passive speaker(s)

Getting the Speaker(s) Working

The audio hardware can range from using the Raspberry Pi's on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.

I'm testing this using Raspberry Pi's excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.

Once the speaker(s), and possibly amplifier, are wired into the Pi, it's time to install a fresh version of Alpine Linux. The armv7 version from the Downloads page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.

Enable writing to the boot media:

 mount /media/mmcblk0p1 -o rw,remount

Then either enable the on board sound:

 echo "dtparam=audio=on" >> /media/mmcblk0p1/usercfg.txt

or your fancier sound card (e.g. IQaudIO):

 echo "dtoverlay=iqaudio-dacplus,unmute_amp" >> /media/mmcblk0p1/usercfg.txt

and then reboot your Pi.

Follow these instructions to enable ALSA. In summary

 apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound
 aplay -l # should display a List of PLAYBACK Hardware Devices

In my case my list is:

 **** List of PLAYBACK Hardware Devices ****
 card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
   Subdevices: 8/8
   Subdevice #0: subdevice #0
   Subdevice #1: subdevice #1
   Subdevice #2: subdevice #2
   Subdevice #3: subdevice #3
   Subdevice #4: subdevice #4
   Subdevice #5: subdevice #5
   Subdevice #6: subdevice #6

If you issue this command:

 speaker-test -t wav -c 2

Then you should hear "Front Left, Front Right" repeating from your chosen speakers. Now it's time to setup Bluetooth. Don't forget to save your changes (lbu commit) before moving on.

Doing Something Title

Write the steps of how to do something in this section. If possible, show an example first, then tell your readers the steps. Break this procedure into separate procedures to avoid more than about 7-9 steps per procedure.

INSERT GREAT EXAMPLE HERE
  1. Answer the following three questions, at least in your head.
    1. What do I explain how to do?
    2. How do I do that?
    3. What do HOWTO readers already know about doing that?
  2. Write up a good example. This ensures you can do it.
  3. Write up the steps to do it.
  4. Write the background info/prerequisites readers need.
  5. Write the summary.
  6. Clean up your work.
  7. Revise, revise, revise.

See Also

Raspberry Pi's blog on How to play sound and make noise with your Raspberry P

There are lots of speaker and amplifier options: