Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: USBHost Bluetooth -> BLE -> ArduinoBLE?

  1. #1
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,151

    USBHost Bluetooth -> BLE -> ArduinoBLE?

    I thought I would mention, that @mjs513 and myself, have been working on updating the Bluetooth support within the USBHost library.
    Hopefully soon we will have setup to do a Pull request into the master branch. We will discuss these changes over in the main USBHost Bluetooth thread: https://forum.pjrc.com/threads/49358...Host-Bluetooth

    But this includes things like we now have some of the XBox One controllers working as well as some of the Nintendo Switch controllers working and cleaned up a bunch of different things, added SDP support and the like.
    We will post an update in the other thread about this soon.

    But One thing I have been running into, is so far the USBHost Bluetooth library is we do not have any support in it for Bluetooth Low Energy (BLE). And we are running into devices that use BLE.

    For example, I have a Microsoft Mouse that we do not see at all. And as I mentioned our current WIP Bluetooth code is working with Some XBOX one controllers. But the latest Firmware release for these controllers
    has now converted the device to run BLE...

    So I started investigating how to add BLE support into our USB Host support, which has been pretty interesting, as it relies on several more Bluetooth sub-systems. So, I started off with adding some real basic stuff, where I was able to enable the BLE scan and could see that some devices exist out there. But to go to the next step would require implementing things like GATT and ...

    So I was curious and found that Arduino has a library arduinoBLE, which implements a lot of this. Which they have running on several boards like: Arduino Nano 33 IOT, Arduino Nano 33 BLE, plus RPI2040, ESP32... So was wondering how hard it would be to get it running on the Teensy 3.6, 4.x...

    So I started hacking. Their code appears to be geared to work using the Uart Transport Layer (BT Core 5.3 spec - Vol 4, part A)... We are not using that transport layer, but most of our USB Dongles, are geared around the USB Transport layer (same volume but Part B)...

    The ArduinoBLE code has some classes for different implementations of the Transport class. And I created one for USBHost. I actually have the code add one of our USB Host object, plus a HUB, plus a new class that I hacke up out of our BluetoothController class.

    And it is now talking. I ran through several of the examples, but have had:

    I started off with an Arduino Nano33 IOT running LedControl.ino talking to a Nano 33 BLE (Led) so you can change state of pin 2 of the IOT and it changes the state of the LED on the BLE.

    Then through several steps have the LEDControl sketch running on a MicroMod talking to the BLE
    And now have a Teensy 4.1 running LED


    So I now have a version of this library up in the fork/branch: https://github.com/kurte/ArduinoBLE/tree/Teensy_USBHost

    Will be fun to try out a few more things, like their battery monitor example, to see how well it talks to my iPhone or iPad.
    Plus see how well this library talks to the Microsoft Mouse or an updated XBox controller.

    Not sure, what I will do with this in the end. Options include: Punt, or see about creating a Pull Request back to Arduino. Or trying to integrate more of this functionality back into USBHost_t36.

    But now back to playing

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,504
    Good work/play

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,151
    Quick update. Trying to see if I can use this to talk to some other Bluetooth hardware. SO far, no luck with XBOX One controller.

    However, the Micrsoft Mouse:

    Code:
    Bluetooth® Low Energy Central - Peripheral Explorer
    Found e1:59:47:7a:f2:be 'Surface Arc Mouse' 1812
    Connecting ...
    Connected
    Discovering attributes ...
    Attributes discovered
    
    Device name: Surface Arc Mouse
    Appearance: 0x0
    
    Service 1800
    	Characteristic 2a00, properties 0xA, value 0x5375726661636520417263204D6F757365
    		Descriptor 2803, value 0x020500012A
    		Descriptor 2a01, value 0xC203
    	Characteristic 2a01, properties 0x2, value 0xC203
    		Descriptor 2803, value 0x020700042A
    		Descriptor 2a04, value 0x060006003C002C01
    	Characteristic 2a04, properties 0x2, value 0x060006003C002C01
    Service 1801
    Service 180a
    	Characteristic 2a29, properties 0x2
    		Descriptor 2803, value 0x020D00502A
    		Descriptor 2a50, value 0x
    	Characteristic 2a50, properties 0x2
    Service 180f
    	Characteristic 2a19, properties 0x12
    		Descriptor 2902, value 0x0000
    Service 1812
    	Characteristic 2a4e, properties 0x6
    		Descriptor 2803, value 0x1A16004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A1A004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A1E004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A22004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A26004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A2A004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A2E004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A32004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A36004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x1A3A004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0E3E004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xE
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0E41004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xE
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0A44004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xA
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0A47004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xA
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0A4A004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xA
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0A4D004D2A
    		Descriptor 2a4d, value 0x
    	Characteristic 2a4d, properties 0xA
    		Descriptor 2908, value 0x
    		Descriptor 2803, value 0x0250004B2A
    		Descriptor 2a4b, value 0x
    	Characteristic 2a4b, properties 0x2
    		Descriptor 2803, value 0x1A5200332A
    		Descriptor 2a33, value 0x
    	Characteristic 2a33, properties 0x1A
    		Descriptor 2902, value 0x0000
    		Descriptor 2803, value 0x0255004A2A
    		Descriptor 2a4a, value 0x
    	Characteristic 2a4a, properties 0x2
    		Descriptor 2803, value 0x
    		Descriptor 2a4c, value 0x
    	Characteristic 2a4c, properties 0x4
    
    Disconnecting ...
    Disconnected
    Needed to first setup the mouse into pairing mode and then it found this information.

    Now to see in the library how to do the pairing...

    EDIT: I hacked up their sketch to show the standard names for many of the standard 16 bit UUIDs
    So now looks like:
    Code:
    Device name: Surface Arc Mouse
    Appearance: 0x0
    
    Service 1800	//Generic Access service
    	Characteristic 2a00, properties 0xA, value 0x5375726661636520417263204D6F757365	//Device Name
    		Descriptor 2803, value 0x020500012A	//Characteristic
    		Descriptor 2a01, value 0xC203	//Appearance
    	Characteristic 2a01, properties 0x2, value 0xC203	//Appearance
    		Descriptor 2803, value 0x020700042A	//Characteristic
    		Descriptor 2a04, value 0x060006003C002C01	//Peripheral Preferred Connection Parameters
    	Characteristic 2a04, properties 0x2, value 0x060006003C002C01	//Peripheral Preferred Connection Parameters
    Service 1801	//Generic Attribute service
    Service 180a	//Device Information service
    	Characteristic 2a29, properties 0x2	//Manufacturer Name String
    		Descriptor 2803, value 0x020D00502A	//Characteristic
    		Descriptor 2a50, value 0x	//PnP ID
    	Characteristic 2a50, properties 0x2	//PnP ID
    Service 180f	//Battery service
    	Characteristic 2a19, properties 0x12	//Battery Level
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    Service 1812	//Human Interface Device service
    	Characteristic 2a4e, properties 0x6	//Protocol Mode
    		Descriptor 2803, value 0x1A16004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A1A004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A1E004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A22004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A26004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A2A004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A2E004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A32004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A36004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x1A3A004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0x1A	//Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0E3E004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xE	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0E41004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xE	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0A44004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xA	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0A47004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xA	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0A4A004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xA	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0A4D004D2A	//Characteristic
    		Descriptor 2a4d, value 0x	//Report
    	Characteristic 2a4d, properties 0xA	//Report
    		Descriptor 2908, value 0x	//Report Reference
    		Descriptor 2803, value 0x0250004B2A	//Characteristic
    		Descriptor 2a4b, value 0x	//Report Map
    	Characteristic 2a4b, properties 0x2	//Report Map
    		Descriptor 2803, value 0x1A5200332A	//Characteristic
    		Descriptor 2a33, value 0x	//Boot Mouse Input Report
    	Characteristic 2a33, properties 0x1A	//Boot Mouse Input Report
    		Descriptor 2902, value 0x0000	//Client Characteristic Configuration
    		Descriptor 2803, value 0x0255004A2A	//Characteristic
    		Descriptor 2a4a, value 0x	//HID Information
    	Characteristic 2a4a, properties 0x2	//HID Information
    		Descriptor 2803, value 0x0457004C2A	//Characteristic
    		Descriptor 2a4c, value 0x	//HID Control Point
    	Characteristic 2a4c, properties 0x4	//HID Control Point
    
    Disconnecting ...
    Disconnected
    Last edited by KurtE; 11-17-2022 at 09:01 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •