Thursday, March 28, 2024

Raspberry Pi Bluetooth Speaker Audio Streaming System

Ashwini Kumar Sinha

- Advertisement -

AshwaniMaking Raspberry Pi Bluetooth Speaker and Streaming audio from mic directly to speakers is difficult when we do not have a Bluetooth mic and a sound system. So today we are going to learn some hacks that will help you to stream audio directly to Raspberry Pi. It acts as a wireless Bluetooth speaker and a sound sink. This sound system can stream sound directly to the speaker, can take live audio mic input from your phone and directly make it audible on speakers.

Here are some common features of the Raspberry Pi Bluetooth Speaker:

  • Acts as a wireless Bluetooth speaker. 
  • Takes audio from your phone mic and plays it directly on the speaker.Here your phone acts as a wireless Bluetooth mic and Raspberry Pi as a wireless speaker.
  • Can stream live music from youtube and play music from your music gallery

What we need :-

- Advertisement -

One Raspberry Pi that has built-in Bluetooth and WiFi (Version 3 or up).

The RPi board that we have used here takes the audio from the Bluetooth audio source and then sinks (transfers) it into its own analogue out pin that is the TRRS pin. The audio coming out of the TRRS pin is weak and not audible. So, we need to amplify that sound signal. Here we have used a PAM amplifier module that amplifies the signal. We take the audio output of the Raspberry Pi using an aux cable and then connect it to the PAM amplifier’s audio input pins. This results in an amplified sound over RPi’s output pins.

Bill Of MaterialsRaspberry Pi Audio Streaming System

Connections

Raspberry Pi Bluetooth Speaker
Fig 2 .Connections

Setting Up

Assuming that you have already installed the latest Raspbian OS in the Raspberry Pi and have access to its desktop window, open the linux terminal and then start installing the BlueZ in it using the given syntax (Refer  Fig 3,4,5).

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.43.tar.xz

tar xvf bluez-5.43.tar.xz

Raspberry Pi Audio setting
Fig 3
Installing Bluez in Raspberry Pi
Fig 4

Now let’s do some setup as given in the pic. First, click on the Bluetooth icon and make it discoverable. Next, go to pair new device. After that pair the device from which you want to stream audio. Here I want to stream my audio to Raspberry Pi for which I am going to pair my smartphone. 

Next, go to the sound icon and right-click that. Then, go to its audio inputs section and select the device from which you need the audio to be streamed. Since I am using my phone, I have selected the phone as input.You can check here for reference.

Now go to the audio output and select the analogue option to listen to the audio on the speaker that you have connected.

Raspberry Pi Bluetooth Setting
Fig 6.

Now play any song/stream any audio on your phone.You will start to get sound on RPi. 

Congrats !!  Your wireless, portable Bluetooth speaker is ready.

Audio Setting
Fig 7.
Raspberry Pi audio Source setting
Fig 8.
audio sink setting
Fig 9.

What Next ?

Wireless Bluetooth based PA system

Now let’s make a Bluetooth-based wireless mic system where we will use our phone as a wireless mic and stream audio to RPi to hear in real-time.

First of all, we will install an app in our Android phone so that it converts our phone into a mic. To do so, open the playstore and then search for a phone as mic. Install any app that has this function. Here I am installing this app. Refer ( Fig 10).

Audio stream from mic

Now open the app and start streaming your sound live to RPi. 

Congrats!! Your wireless Bluetooth-based mic and speaker is ready.

 

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators