Bluetooth

From Wildsong
Jump to navigationJump to search

Inventory

Using an ESP32 as a scanner,

Apparently the addresses change but manufacturer data does not.

Plover: Advertised Device: Name: , Address: 6e:35:7c:f6:35:8e, manufacturer data: 4c0010055118f70ddb

Julie: Advertised Device: Name: Charge 3, Address: e0:75:52:dc:71:d3, serviceUUID: adabfb00-6e7d-4601-bda2-bffaa68956ba, txPower: 3

Julie: Advertised Device: Name: Charge 2, Address: f1:fa:1e:dc:4b:08, serviceUUID: adabfb00-6e7d-4601-bda2-bffaa68956ba, txPower: 5

Devices found: 9
Device: Name: Charge 2, Address: f1:1d:85:35:b5:00, serviceUUID: adabfb00-6e7d-4601-bda2-bffaa68956ba, txPower: 5 
Device: Name: , Address: 54:f0:ef:f9:b1:01, manufacturer data: 4c0010050118be9afa, txPower: 24 
Device: Name: , Address: cc:6e:a4:43:92:02, manufacturer data: 75004204018060cc6ea4439202ce6ea443920101000000000000 
Device: Name: , Address: 00:7c:2d:bc:b5:f4, manufacturer data: 75004204018060007c2dbcb5f4027c2dbcb5f301000000000000 
Device: Name: , Address: 58:4c:b1:ce:fe:5b, manufacturer data: 4c0010054b1c9229d4 
Device: Name: , Address: 4a:e3:21:dd:93:c4, manufacturer data: 4c001006571e3386cb9f, txPower: 12 
Device: Name: Charge 3, Address: e0:75:52:dc:71:d3, serviceUUID: adabfb00-6e7d-4601-bda2-bffaa68956ba, txPower: 3 
Device: Name: , Address: 4c:c3:2f:0d:44:ed, manufacturer data: 4c0010060b1e72ad71f2, txPower: 7 
Device: Name: ESYB E4:FD          , Address: 44:a6:e5:1f:fa:fd, serviceUUID: 00001000-0000-1000-8000-00805f9b34fb, txPower: 0 

Profiles

Full list of profiles: https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles

A2DP = audio HSP = headset profile AVRCP = remote control

Bluetooth 2.x

I have a module that does TTL serial <-> bluetooth, played with it a few times. Way back then I paid $65 for it, yipes yipes!

EDR = extended data rate

There are $4-6 modules that do basic Bluetooth - serial conversion.

HC-05 based : Master or slave: http://www.banggood.com/HC-05-Wireless-Bluetooth-Serial-Transceiver-Module-Slave-And-Master-p-908621.html

HC-06 based Slave only: http://www.banggood.com/HC-06-Wireless-Bluetooth-Transceiver-RF-Main-Module-Serial-For-Arduino-p-80364.html

Stereo audio + UART: The UART is for programming the module, not for SPP http://www.banggood.com/Mini-XS3868-Bluetooth-Stereo-Audio-Module-OVC3860-For-A2DP-AVRCP-p-932285.html See https://hackaday.io/project/2273-integrating-the-xs3868-bluetooth-module

Bluetooth Low Energy (BLE)

aka Bluetooth 4.0

These modules have gotten so cheap it's almost scary.

Fun article: http://www.instructables.com/id/BluTag/

They use a $59 LinkIt One, http://www.seeedstudio.com/depot/LinkIt-ONE-p-2017.html which is a complete ARM based card that has GPS, Bluetooth and BLE, WIFI, even GSM, basically it's a cellphone with no case.

They also use a TTL - BLE module that's about $4. http://www.banggood.com/HM-10-CC2541-CC41-Bluetooth-4_0-UART-Transceiver-Serial-Module-p-955689.html

Bluetooth on Bellman

Objective: run Squeezebox server and send its audio stream to bluetooth speakers or headset.

First make the Bluetooth work. Install packages.

apt install bluez-tools bluez blueman rfkill
apt install pulseaudio pulseaudio-module-bluetooth pavucontrol

Make sure BT hardware is visible and available; looks good.

lsusb
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
sudo rfkill list
0: hci0: Bluetooth
       Soft blocked: no
       Hard blocked: no
sudo -s
bluetoothctl scan on
Discovery started
[CHG] Controller 00:01:95:11:C3:E3 Discovering: yes
[NEW] Device 28:11:A5:13:54:2F 28-11-A5-13-54-2F
[CHG] Device 28:11:A5:13:54:2F RSSI: -53
[CHG] Device 28:11:A5:13:54:2F RSSI: -44
[CHG] Device 28:11:A5:13:54:2F RSSI: -53
[CHG] Device 28:11:A5:13:54:2F RSSI: -41
[CHG] Device 28:11:A5:13:54:2F LegacyPairing: no
[CHG] Device 28:11:A5:13:54:2F Name: Bose Mini II SoundLink
[CHG] Device 28:11:A5:13:54:2F Alias: Bose Mini II SoundLink
[CHG] Device 28:11:A5:13:54:2F LegacyPairing: yes
sudo bluetoothctl
Agent registered
[bluetooth]# agent on
Agent is already registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:01:95:11:C3:E3 Discovering: yes
[CHG] Device 28:11:A5:13:54:2F RSSI: -37
[CHG] Device 28:11:A5:13:54:2F RSSI: -46
[CHG] Device 28:11:A5:13:54:2F RSSI: -36
[bluetooth]# pair  28:11:A5:13:54:2F
Attempting to pair with 28:11:A5:13:54:2F
[CHG] Device 28:11:A5:13:54:2F Connected: yes
Request PIN code
[agent] Enter PIN code: 0000
[CHG] Device 28:11:A5:13:54:2F Modalias: bluetooth:v009Ep4009d0114
[CHG] Device 28:11:A5:13:54:2F UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 28:11:A5:13:54:2F UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 28:11:A5:13:54:2F UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 28:11:A5:13:54:2F UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 28:11:A5:13:54:2F UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 28:11:A5:13:54:2F ServicesResolved: yes
[CHG] Device 28:11:A5:13:54:2F Paired: yes
Pairing successful
[CHG] Device 28:11:A5:13:54:2F ServicesResolved: no
[CHG] Device 28:11:A5:13:54:2F Connected: no

At this point I need to start pvaucontrol which is an X client. So I need a Mac or to know how to run X on Windows in the year 2019. I am trying Cygwin/X. Installing now.

Using X11 on Windows 10

Install Cygwin with X11 packages including xinit xorg-server xterm and xlaunch

Connnecting to the Bose speaker, later on

Run xlaunch and select multiple windows and tell it to launch xterm.

In the xterm window,

ssh -Y bwilson@bellman

Push the bluetooth pairing button on the bluetooth speaker to wake it up.

In the xterm window use bluetoothctl

Enter the connect command,

connect 2 (tab)

The speaker should say "Connected to bellman".

Rejoice!

Now you can run pavucontrol. You should be able to see the speaker.

Now you should be able to run vlc on Bellman and play anything in /home/music

Now for the Squeezebox thing. I need a client to run on Bellman that will be visible to the Logitech Media server running on port 9000.

I eneded up using squeezelite from the Debian repostory. I was able to run pavucontrol by installing Cygwin/X on Murre and then running xterm in a window and using ssh -Y bellman. Then run pavucontrol in that shell. It opens on the Windows 10 screen. Likewise if I run anything there for example vlc it will open on the Windows 10 machine.

I ended up running squeezelite as myself since I had access to bluetooth and sound devices. I can control the output via Logitech Mediaserver

I used the synchronize option to sync the red box and Bellman and have audio come out on the Bose speakers. Syncing them means the red box can be used to control the output of the speakers.