saksham2001
Posts: 20
Joined: Sat Jun 27, 2015 4:09 pm

How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:05 pm

I have tried several times but it fails to connect to my speakers! Plz help me out!!
Currently - Studying
I am a Geek ^_^
I am a 16 year old young engineer who loves working with Boards, Gadgets and other cool stuff.
Astronomy and Electronics is my Passion.

Romonga
Posts: 123
Joined: Mon May 09, 2016 7:09 pm
Location: Montgomery Il

Re: How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:08 pm

You can run, but you will only die tired.

saksham2001
Posts: 20
Joined: Sat Jun 27, 2015 4:09 pm

Re: How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:16 pm

Currently - Studying
I am a Geek ^_^
I am a 16 year old young engineer who loves working with Boards, Gadgets and other cool stuff.
Astronomy and Electronics is my Passion.

User avatar
Douglas6
Posts: 4811
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:41 pm

Actually, that Instructable is for creating an A2DP sink, not a source. You will need to install PulseAudio and pulseaudio-module-bluetooth, and then use bluetoothctl to pair and trust your Bluetooth speaker, and connect to it. That should do it.

saksham2001
Posts: 20
Joined: Sat Jun 27, 2015 4:09 pm

Re: How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:46 pm

Douglas6 wrote:Actually, that Instructable is for creating an A2DP sink, not a source. You will need to install PulseAudio and pulseaudio-module-bluetooth, and then use bluetoothctl to pair and trust your Bluetooth speaker, and connect to it. That should do it.
can you plz tell me the code to do so ??
Currently - Studying
I am a Geek ^_^
I am a 16 year old young engineer who loves working with Boards, Gadgets and other cool stuff.
Astronomy and Electronics is my Passion.

daveyman123
Posts: 115
Joined: Fri Dec 12, 2014 2:21 am

Re: How do i connect a bluetooth speaker to pi?

Wed Jun 15, 2016 7:57 pm

saksham2001 wrote:
Douglas6 wrote:Actually, that Instructable is for creating an A2DP sink, not a source. You will need to install PulseAudio and pulseaudio-module-bluetooth, and then use bluetoothctl to pair and trust your Bluetooth speaker, and connect to it. That should do it.
can you plz tell me the code to do so ??
https://www.raspberrypi.org/magpi/bluet ... erry-pi-3/

follow the tutorial here. entering the commands listed.

That should get you started with the tools you need.

Next you will want to pair the device (im assuming youre using a pi 3 and raspbian jessie), so just use the built in tool to do that on the GUI, setting your device to pair obviously.

Then you will want to open up pulseaudio again from the GUI drop down menu. From there configure the settings if its not already working.

You should be able to play youtube videos now. For me I cant do anything but play youtube videos for sound which sucks.

Hopefully this helps

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 5:38 pm

I'm desperate and I need help. I have a raspberry Pi2 that I use as a Bluetooth speaker. With my iPad or iPhone work fine. Now I bought a raspberry Pi3 and I would like to send music from the Pi3 to the old Pi2 via Bluetooth. I have installed the latest distribution debian, I follow all the instructions of this post and the ones suggested on the links, I can (I think !!!) pair and connect the PI3 with Pi2, running bluetoothctl, but on pulseaudio does not appear Pi2 as sink so I can not send music. Can someone help me? Where am I doing wrong?

:cry: :cry: :cry:

User avatar
Douglas6
Posts: 4811
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 6:20 pm

Here's the best tutorial I've seen for setting up Raspbian Jessie as an A2DP sink: https://github.com/davidedg/NAS-mod-con ... Audio5.txt

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 6:59 pm

Thanks for the reply,
I followed this tutorial, but to me it does not work. After having paired my raspberry Pi2, I get to the point that I run the command

Code: Select all

pactl list short |grep bluez
	11      module-bluez5-discover
	12      module-bluez4-discover
	13      module-bluez5-device    path=/org/bluez/hci0/dev_00_1D_DF_BE_10_4C
	1       bluez_sink.00_1D_DF_BE_10_4C    module-bluez5-device.c  s16le 2ch 44100Hz       SUSPENDED
	1       bluez_sink.00_1D_DF_BE_10_4C.monitor    module-bluez5-device.c  s16le 2ch 44100Hz       SUSPENDED
	0       bluez_card.00_1D_DF_BE_10_4C    module-bluez5-device.c
but instead to see how the tutorial, I only see

Code: Select all

pactl list short |grep bluez
	11      module-bluez5-discover
	12      module-bluez4-discover
It seems that pulseaudio does not see the connected sink.
Where did I go wrong? Some advice?

User avatar
Douglas6
Posts: 4811
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 7:39 pm

You'll need to either manually loop-back to the BlueZ device, or, better, let PulseAudio do it automatically. Add the following to the end of /etc/pulse/system.pa:

Code: Select all

load-module module-bluetooth-policy
and reboot.

Heater
Posts: 14432
Joined: Tue Jul 17, 2012 3:02 pm

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 8:13 pm

Back in the day, if I wanted sound from place A to come out in place B nearby it was just a case of a length of bell wire. Job done.
Memory in C++ is a leaky abstraction .

lumsdot
Posts: 123
Joined: Wed Mar 11, 2015 5:29 pm

Re: How do i connect a bluetooth speaker to pi?

Fri Jul 01, 2016 8:44 pm

i got my bluetooth speaker connected ok, but it was laggy.

using chromium browser , watching a youtube video or listening to online radio, there was a lag to speaker with occasionaly judders.

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 10:39 am

Hi Dauglas6,
thank, but despite attempts still does not work for me. After re installed everything again this is what I know:

Code: Select all

pi@raspberrypi:~ $ bluetoothctl
[NEW] Controller FF:FF:FF:FF:FF:F0 raspberrypi [default]
[NEW] Device B8:27:EB:00:82:2D BlueAni-00822d
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller FF:FF:FF:FF:FF:F0 Discovering: yes
[NEW] Device F4:F9:51:B9:E1:C3 F4-F9-51-B9-E1-C3
[NEW] Device 6E:96:EA:C4:90:AE 6E-96-EA-C4-90-AE
[CHG] Device B8:27:EB:00:82:2D RSSI: -57
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -77
[CHG] Device B8:27:EB:00:82:2D RSSI: -94
[CHG] Device B8:27:EB:00:82:2D RSSI: -58
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -67
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -76
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -67
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -77
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -67
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -78
[bluetooth]# scan off
[CHG] Device B8:27:EB:00:82:2D RSSI is nil
[CHG] Device 6E:96:EA:C4:90:AE RSSI is nil
[CHG] Device F4:F9:51:B9:E1:C3 RSSI is nil
Discovery stopped
[CHG] Controller FF:FF:FF:FF:FF:F0 Discovering: no
[bluetooth]# pair B8:27:EB:00:82:2D
Attempting to pair with B8:27:EB:00:82:2D
[CHG] Device B8:27:EB:00:82:2D UUIDs:
	0000110a-0000-1000-8000-00805f9b34fb
	0000110b-0000-1000-8000-00805f9b34fb
	0000110c-0000-1000-8000-00805f9b34fb
	0000110e-0000-1000-8000-00805f9b34fb
	00001200-0000-1000-8000-00805f9b34fb
	00001800-0000-1000-8000-00805f9b34fb
	00001801-0000-1000-8000-00805f9b34fb
	0fffffff-ffff-ffff-ffff-fffffffffff1
	0fffffff-ffff-ffff-ffff-fffffffffff2
Pairing successful
[bluetooth]# trust B8:27:EB:00:82:2D
Changing B8:27:EB:00:82:2D trust succeeded
[bluetooth]# connect B8:27:EB:00:82:2D
Attempting to connect to B8:27:EB:00:82:2D
Connection successful
[bluetooth]# exit
Agent unregistered
[DEL] Controller FF:FF:FF:FF:FF:F0 raspberrypi [default]
pi@raspberrypi:~ $ 
and

Code: Select all

pi@raspberrypi:~ $ pactl list short | grep bluez
11	module-bluez5-discover		
12	module-bluez4-discover		
14	module-bluez5-device	path=/org/bluez/hci0/dev_B8_27_EB_00_82_2D	
1	bluez_card.B8_27_EB_00_82_2D	module-bluez5-device.c
pi@raspberrypi:~ $
If I run command with
sudo
I have only:

Code: Select all

pi@raspberrypi:~ $ pactl list short | grep bluez
11	module-bluez5-discover		
12	module-bluez4-discover		
pi@raspberrypi:~ $
Where is the problem?

User avatar
Douglas6
Posts: 4811
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 2:14 pm

Following the guide I posted on a fresh Jessie installation has always worked for me. Sounds like you have a user instance of PulseAudio interfering with the system instance. I can only recommend that you re-install Jessie, and follow the steps in that guide exactly.

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 2:26 pm

Hi Douglas6,
from links that you have given me I have followed literally steps by starting with a new image of 27-05-2016-raspbian-jessie.img and a raspberry Pi2. I had to use a Pi3?
you're referring to another link of the guide that you have posted on a fresh Jessie installation?

Meanwhile, after some tests I have now the following issue:

Code: Select all

pi@raspberrypi:~ $ sudo bluetoothctl
[NEW] Controller FF:FF:FF:FF:FF:F0 raspberrypi [default]
[NEW] Device B8:27:EB:00:82:2D BlueAni-00822d
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller FF:FF:FF:FF:FF:F0 Discovering: yes
[NEW] Device 6E:96:EA:C4:90:AE 6E-96-EA-C4-90-AE
[NEW] Device F4:F9:51:B9:E1:C3 F4-F9-51-B9-E1-C3
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -69
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -78
[CHG] Device B8:27:EB:00:82:2D RSSI: -93
[CHG] Device B8:27:EB:00:82:2D RSSI: -55
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -69
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -77
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -68
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -78
[CHG] Device F4:F9:51:B9:E1:C3 RSSI: -68
[bluetooth]# scan off
[CHG] Device B8:27:EB:00:82:2D RSSI is nil
[CHG] Device F4:F9:51:B9:E1:C3 RSSI is nil
[CHG] Device 6E:96:EA:C4:90:AE RSSI is nil
Discovery stopped
[CHG] Controller FF:FF:FF:FF:FF:F0 Discovering: no
[bluetooth]# pair B8:27:EB:00:82:2D
Attempting to pair with B8:27:EB:00:82:2D
Request confirmation
[agent] Confirm passkey 387242 (yes/no): yes
[bluetooth]# trust B8:27:EB:00:82:2D
Changing B8:27:EB:00:82:2D trust succeeded
Failed to pair: org.bluez.Error.AuthenticationFailed
[bluetooth]#
as you ca see, now I have the issue "Failed to pair....", in addition I do not know why ask me to confirm a passkey!!!

User avatar
Douglas6
Posts: 4811
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 2:35 pm

Here's the link that I posted a few messages back: https://github.com/davidedg/NAS-mod-con ... Audio5.txt it works fine on a Pi2B with dongle.

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 2:49 pm

Hi Douglas6 again,
just now I was trying to pairing the Raspberry Pi 2 to my iPhone, and work fine, iPhone is pair and connect, and I am streaming music from my iPhone to the raspberry Pi2.

Code: Select all

[bluetooth]# pair 58:55:CA:D2:6C:3A
Attempting to pair with 58:55:CA:D2:6C:3A
[CHG] Device 58:55:CA:D2:6C:3A Connected: yes
Request confirmation
[agent] Confirm passkey 749713 (yes/no): yes
[CHG] Device 58:55:CA:D2:6C:3A Modalias: usb:v05ACp1297d0710
[CHG] Device 58:55:CA:D2:6C:3A UUIDs:
	00000000-deca-fade-deca-deafdecacafe
	00001000-0000-1000-8000-00805f9b34fb
	0000110a-0000-1000-8000-00805f9b34fb
	0000110c-0000-1000-8000-00805f9b34fb
	0000110e-0000-1000-8000-00805f9b34fb
	00001116-0000-1000-8000-00805f9b34fb
	0000111f-0000-1000-8000-00805f9b34fb
	0000112f-0000-1000-8000-00805f9b34fb
	00001132-0000-1000-8000-00805f9b34fb
	00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 58:55:CA:D2:6C:3A Paired: yes
Pairing successful
[CHG] Device 58:55:CA:D2:6C:3A Connected: no
[CHG] Device 58:55:CA:D2:6C:3A Trusted: yes
[CHG] Device 58:55:CA:D2:6C:3A Connected: yes
[CHG] Device 58:55:CA:D2:6C:3A Connected: no
[DEL] Device F4:F9:51:B9:E1:C3 F4-F9-51-B9-E1-C3
[bluetooth]#
But if I try to pair my raspberry Pi2 to another second raspberry, it not pair and failed, so I can not stream music, while in this second raspberry I can stream from my iPhone !!!

AlessandroFerri
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm

Re: How do i connect a bluetooth speaker to pi?

Sat Jul 02, 2016 3:26 pm

Hi again Douglas6,
I finally managed !!!!
Now I connect to the second raspberry, but when I run:

Code: Select all

mplayer -ao pulse Europa.wav
I hear the music from the headphones and not from the second raspberry connected via bluetooth. These are the cards that I see:

Code: Select all

pi@raspberrypi:~ $ sudo pactl list short cards
0	alsa_card.0	module-alsa-card.c
3	bluez_card.B8_27_EB_00_82_2D	module-bluez5-device.c
pi@raspberrypi:~ $ sudo pactl list short | grep bluez
11	module-bluez5-discover		
12	module-bluez4-discover		
18	module-bluez5-device	path=/org/bluez/hci0/dev_B8_27_EB_00_82_2D	
3	bluez_card.B8_27_EB_00_82_2D	module-bluez5-device.c

Return to “General discussion”