Ubuntu PC unable to find/connect to MMR
Hi all!
My company very recently purchased the MetaWear MMR and MMR+ devices. I've an issue that I'm hoping someone could help me with. There happens to be an existing discussion addressing a similar problem (https://mbientlab.com/community/discussion/2504/how-to-connect-to-the-metamotionr) but I'm intending to use the C++ SDK rather than the Python or JavaScript one.
Both devices we purchased can connect to my Android phone via Bluetooth, allowing me to collect a stream of quaternion data on my phone using the MetaBase app.
However, I have spent all day trying to connect the MetaWear devices to the Ubuntu 16.04 PC via Bluetooth LE, but to no avail. The Bluetooth on the CPU is switched on, and I also turned on its visibility. I ran sudo hcitool lescan
on the command line, but it's not able to find any device; instead it returns this error: "Set scan parameters failed: Input/output error"
As a result, running gattool on the command line with the MAC address of the MetaWear device also returns a failed connection.
I experimented connecting my Android phone to the CPU via Bluetooth and it does work. Thus, I'm wondering if anyone knows about any additional steps I should take to connect the MetaWear devices to the CPU?
I've already run hcitool dev
to make sure that the Bluetooth LE adaptor is recognised by the computer (https://mbientlab.com/tutorials/Linux.html). I also ran hciconfig -a
to make sure that the Bluetooth LE in the CPU is of version 4.0.
I've also looked all around for information, including the MbientLab tutorials (https://mbientlab.com/tutorials/Linux.html) and StackOverflow (https://stackoverflow.com/questions/24853597/ble-gatttool-cannot-connect-even-though-device-is-discoverable-with-hcitool-lesc). But after going through these instructions, I'm still unable to locate the MetaWear device on the command line.
Is it perhaps normal that the MetaWear device cannot be located on the command line, so I have to use a library like Warble to connect to the device?
Thanks in advance!
Warmest regards
Li
Comments
For reference:
MetaWear MMR diagnostics
PC specs
In addition, I intend to use the MetaWear C++ SDK version 0.18.4, but I don't think this particular info is that relevant, as I haven't gotten so far yet; I've just been trying to locate my MetaWear Device on either the command line or Systems Settings -> Bluetooth.
Cheers!
Warmest regards
Li
This doesn't look like a metawear issue at all. It looks to me like an issue with your bluetooth config.
While this is unfortunately outside of the scope of this forum, you can do a quick check.
Can you use bluetoothctl instead and send me the output.
First, make sure its installed:
| >>> sudo apt-get update -y
| >>> sudo apt-get install -y bluez-utils
Probably reboot after.
| >>> sudo reboot now
Make sure bluetooth is running:
| >>> service bluetooth status
| bluetooth is running
If not:
| >>> service bluetooth start
Then scan for devices:
| >>> sudo bluetoothctl
| [bluetooth]# agent on
| Agent registered
| # list
| # scan on
| THIS SHOW SHOULD MANY DEVICES IN YOUR ENV INCLUDING THE METAWEAR
Make sure your MetaWear isn't connected to anything else as well and that it is fully charged.
Hi Laura
Thanks a lot for your kind and quick response! I really appreciate your help as you've mentioned that this issue might unfortunately be outside the scope of this forum.
I did indeed give bluetoothctl a try earlier today, but likewise, the PC was unable to detect the MetaWear devices. Below is my output:
And then, there's no more output, as the PC cannot detect the MetaWear devices. I made sure that the MetaWear device is not connected to my Android phone at this time.
If I were to turn the Bluetooth in my Android phone on and off, then, as expected, bluetoothctl detects this activity:
FYI,
00:1A:7D:DA:71:10
is the MAC address of the BTLE adapter plugged into the PC (I believe it's this model: https://mbientlab.com/store/ble-to-usb-dongle/)Again, I really appreciate your kind as well as detailed response! I've been at my wits' end all day over such a seemingly simple matter.
Cheers!
Warmest regards
Li
Are you sure the device is advertising and not connected? Can you verify this with a phone? Can you take a screenshot and prove to me the MetaSensor is advertising and NOT connected to anything?
What does >>> lsusb AND >>> hcitool dev return?
Hi Laura
Thanks for your kind reply!
I'm not sure what you mean by "advertising", but I've just connected the MetaWear Device to my Android phone to collect a stream of quaternion data on my phone. Below are some screenshots:
Android phone able to connect to MetaWear device: https://mbientlab.com/community/uploads/editor/9f/67zs1pgava3a.png
MetaWear device streaming quaternion data: https://mbientlab.com/community/uploads/editor/oh/gikxhn6gfmts.png
Here is the CSV file containing the quaternion data collected on the Android phone: https://drive.google.com/open?id=1By7Ero1v80rTto2t0U4zd6K1ixl0rpj_ From the 1-second mark onwards, I moved the MetaWear device around, hence the changes in w-, x-, y-, and z-values.
In addition, on the PC, lsusb returns:
hcitool dev returns:
Thanks again and warmest regards
Li
Can you remove the dongle from your system and run two two commands again, lsusb and hcitool dev (again no dongle). I think I know the problem but this will confirm my theory.
Hi Laura
Sure, here is the output without the dongle:
lsusb
: Device 006 replaces device 005, which was the dongle.hcitool dev
: just a single line printedThanks again for your kind assistance!
Warmest regards
Li
Hi Laura
If this helps, here's the output from the kernel ring buffer:
Cheers and warmest regards
Li
This is odd. It seems everything is working just fine independently.
Can you do one more thing for me:
1. Plug in the Dongle
2. Run these commands
I think the BLE drivers + libs haven't been installed for your dongle or are not at the latest so let's install/update them while the dongle is plugged in.
If that doesn't fix your issue then I am going to suspect a bad dongle (or maybe a dongle that doesn't support LE).
I am happy to send you a new dongle but I would like to test this theory first. Do you have another dongle you could test with?
Hi Laura
Thank you very much for your last suggestion about trying another dongle. I happen to possess a separate dongle. I plugged it in and immediately ran
sudo hcitool lescan
, and now the Ubuntu PC is able to locate both MMR and MMR+ devices Problem solved.The MMR+ device is the one at the top, and the MMR device is the one at the bottom.
Thus, it seems that your suspicion about the dongle being faulty is right. Just for the sake of completion, I also followed your instructions to install/update the BLE drivers and libraries for the faulty dongle. I don't want this post to be too long, so I won't post my output here, but in any case, the output is exactly the same as in the 4th post from the top.
Thanks again for your very kind assistance! I really appreciate it
Warmest regards
Li
If you bought this dongle from us, let me know and I can send you a new one (just email or file a ticket).
I am glad everything is working. Thanks for the update.