BLE dongles not detecting all Metawear devices
Hi!
I am trying to set up multiple BLE to USB dongles on a raspberry pi running Raspbian.
I bought the BLE to USB dongle from the mbientlab website and it successfully shows up as an hci device.
hci 0 and hci 1 are the BLE to USB dongles and hci 2 is the native onboard bluetooth on the raspberry pi.
The issue I am having is that the BLE dongles do not detect all the available metawear devices.
When I run lescan on hci2 (the onboard bluetooth) it discovers 6 metawear devices.
However when I run lescan on hci 0 and hci 1 (BLE to USB dongles), it only detects one metawear device.
I ran lescan multiple times and have found that the dongles can detect different metawear devices, but each time lescan is run, it will detect only one metawear device.
This causes an issue, because I am never sure at a given time which metawear device the dongle can detect.
I am letting lescan run for over 10 seconds before I terminate the program.
Also, all the metawear devices are within one foot of the raspberry pi, so distance should not be the issue.
I am wondering if this is a hardware issue (in which case I will purchase other brands of dongles)
or if this is a software issue and there is something wrong with a package that I have installed.
Thanks,
Sam
Comments
Possibly related:
https://mbientlab.com/community/discussion/comment/8618
BLE data transfer is essentially a one-way communication. A Bluetooth Low Energy device broadcasts ad packets of data at regular intervals of time. These data packets are detected by smartphones/computers nearby.
To save energy and provide higher data transfer speed, the entire BLE communication framework consists of 40 frequency channels, separated by 2MHz. 3 of these channels are the primary advertisement channels while the remaining 37 channels are secondary channels, also known as data channels. The Bluetooth communication starts with the 3 primary advertisement channel and then offloads to the secondary channels.
As you can see, advertising and scanning are very timing and channel sensitive and therefore "opportunistic" in nature. It could take several advertisements from one sensor before that very same sensor is discovered by the computer/smartphone.
There is a great tutorial on this here: http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_2_40_03_00/modules/blestack/ble_scan_adv_basic/ble_scan_adv_basic.html
As such, you should actually repeat your experiment at least 20 times to see if what you saw was simply a one-time timing/ble ad channel fluke or if it truly is a "bug".
Then you should also repeat your experiment with different dongles.
Report back.
I experimented with 2 dongles over 20 times, and each time it was the same result.
It could at most detect one metawear device.
I saw that thread, but my issue is not the same. I am able to configure different dongles using the hci #. My issue is that the dongle itself is not detecting all the metawear devices. This causes a "Timed out error" when I am trying to connect to a specific metawear device by specifying the mac address.
Try removing one of the dongles with the duplicate MAC, then scan again.
I tried that, but still have the same issue.
What about different dongles, have you tried that yet?
Yes, I've tried with 4 different dongles and still have the same issue.
Do you think purchasing a different brand of dongles could help?
Yes, please try a different brand. https://mbientlab.com/tutorials/Linux.html?highlight=dongle#dongles
I tried a different brand of dongles and that fixed my issue. Thanks!
Awesome. Which brand worked and which didn't? What is your computer brand and OS? This could help future folks.
I am using a raspberry pi 3 B+ running raspbian.
The dongles sold on the mbientlab website didn't work for me.
But this brand of dongle worked for me!
Thanks leex, good to know!