Page 1 of 1

Enable a Bluetooth Speaker on startup (latest Raspbian)

Posted: Thu Oct 06, 2016 10:49 am
by EULERPI
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

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

Posted: Thu Oct 06, 2016 3:41 pm
by toyamigo
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

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

Posted: Thu Oct 06, 2016 4:24 pm
by EULERPI
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

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

Posted: Thu Oct 06, 2016 4:28 pm
by toyamigo
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

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

Posted: Thu Oct 06, 2016 4:57 pm
by EULERPI
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

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

Posted: Thu Oct 06, 2016 5:02 pm
by toyamigo
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

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

Posted: Thu Oct 06, 2016 6:41 pm
by Douglas6
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

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

Posted: Fri Oct 07, 2016 11:06 am
by EULERPI
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

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

Posted: Sun Nov 06, 2016 5:44 pm
by EULERPI
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