BlueWave Studio forum
Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Printable Version

+- BlueWave Studio forum (https://bluewavestudio.io/community)
+-- Forum: OpenAuto Pro (https://bluewavestudio.io/community/forum-86.html)
+--- Forum: Audio features (https://bluewavestudio.io/community/forum-63.html)
+--- Thread: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 (/thread-1589.html)

Pages: 1 2


Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Vicente77 - 04-24-2020

Hi there,

This is my first post in this forum so firstly, I would like to say hello to the community of OpenAuto users.
These are the hardware features of my system, so far

- Raspberry Pi 3B+ (16 GB 10 class mSD) [working fine]
- Official 7 inch touchscreen [working find with OpenAuto pro 7]
- Bluetooth dongle CSL - Nano Adaptador Bluetooth USB V4.0 [working fine]
- Sony Xplod BT2600 audio car system with bluetooth and hands free [working fine]
- External USB sound card (necessary only for mic, I hope) [under working]
- Raspberry PI camera [under working]

So, I would like to ask managers of this forum if someone try to do the following thing before. As well as, I would like to know their opinion about it:

I want to use the Sony Xplod as a bluetooth speakers, that thing is already easy to do with my phone, it works fine. In other words, I would like to send the music from Raspberry to the Sony Xplod via bluetooth. As far as I could read, the key to reach this goal is to configure ALSA in a way where bluetooth speakers (Sony Xplod) must be the default audio output. I guess that is something similar to what you can find in the following link:

http://mygeeks014.blogspot.com/2015/01/audio-streaming-to-bluetooth-speaker.htm

What is your opinion about this? Could I damage any feature from OpenAuto on my way to achieve this goal?

Thanks in advance


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Vicente77 - 05-03-2020

Hi Guys!!

I got it !!! Music playing on a bluetooth headphones streamed by OAP 7.0 with external usb dongle Big Grin Big Grin Big Grin Big Grin Big Grin 


This could be useful for a lot of users who already have audiocar with embedded bluetooth system installed. If it is your case no cable through the dashboard will be needed to stream music to your audiocar.

I am preparing a manual. Talk soon

Vicente


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Daniel_BlueWave - 05-03-2020

Great news Vicente. Thank you for update and contribution in our community.

We are waiting for you manualSmile


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - oliverisss - 05-10-2020

(05-03-2020, 05:39 PM)Vicente77 Wrote: Hi Guys!!

I got it !!! Music playing on a bluetooth headphones streamed by OAP 7.0 with external usb dongle Big Grin Big Grin Big Grin Big Grin Big Grin 


This could be useful for a lot of users who already have audiocar with embedded bluetooth system installed. If it is your case no cable through the dashboard will be needed to stream music to your audiocar.

I am preparing a manual. Talk soon

Vicente
Waiting for manual Smile


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Vicente77 - 05-10-2020

(05-10-2020, 05:43 AM)oliverisss Wrote:
(05-03-2020, 05:39 PM)Vicente77 Wrote: Hi Guys!!

I got it !!! Music playing on a bluetooth headphones streamed by OAP 7.0 with external usb dongle Big Grin Big Grin Big Grin Big Grin Big Grin 


This could be useful for a lot of users who already have audiocar with embedded bluetooth system installed. If it is your case no cable through the dashboard will be needed to stream music to your audiocar.

I am preparing a manual. Talk soon

Vicente
Waiting for manual Smile


Hi there,

I didn't forget the manual. I wanted to do it from a fresh flashed SD car with open auto 7 but, something is not working... I need some more time.

to be continued


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Vicente77 - 05-13-2020

Hi there,

Here it is the manual to make work a bluetooth speakers (bt-headphones or bt-audiocar) with your Open Auto Pro 7 (OAP7, hereafter).

That works for my in a fresh mSD installation of OAP 7 with the following hardware:

- Raspberry Pi 3B+ (16 GB 10 class mSD) [working fine]
- Official 7 inch touchscreen [working find with OpenAuto pro 7]
- Bluetooth dongle CSL - Nano Adaptador Bluetooth USB V4.0 [working fine]

- Bluetooth speakers

You wil need your mouse pointer to do everything much easier (another thing to include in the "user guide" guys from bluewave)
From shell command:
$ sudo bwscursor show


Run the following command
$ bluetoothctl

Your external bloutooth dongle is working fine if after it you should have something like this:
Agent registered
[bluetooth]#


type "exit" to resume the command shell

$ apt-get update
$ sudo apt-get install bluetooth bluez blueman

Check that in raspberry menu in "preferences" you have "bluetooth manager" application.
Open it and click on "search"
All bluetooth available devices will appear in the application
Turn on the Bloutooth speakers and check that you cannot pair both systems
You will get an error like this:
Connection Failed: blueman.bluez.errors.DBusFailedError: Protocol not available.

(This part of the manual comes from https://peppe8o.com/fixed-connect-bluetooth-headphones-with-your-raspberry-pi/)

Get back to the shell command
$ sudo usermod -G bluetooth -a pi
$ sudo reboot now

sudo apt-get install bluealsa pulseaudio

I don't really know if bluealsa is necessary because I will kill all that procedures related to that one later. Anyway, maybe some of the packages installed with it must be necessary for other applications (Linux dependencies could be a pain in your neck)


$ sudo systemctl status bluetooth.service

You will get some errors after the last command, so edit the following file to solve the problem:
$ sudo nano /lib/systemd/system/bluetooth.service

The file must look like this:

[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd --nonplugin=sap
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
ProtectHome=true
ProtectSystem=full

[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service


Then, reboot.
$ sudo reboot now

We will try to launch the service again:
$ sudo systemctl status bluetooth.service

and we can get something like this:
bluetooth.service - Bluetooth service
  Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
  Active: active (running) since Wed 2020-05-13 15:53:42 BST; 1min 15s ago
    Docs: man:bluetoothd(8)
Main PID: 354 (bluetoothd)
  Status: "Running"
    Tasks: 1 (limit: 1176)
  Memory: 3.1M
  CGroup: /system.slice/bluetooth.service
          └─354 /usr/lib/bluetooth/bluetoothd --noplugin=sap

May 13 15:53:41 raspberrypi systemd[1]: Starting Bluetooth service...
May 13 15:53:42 raspberrypi bluetoothd[354]: Bluetooth daemon 5.50
May 13 15:53:42 raspberrypi bluetoothd[354]: Starting SDP server
May 13 15:53:42 raspberrypi bluetoothd[354]: Excluding (cli) sap
May 13 15:53:42 raspberrypi systemd[1]: Started Bluetooth service.
May 13 15:53:42 raspberrypi bluetoothd[354]: Bluetooth management interface 1.14 initialized
May 13 15:53:42 raspberrypi bluetoothd[354]: Endpoint registered: sender=:1.9 path=/org/bluez/hci0
May 13 15:53:42 raspberrypi bluetoothd[354]: Endpoint registered: sender=:1.9 path=/org/bluez/hci0
~

Control+c to return to command shell


We will do something to ensure the system will correctly up the service after each reboot. So we will modify the following file:

$ sudo nano /lib/systemd/system/bthelper@.service

The file must look like this:

[Unit]
Description=Raspberry Pi bluetooth helper
Requires=bluetooth.service
After=bluetooth.service

[Service]
Type=simple
ExecStartPre=/bin/sleep 2
ExecStart=/usr/bin/bthelper %I

Then, reboot.
$ sudo reboot now

From command shell:
$ ps aux | grep pulseaudio

We should get something like this:
pi        996  0.0  0.0  7348  524 pts/0    S+  16:03  0:00 grep --color=auto pulseaudio



* From this point you have to stop following the link from https://peppe8o.com/fixed-connect-bluetooth-headphones-with-your-raspberry-pi/

Alsa and pulseaudio cannot be running at the same time. If you don't execute the following command you will have a noisy output in your bluetooth speaker.

$ sudo killall bluealsa

This command could be tricky because I DONT KNOW IF THIS COULD HAVE SOME NEGATIVE IMPACT ON OTHER APPLICATIONS SUCH AS ANDROID AUTO. BLUEWAVE SHOULD TALK ABOUT IT...

Now it is time to up pulseaudio service:
$ pulseaudio --start

Then you will have an error:
E: [pulseaudio] main.c: Daemon startup failed.


It took me time, but the solution comes erasing some files:
$ rm -r /home/pi/.config/pulse

(Credit for: https://bbs.archlinux.org/viewtopic.php?id=159605)

Then, reboot.
$ sudo reboot now

We have to kill bluealsa after each reboot (if I have green light from bluewave I will do that automatically but, first I want to know that this command doesn't damage any other process)

$ sudo killall bluealsa


Then we try again to start pulseaudio:
$ pulseaudio --start

And after that everything must work fine and system will answer the following thing:
N: [pulseaudio] main.c: User-configured server at {5ac1c21a15264f92a092aaf6ea586427}unix:/run/user/1000/pulse/native, which appears to be local. Probing deeper.

If you check you will see that pulseaudio is running:
$ ps aux | grep pulseaudio
ps aux | grep pulseaudio
pi        686  0.0  1.1  97252  9016 ?        S
pi        1019  0.0  0.0  7480  572 pts/0    S+  16:27  0:00 grep --color=auto pulseaudio


You can close the shell command now because the rest is going to be done graphically.

From raspberry menu, in "preferences", open "bluetooth manager". Then turn on your bluetooth speakers and pair them from bluetooth manager. If everything is fine the bluetooth speakers will let you know that the connection was done successfully.

Last step is to stream music. So, copy your favorite song in a memory stick, connect it to the raspberry and play it with the reproducer that OAP7 includes (Music-->Storage and then surf on /media/pi folder to find your song)   

Enjoy ;-)   

PS. More improvements could be done but, first I need to know if  $ sudo killall bluealsa will have unexpected aftermaths... guys from bluewave, what is your take?


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Daniel_BlueWave - 05-14-2020

bluealsa is used to controlling bluetooth on RPI. Does the BT work with your phone after those changes (HFP, A2DP)?


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Vicente77 - 05-14-2020

(05-14-2020, 07:52 AM)Daniel_BlueWave Wrote: bluealsa is used to controlling bluetooth on RPI. Does the BT work with your phone after those changes (HFP, A2DP)?

Hi there,

I didn't try yet. What applications could be affected? Could you give me a list to try? Let's go to do some report about it.

By the way, the music reproducer included in OAP7, is that an skin for VLC? I am thinking that if it is like that, the calling to VLC could be done specifying what audio controller should be used. That is an option in VLC.

Cheers


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - vchief64 - 05-14-2020

Hi Vicente77,
thanks for your work on this and sharing the manual.
I worked pretty much on the same subject.

I have a question for BlueWave: Why did you install pulseaudio under /usr/local?
Why didn't you use the official build?

Following you manual, there will be 2 pulseaudios on the system, with all the different configs.
Why is this necessary?

Cheers & Thanks again


RE: Send music via bluetooth from OAP(external dongle) to audiocar SONY Bloutooth BT2600 - Felow427 - 01-19-2021

Hi, 

any feedback on this thread?

I'm in the situation where I can't use any aux input to send audio to the audio car system.

I would like to use OAP 12 and AA with my phone, and send audio from AOP to audio car system with Bluetooth.

Is there any change that the in built RPI bluetooth can be enabled and connected to the audio car system with the external BT dongle connected with the phone?