Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Bluetooth troubles

Tue Jun 30, 2020 8:21 pm

Greetings to those who have stumbled across this post,

Before we can kick things off, Ill give some much needed context. For this project, I am using an ESP32 to relay data (readings from a magnetic hall sensor) to a raspberry pi for data recording. I know for a fact that the ESP is broadcasting data, as I can read the data values on LightBlue (On a mobile device). The ESP is discoverable on the Pi (3b+) but cannot pair due to an error which is "No usable services on this device."

I have tried:

adding -c and an adtional line to the dbus-org.bleuz.service file

connecting/ paring and trusting the device through bluetoothctl

A fresh install of Raspberry Pi OS (32-bit) with desktop (Kernel 4.19)

Any help would be appreciated!

Yours Truly,
-Artimis11

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

Re: Bluetooth troubles

Tue Jun 30, 2020 10:33 pm

Light blue is a BLE app, no? Is the ESP32 transmitting BLE or classic Bluetooth SPP? Bjg difference, in terms of reading the results. Research the difference.

PhatFil
Posts: 1665
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Bluetooth troubles

Tue Jun 30, 2020 11:47 pm

try a "sudo hcitool lescan" command and see if your esp32 device shows up in the scanned list.

if not its not advertising itself as a BLE device or is outside your pi's range

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Wed Jul 01, 2020 12:21 am

Douglas6 wrote:
Tue Jun 30, 2020 10:33 pm
Light blue is a BLE app, no? Is the ESP32 transmitting BLE or classic Bluetooth SPP? Bjg difference, in terms of reading the results. Research the difference.
The ESP is using BLE libraries for transmitting the data

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Wed Jul 01, 2020 12:23 am

PhatFil wrote:
Tue Jun 30, 2020 11:47 pm
try a "sudo hcitool lescan" command and see if your esp32 device shows up in the scanned list.

if not its not advertising itself as a BLE device or is outside your pi's range
Oddly enough the device does not show up on the listings for hcitool lescas, but does show up under the scan for bluetoothctl. Perhaps its an issue ESP side rather than Pi side?

PhatFil
Posts: 1665
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Bluetooth troubles

Wed Jul 01, 2020 3:10 am

Artimis11 wrote:
Wed Jul 01, 2020 12:23 am
PhatFil wrote:
Tue Jun 30, 2020 11:47 pm
try a "sudo hcitool lescan" command and see if your esp32 device shows up in the scanned list.

if not its not advertising itself as a BLE device or is outside your pi's range
Oddly enough the device does not show up on the listings for hcitool lescas, but does show up under the scan for bluetoothctl. Perhaps its an issue ESP side rather than Pi side?

try restarting both esp and pi to reset and try again.. also check your phone app and its settings to confirm the coms protocols used as what you report suggests that your esp is not advertising as a BLE device but is responding as a more traditional b/tooth device?
Well thats where i would start..

here is a useful ble reference bookmark http://www.raspberry-pi-geek.com/Archiv ... (offset)/4

youtuber Andreas Spiess (probably got that very wrong) aka "Swiss Accent Guy" has a few vids on esp32 and b/tooth

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Wed Jul 01, 2020 4:41 pm

PhatFil wrote:
Wed Jul 01, 2020 3:10 am
Artimis11 wrote:
Wed Jul 01, 2020 12:23 am
PhatFil wrote:
Tue Jun 30, 2020 11:47 pm
try a "sudo hcitool lescan" command and see if your esp32 device shows up in the scanned list.

if not its not advertising itself as a BLE device or is outside your pi's range
Oddly enough the device does not show up on the listings for hcitool lescas, but does show up under the scan for bluetoothctl. Perhaps its an issue ESP side rather than Pi side?

try restarting both esp and pi to reset and try again.. also check your phone app and its settings to confirm the coms protocols used as what you report suggests that your esp is not advertising as a BLE device but is responding as a more traditional b/tooth device?
Well thats where i would start..

here is a useful ble reference bookmark http://www.raspberry-pi-geek.com/Archiv ... (offset)/4

youtuber Andreas Spiess (probably got that very wrong) aka "Swiss Accent Guy" has a few vids on esp32 and b/tooth
After restarting both the PI and ESP, I was able to find the ESP using the lescan command. I think the issue was that it was "Paired" with the pi, hence why it did not show up

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Thu Jul 02, 2020 12:35 am

However, upon disconnecting and connecting through the bluetooth UI, It still reads off "No services available" Is it only possible to connect through the bluetoothctl command line?

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

Re: Bluetooth troubles

Thu Jul 02, 2020 12:50 am

You can nuse bluetoothctl or gatttool to communicate with a BLE device. You can use the Bluepy Python library, or you can modify the BlueZ Python sample oode at https://github.com/bluez/bluez/blob/mas ... att-client.

PhatFil
Posts: 1665
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Bluetooth troubles

Thu Jul 02, 2020 1:53 am

Artimis11 wrote:
Thu Jul 02, 2020 12:35 am
However, upon disconnecting and connecting through the bluetooth UI, It still reads off "No services available" Is it only possible to connect through the bluetoothctl command line?
I dont follow, are you trying to see data advertised by ble from a paired device?

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Thu Jul 02, 2020 3:15 am

PhatFil wrote:
Thu Jul 02, 2020 1:53 am
Artimis11 wrote:
Thu Jul 02, 2020 12:35 am
However, upon disconnecting and connecting through the bluetooth UI, It still reads off "No services available" Is it only possible to connect through the bluetoothctl command line?
I dont follow, are you trying to see data advertised by ble from a paired device?
Pardon my misuse of terminology. The advertised data works just fine. What I am looking for is the ability to read the read/notified/indicated values. (output from the sensor). I can connect and pair to the Pi through bluetoothctl just fine. However, if I were to do this using the desktop icon for bluetooth, I get the issues of "No usable services on this device"

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

Re: Bluetooth troubles

Thu Jul 02, 2020 3:25 am

Artimis11 wrote:
Thu Jul 02, 2020 3:15 am
However, if I were to do this using the desktop icon for bluetooth, I get the issues of "No usable services on this device"
The GUI is only interested in a few classic Bluetooth profiles ; AD2P, HID, SPP. It has no knowledge of BLE. That message confuses a number of users. Ignore it.

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Thu Jul 02, 2020 4:27 am

Douglas6 wrote:
Thu Jul 02, 2020 3:25 am
Artimis11 wrote:
Thu Jul 02, 2020 3:15 am
However, if I were to do this using the desktop icon for bluetooth, I get the issues of "No usable services on this device"
The GUI is only interested in a few classic Bluetooth profiles ; AD2P, HID, SPP. It has no knowledge of BLE. That message confuses a number of users. Ignore it.
Ah! good to know. is there a way using gatttools and or bluetoothctl to confirm that the pi is receiving data from the ESP?

PhatFil
Posts: 1665
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Bluetooth troubles

Thu Jul 02, 2020 4:45 am

All depends on the tools you choose to use, BLE isnt like most coms protocols where a connection is established and you 'talk' according to the 'rules' like on a phone call.
Its more yell into the dark and if your within range and get heard you might get a response telling you how to shout next if you are also within transmission range..

its all basic steps just a few more of them peculiar to ble ;) and what exactly you do depends on your approach which may depend on your goals.

myself at about this point in your journey went with node red and node.js

but once you decide on tools Python perhaps you can look for a how to type guide that suits your needs

like https://shawnhymel.com/665/using-python ... e-rfduino/
or https://dzone.com/articles/using-python ... le-devices
perhaps?

Artimis11
Posts: 8
Joined: Tue Jun 30, 2020 8:11 pm

Re: Bluetooth troubles

Sun Jul 05, 2020 11:11 pm

PhatFil wrote:
Thu Jul 02, 2020 4:45 am
All depends on the tools you choose to use, BLE isnt like most coms protocols where a connection is established and you 'talk' according to the 'rules' like on a phone call.
Its more yell into the dark and if your within range and get heard you might get a response telling you how to shout next if you are also within transmission range..

its all basic steps just a few more of them peculiar to ble ;) and what exactly you do depends on your approach which may depend on your goals.

myself at about this point in your journey went with node red and node.js

but once you decide on tools Python perhaps you can look for a how to type guide that suits your needs

like https://shawnhymel.com/665/using-python ... e-rfduino/
or https://dzone.com/articles/using-python ... le-devices
perhaps?
Thank you for the help! I ended up using node.js and Node Red to get things working!

Return to “Troubleshooting”