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

    • Hardware revision: 0.4
    • Firmware revision: 1.5.0
    • Model number: 5

    PC specs

    • Ubuntu 16.04

    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

  • edited May 7

    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.

    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:

    $ service bluetooth status
    ● bluetooth.service - Bluetooth service
       Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset
       Active: active (running) since Thu 2020-05-07 22:10:40 BST; 28s ago
         Docs: man:bluetoothd(8)
     Main PID: 984 (bluetoothd)
       Status: "Running"
       CGroup: /system.slice/bluetooth.service
               └─984 /usr/local/libexec/bluetooth/bluetoothd
    
    May 07 22:10:40 omega systemd[1]: Starting Bluetooth service...
    May 07 22:10:40 omega bluetoothd[984]: Bluetooth daemon 5.54
    May 07 22:10:40 omega systemd[1]: Started Bluetooth service.
    May 07 22:10:40 omega bluetoothd[984]: Starting SDP server
    May 07 22:10:40 omega bluetoothd[984]: Bluetooth management interface 1.14 initi
    $ sudo bluetoothctl
    Agent registered
    [bluetooth]# agent on
    Agent is already registered
    [bluetooth]# list
    Controller 00:1A:7D:DA:71:10 omega [default]
    [bluetooth]# scan on
    Discovery started
    [CHG] Controller 00:1A:7D:DA:71:10 Discovering: yes
    

    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:

    [NEW] Device 78:00:9E:97:29:31 leewayleaf
    [DEL] Device 78:00:9E:97:29:31 leewayleaf
    

    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

  • edited May 7

    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?

  • edited May 7

    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:

    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 003: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
    Bus 001 Device 002: ID 1bcf:0005 Sunplus Innovation Technology Inc. Optical Mouse
    Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    hcitool dev returns:

    Devices:
        hci0    00:1A:7D:DA:71:10
    

    Thanks again and warmest regards
    Li

  • edited May 8

    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.
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 006: ID 058f:6364 Alcor Micro Corp. AU6477 Card Reader Controller
    Bus 001 Device 003: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
    Bus 001 Device 002: ID 1bcf:0005 Sunplus Innovation Technology Inc. Optical Mouse
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    • hcitool dev: just a single line printed
    Devices:
    

    Thanks again for your kind assistance!

    Warmest regards
    Li

  • Hi Laura

    If this helps, here's the output from the kernel ring buffer:

    $ dmesg | grep -i blue
    [   23.655858] Bluetooth: Core ver 2.22
    [   23.655868] Bluetooth: HCI device and connection manager initialized
    [   23.655870] Bluetooth: HCI socket layer initialized
    [   23.655871] Bluetooth: L2CAP socket layer initialized
    [   23.655874] Bluetooth: SCO socket layer initialized
    [   25.508972] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   25.508974] Bluetooth: BNEP filters: protocol multicast
    [   25.508983] Bluetooth: BNEP socket layer initialized
    [   25.522171] Bluetooth: RFCOMM TTY layer initialized
    [   25.522174] Bluetooth: RFCOMM socket layer initialized
    [   25.522177] Bluetooth: RFCOMM ver 1.11
    

    Cheers and warmest regards
    Li

  • edited May 8

    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

    >>> sudo apt-get update
    >>> sudo apt install bluetooth pi-bluetooth bluez blueman bluez-utils
    >>> sudo apt-get upgrade
    >>> sudo reboot now
    
    1. Give me the output of
    bluetoothctl -> scan on
    

    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 :smiley: Problem solved.

    LE Scan ...
    C9:ED:D4:0B:CC:48 MetaWear
    C9:ED:D4:0B:CC:48 (unknown)
    63:21:02:30:B4:9D (unknown)
    63:21:02:30:B4:9D (unknown)
    FA:B4:6A:02:EC:56 (unknown)
    FA:B4:6A:02:EC:56 ENVY 5000 series
    F2:DC:73:7D:AA:08 MetaWear
    F2:DC:73:7D:AA:08 (unknown)
    

    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 :smiley:

    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.

Sign In or Register to comment.