Bluetooth Audio with headless img

204 views
Skip to first unread message

John Paul Parkins

unread,
Apr 14, 2021, 7:03:11 PM4/14/21
to PicoChess
Hi All, 

Hope everyone is doing well,

I am struggling to get my Anker SoundCore Bluetooth speaker working on the PicoChess v3 lite image but does work with the desktop image. I wanted to avoid using the desktop image on Pi3 due to resources. I also have a few Pi3s I would like to use up.

The issue covered hear before:


So far I have managed to get my speaker connected using this tutorial I found hear:


I have managed to pair and connect to my speaker and all looks good. As far as Bluetooth is concerned the speaker reconnects automatically on reboots and behaves as expected, unfortunately when I run (using my speaker address of coarse):

aplay -D bluealsa:DEV=00:25:DB:78:86:98,PROFILE=sco test.wav

the command appears to execute without error but no sound.

Running:

pacmd list-cards

or

pacmd list-sinks

does not show the speaker registered in the system which is concerning. This means I am not able to select it as a default sink/sound card

I did also try disabling the onboard audio in

/boot/config.txt

dtparam=audio=off

I did not expect to work as the speaker was not registering as an audio sink or sound card.

Do anyone have any advice?

Thanks

JP





 

John Paul Parkins

unread,
Apr 15, 2021, 12:40:53 PM4/15/21
to PicoChess
All, 

I have made some progress but its painful.


sudo apt-get install bluealsa pulseaudio 

I was not having much luck with this as the bluetooth speaker was not being seen as an audio sink, but I tried using this instead:

sudo apt-get install bluez pulseaudio pulseaudio-module-bluetooth

and manged to see the  bluetooth speaker as an audio sink with PulseAudio. I even managed to play a test file. Unfortunately that's where things stopped progressing.

Using pulseaudio-module-bluetooth instead of bluealsa does give me some test audio but PulseAudio does not survive a reboot. I did add PulseAudio to /etc/rc.local which worked but not ideal as PulseAudio does have a mechanism for starting automatically. bluetoothctl connect 00:25:DB:78:86:98 needs PulseAudio to be running to start. If the bluetooth speaker power off/times out PulseAudio stops and needs to be started so that bluetoothctl connect 00:25:DB:78:86:98 can connect :-(

Even when I manually connect to the speaker I still have not worked out how to route the audio from PicoChess to the speaker.

pacmd set-default-sink bluez_sink. 00:25:DB:78:86:98.a2dp_sink

did not work :-(

Am I wasting my time?

Thanks JP

Scally

unread,
Apr 15, 2021, 2:08:33 PM4/15/21
to PicoChess
Hi JP,

I’m sorry I can’t help you, I’ve only got a plug in speaker.

Soon I hope to have an internal speaker and mini amp inside my “Scally Pi”, I’m just waiting on the post …


Al.

RandyR

unread,
Apr 15, 2021, 2:27:19 PM4/15/21
to PicoChess
JP,

Perhaps an option is to set it up in the Desktop version, then change the default run-level to multi-user.target:

systemctl set-default multi-user.target

If everything is working, you could remove what you don't need, but I suspect you won't be using many resources:

sudo apt remove raspberrypi-ui-mods xinit xserver-xorg

I can't guarantee that will workby itself, though. You might also want to disable the VNC server and change the /etc/systemd/system/picochess.service file to match the Lite version.

It would be nice if you could figure it out. I'm almost tempted to get a BT speaker myself just to test.

Randy

John Paul Parkins

unread,
Apr 15, 2021, 2:33:09 PM4/15/21
to PicoChess

Hi Al, 

It was a long shoot really, was up till 4 this morning trying to get it to working.

Your internal speaker and mini amp sounds great, good luck with that.

JP

John Paul Parkins

unread,
Apr 15, 2021, 3:32:42 PM4/15/21
to PicoChess
Randy,

Just gave that a go and its breaks Bluetooth. Speaker no longer connects automatically, tried manually connecting with: 

sudo bluetoothctl connect 00:25:DB:78:86:98

and it returns:

Attempting to connect to 00:E0:4C:9E:5E:40
Failed to connect: org.bluez.Error.Failed

which is the same error I got with the lite version. I had to manually start PulseAudio for Bluetooth to connect but PicoChess audio is not piped through. This is the exact same issues and behaviour I had with the lite version. 

I did notice Bluetooth related orphaned packages after running:

sudo apt remove raspberrypi-ui-mods xinit xserver-xorg

which I cleaned up with:

sudo apt autoremove

Sadly this has not worked. There is clearly something else at play here, something with the audio mixer maybe and BlueZ. Thought I cracked it when I got test audio running. So close. 

JP

RandyR

unread,
Apr 15, 2021, 4:18:49 PM4/15/21
to PicoChess
That's very frustrating. One other thought - you could download the latest Lite image of Raspberry Pi OS and see if you can get it working in that environment. Maybe there is something off in the way I set up my Lite image. The Desktop image is based on it, though (as opposed to the downloadable RPiOS Desktop image).

Something to note when you are testing, start and stop picochess using the service rather than picochess.py:

sudo service picochess stop
sudo service picochess start

Picochess will use the default audio output device which you probably already realized. The images are set up with picochess running as root, since when using the DGTPi, the dgtpicom.so file, which talks directly to the processor, needs root access. If you aren't using a DGTPi, or a wired clock, you could try running everything as the pi user. You'd have to change the picochess folder to pi as the owner:group.

Randy

John Paul Parkins

unread,
Apr 16, 2021, 8:08:55 AM4/16/21
to PicoChess
Randy,

Useful information, thanks

I have been using service to control PicoChess and I am using a DGT3000 connected via the i2c.

If I have any breakthroughs I will report back hear.

JP

RandyR

unread,
Apr 27, 2021, 4:32:13 PM4/27/21
to PicoChess
Hi JP,

I was able to set up the Lite image to use a bluetooth speaker (Anker Soundcore Boost). If you or anyone else wants the procedure, see the attached text file. In a nutshell, you need PulseAudio installed. It may be possible with ALSA alone, but I didn't have any success (and you would also probably need DMIX when using MAME engines that have sound).

Hope this helps. It should work the same for BT headphones.

Randy

BT Speaker Lite PulseAudio.txt

John Paul Parkins

unread,
Apr 29, 2021, 8:19:56 AM4/29/21
to PicoChess
Nice guide Randy, 

Will give that a go later. 

Thanks

JP

Reply all
Reply to author
Forward
0 new messages