EULERPI
Posts: 51
Joined: Sun May 15, 2016 2:44 pm

Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 10:49 am

Does anyone know how to enable a Bluetooth speaker automatically on starting a Pi 3 using the latest version of Raspbian?.

I can select my Bluetooth speaker with the mouse using the audio function on the taskbar but I would like to run a Pi 3 headless taking info in via the GPIO and playing an appropriate sound remotely to a Bluetooth speaker.

Many thanks.

Nik

toyamigo
Posts: 13
Joined: Tue Sep 11, 2012 8:50 am

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 3:41 pm

I did it in RetroPie, in raspi-config but it's the same in Raspbian...
Worked for me.
Good luck!
https://www.raspberrypi.org/documentati ... -config.md

EULERPI
Posts: 51
Joined: Sun May 15, 2016 2:44 pm

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 4:24 pm

Are you referring to amixer cset numid=3 x?.

I tried various numbers for x above 2 (HDMI) but amixer doesn't seem to accept them and the Audio output doesn't change to Bluetooth.

Regards

Nick

toyamigo
Posts: 13
Joined: Tue Sep 11, 2012 8:50 am

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 4:28 pm

And if you go to raspi-config, select option 8 Advanced Options and press Enter, then select Option A6: Audio and press Enter?
There you can select the analoge...
Good luck,
Tony

EULERPI
Posts: 51
Joined: Sun May 15, 2016 2:44 pm

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 4:57 pm

That doesn't seem to select Bluetooth.

Its probably a misunderstanding on my part, I would like to connect to my Bluetooth speaker over Bluetooth.

Regards

Nick

toyamigo
Posts: 13
Joined: Tue Sep 11, 2012 8:50 am

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 5:02 pm

Ahhhhh...sowwy..my fault..I connected my bluetooth speaker through the analoge port, so without bluetooth.
Following link explains how to connect a speaker but it's a pain in the a@@ so I didn't spent too much time on it.
https://www.raspberrypi.org/magpi/bluet ... erry-pi-3/
Grts,
Tony

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

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Thu Oct 06, 2016 6:41 pm

I haven't played with a Bluetooth speaker much, but my understanding is that if a speaker is connected, PulseAudio will start using it for audio. So the trick is to connect it at boot time. Should be able to use the same trick some folks use with keyboards. Put this in your cron tab:

Code: Select all

@reboot sleep 10 && /bin/echo -e 'connect XX:XX:XX:XX:XX:XX\nquit\n' | bluetoothctl

EULERPI
Posts: 51
Joined: Sun May 15, 2016 2:44 pm

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Fri Oct 07, 2016 11:06 am

Douglas6 wrote:I haven't played with a Bluetooth speaker much, but my understanding is that if a speaker is connected, PulseAudio will start using it for audio. So the trick is to connect it at boot time. Should be able to use the same trick some folks use with keyboards. Put this in your cron tab:

Code: Select all

@reboot sleep 10 && /bin/echo -e 'connect XX:XX:XX:XX:XX:XX\nquit\n' | bluetoothctl
Many thanks.

I've discovered that my Bluetooth speaker wont connect if the speaker is turned on to connect before the Pi 3 has booted.

Also if I connect manually using Bluetoothctl I still don't get any sound out until I've also selected the Bluetooth speaker from the audio icon on the PIXEL taskbar.

So I think I need a way to discover that the speaker is ready to connect, then connect and also then select the speaker from the audio interface.

All the above is using the latest version of Raspbian (with PIXEL).

Regards

Nick

EULERPI
Posts: 51
Joined: Sun May 15, 2016 2:44 pm

Re: Enable a Bluetooth Speaker on startup (latest Raspbian)

Sun Nov 06, 2016 5:44 pm

Is there a way to control selecting a Bluetooth speaker normally selected from the Raspbian Audio part of the Taskbar using a script?.

That should enable me to connect to a Bluetooth speaker automatically (I'd like to use the spare capacity of a Pi3 without keyboard/mouse being used for Model Railway control to play audio remotely via a Bluetooth speaker). So I need to select the Bluetooth speaker without the use of a keyboard or mouse.

Regards

Nick

Return to “Advanced users”