I am glad to announce that Bluetooth HID devices are now supported by the USB Host library. The library already supports PS3 and Wiimote controllers, but now you are also able to use Bluetooth mice and keyboards with the library.
An example is available at the following link: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/BTHID/BTHID.ino.
I have personally tested it with a PS3 keyboard (see image), an Apple Wireless Keyboard and an old Bluetooh mouse from Microsoft and all of them works fine.
For more specific instructions on how to use the library I recommend taking a look at the blog post at my own blog: http://blog.tkjelectronics.dk/2013/12/bluetooth-hid-devices-now-supported-by-the-usb-host-library/.
Feel free to post a comment below if you got questions or got problem with a specific device and I will answer as fast as possible.
Why doesn’t USB Host Shield work on Galileo? Please add supplemental #defines and other necessary tweaks to get the PS3 and PS4 controllers working with Galileo!
Because it is a totally different board – it uses a Intel processor.
Right now the USB Host Shield works with almost any AVR microcontroller and a few ARM boards (the Teensy 3.0 and Teensy 3.1).
Would it work with library fixes, our is it simply incompatible hardware? Any edits to the library I can pursue?
Actually all you have to do is edit the SPI communication. All the SPI communication is handled in the following file: https://github.com/felis/USB_Host_Shield_2.0/blob/master/usbhost.h.
If I shipped a Galileo board to you, would it be worth your time to make it work?
I don’t think so.
Hmm would I be able to keep it?
Of course, that’s what I meant. No need to ship a $70 board all around the world unnecessarily.
Okay super. I will contact you by email with the shipping address 🙂
Were you able to get the bluetooth dongle to work on USB host on Intel Galileo? I am trying to connect a PS3 controller to the USB host port on the board. Any help is appriciated 🙂
I have actually looked into it: https://github.com/felis/USB_Host_Shield_2.0/tree/Galileo, but I believe there is a bug in the SPI library for the Galileo, as it just stalls.
Thanks Kristian. I will try using this on my project. However the question is are your using the native USB host available on Galileo?
I just got it working on the Galileo and Edison. Please download the newest code from the following branch: https://github.com/felis/USB_Host_Shield_2.0/tree/Galileo and report back, thanks.
I’m using the USB Host Shield at the moment. I don’t think I will look into adding native support for it.
Greetings, I can’t get a SONY DualShock Sixaxis PS3 controller to pair with the USB dongle, but a Wii controller pairs no problem.
Arduino MEGA 2560. IDE 1.6.1. I have an externally powered USB hub with the BT Dongle plugged in. Nothing else plugged in. Un-comment line about USB Hub for Wii controller, plug it up, upload sketch, Wii controller pairs right up. Actually very impressive! (Had a hell of a time getting this far on a Rasberry Pi.)
Same setup but trying the PS3 controller, which is the one I need for the robot this will control. I load the PS3BT.ino sketch (also with the USB hub line un-commented). Plug PS3 controller into hub and press the P button. The four lights on the PS3 controller flash. In serial monitor the only message is the note about “PS3 Bluetooth Library Started” When I unplug the PS3 controller USB cable from the hub, I think it shold pair. But it does not. (Note: with the Wii controller the serial monitor displayed all the keys pressed on the Wii).
I have no idea what I’m doing wrong, or not doing that I should… Can anyone set me straight?
Thanks in Advance,
John S.
p.s. This USB host controller and libraries have opened a whole new world of experimentation for my grand-kids and I. Thanks!
Please see the following section of the readme: https://github.com/felis/USB_Host_Shield_2.0#ps3-library. Basically you will need to plug in the dongle, unplug it, then plug in the PS3 controller. Then finally plug in the dongle again and press the PS button on the PS3 controller.
Please also enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging, so you can see what is going on.
I have many Bluetooth devices in the general area when I am trying to pair the USB Host shield to my Bluetooth controller. How can I specifically pair ONLY the Bluetooth controller to the USB shield using the attached Bluetooth dongle? Is there a way to see & save the mac address?
My iPhone is seeing the controller when I set the controller to pair, it sees “iPega Bluetooth Controller”. Can I specify this ID in the code to help pair with the USB Host shield?
Also, once paired with the host shield, how can I verify using my Arduino that it has indeed paired with the controller?
Lastly, I need to see the button presses coming back from the controller in the Arduino. Do you have a command in BTD.cpp that I can use to send those keystrokes to my LCD or serial port?
Thanks!
You should try the “void hci_connect(uint8_t *bdaddr);” function – see: http://felis.github.io/USB_Host_Shield_2.0/class_b_t_d.html#ac6c4a65645421fc4be3743d41ef3a924. It allows you to connect to a specific device.
You will properly also need to set “hci_state” to “HCI_CONNECTED_DEVICE_STATE”.
If that doesn’t work, then open up an issue on Github: https://github.com/felis/USB_Host_Shield_2.0/issues and I will look into it.
You can simply check the variable “connected”: http://felis.github.io/USB_Host_Shield_2.0/class_b_t_h_i_d.html#ab3a81823a1d8805383146a6baad6ccc4 if you are using the BTHID class.
If you want to use a LCD with the shield, then see the following example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/max_LCD/max_LCD.ino.
If you want to monitor the keystrokes, you properly want to use the BTHID example as a starting point: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/BTHID/BTHID.ino.