Errors Connecting to MetaWear Device with BLE dongles on MetaHub
I recently purchased some MMR sensors and a MetaHub and was having some issues with BLE dongle connections. I am trying to connect a MMR device with a BLE dongle on a MetaHub and running into some errors. I have attached the python script I am trying to run: it simply connects to a device and then blinks the LEDs before disconnecting. When passing no hci_mac argument the code runs fine and in able to connect the the MetaSensor and have the on board LEDs blink. The only error being thrown is error > 1590522052.141092: Error on line: 296 (src/blestatemachine.cc): Operation now in progress
which I have read elsewhere can be ignored.
When trying to connect with the dongle I get the following errors:
error 1590521927.717962: Error on line: 296 (src/blestatemachine.cc): No route to host
Traceback (most recent call last):
File "/home/pi/Apps/Python-Examples/MetaWear-SDK-Python/Project/singleConnect.py", line 14, in
File "/home/pi/.local/lib/python3.5/site-packages/mbientlab/metawear/metawear.py", line 195, in connect
mbientlab.warble.WarbleException: Timed out while trying to connect to remote device
I have set up my Pi and dongles as described in the tutorials and am still facing these issues. The BLE dongle is visible and running when I check hciconfig and bluetoothctl.
Also when preforming a scan within bluetoothctl the MetaWear devices are not visible when scanning with the dongle (and they are when scanning with the onboard bluetooth). I have preformed this scan multiple times and waited a while with the same results.
With these results the timed out error makes sense since the MetaWear devices cannot even be found when scanning with the dongle, although I do not know where the "No route to host" error comes from. I also don't know how to fix the fact that the dongles are not able to see other devices properly.
I received 3 dongles with my MetaHub and the same issue happens with each of them. I have updated all of my packages and tried numerous reboots but cannot seem to find the source of this problem. I realize there are similar posts to this (https://mbientlab.com/community/discussion/comment/9901#Comment_9901) but in this case the dongle was not discovering any devices (in my case it can pick up a few devices but no matter how long it is left to scan it can never find the MetaWear devices)
Any help would be appreciated as the MetaHub and bluetooth dongles were both purchased directly from Mbientlabs.
Board Information - MMR
Model number: 5
Host Device Information
MetaHub (raspberry pi running Raspbian (stretch))
Bluetooth dongles are the CSR 4.0 purchased directly from Mbientlabs
python script being run:
from mbientlab.metawear import MetaWear, libmetawear
from mbientlab.metawear.cbindings import *
from time import sleep
from threading import Event
device = MetaWear("DA:6A:BD:93:6C:FA”, hci_mac = “00:1A:7D:DA:71:10”) device.connect() #returns True if device is connected print(device.is_connected) pattern= LedPattern(repeat_count= Const.LED_REPEAT_INDEFINITELY) libmetawear.mbl_mw_led_load_preset_pattern(byref(pattern), LedPreset.BLINK) libmetawear.mbl_mw_led_write_pattern(device.board, byref(pattern), LedColor.GREEN) libmetawear.mbl_mw_led_play(device.board) sleep(5.0) libmetawear.mbl_mw_led_stop_and_clear(device.board) sleep(1.0) device.disconnect() sleep(1.0)
This error can be ignored:
Some folks are saying that some raspberry PI and OSs don't support the SAME ble dongle. If you have different ble dongles it will work. Can you try this?
I received three BLE dongles from Mbientlabs (purchased to work in conjunction with the MetaHub) and tried each of them separately with no success on the Pi. Are you suggesting try a different brand of dongle?
Correct. That way we can know if the issue is with the dongle or your Pi setup.
You need to also test each dongle individually.
Thank you Laura,
I have ordered a different brand of dongle to see if that will work - will update.
I was also looking more into why these dongles may not work and discovered it is says they are not le supported. Picture below: hci1 is the onboard bluetooth and hci0 is the dongle.
This makes sense why i am unable to see the sensors when scanning, but this dongle was bought from you as a BLE 4.0 so it should be le supported. Is this potentially something on the OS end or defective dongles?
Yes that's what I want to figure out.
I use the same dongles on my setup and they work just fine so either the dongle itself is busted or there's an issue with your setup. This is what we could figure out easily if you had a different dongle to test with.
I also need to make sure that after you plugged in the dongles, that you did the update. Can you please make sure you followed the steps here:
Also, don't test both dongles at the same time. Follow the installation steps in our tutorials ONE dongle AT A TIME.
Please keep me updated on all these tests.
Update after getting a different dongle - it works!
I am able to scan for and discover the sensors, connect and communicate with the boards. I guess there must be an issue with the dongles sent with the MetaBase. Just for others reference who may face a similar issue, I am using the Plugable USB Bluetooth 4.0 Low Energy Micro Adapter with a Raspberry Pi, and it solved my connection issues.
@slee. Thanks for the update. Sometimes the dongles are bad. You can email hello[at]mbientlab[dot]com for a refund or replacement of the dongle if you want. Just mention this post and we will take care of you.
@slee @Laura which dongle do you recommend using with the pi?
I can the dongles using hciconfig just fine and work without any issue, however I want to bluetoothct which I retruns only one dongle when i run bluetoothctl list.
Unfortunately it depends a lot of the os, even with pi. It's also a pain when some items are deprecated depending on the BLE release.
There is a decent list here: https://linuxhint.com/linux-compatible-bluetooth-dongles/
I like to go on amazon and look for pi compatible dongles too.
Just make sure the dongles is ble 4.0 or newer.