Home > Arduino, Bluetooth, TKJ Electronics, USB > Wiimote added to USB Host library

Wiimote added to USB Host library

This is yet again a new announcement regarding the USB Host library. I just added support for the Wiimote via Bluetooth.
Check out the source code at github: https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp and the example sketch as well.
I will work on implementing support for the Nunchuck and Wii Motion Plus extension in the near future.

Update:
The library now also supports the Nunchuck controller and the Motion Plus extensions. The newest version of the library can be found at github.

Another Update:
The library now also work with the new Wiimote where the Motion Plus extension is built-in.
Check out my commit to see what where needed in order to make the new Wiimote work as well – the main difference is that you now have to send the data using the interrupt channel.
To tell if your Wiimote is the new type, it should have a label at the bottom saying “Wii MotionPlus INSIDE”. If you are in doubt take a look at this picture.

Yet another update:
The IR camera inside the Wiimote is now also supported. The the following commit for more information.

A new update once again:
The Wii U Pro Controller is now also supported via Bluetooth.

Categories: Arduino, Bluetooth, TKJ Electronics, USB Tags:
  1. Christian Gerefalk
    August 22nd, 2012 at 19:47 | #1

    Good job, was annoyed over it working nicely in the past with pre 1.0 Arduino IDE and the author didn’t update for post 1.0, anyway I tried the example and I get this:

    Wiimote Bluetooth Library Started
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Local Bluetooth Address: 00:02:5B:46:86:DC
    Connecting to Wiimote
    Connected to Wiimote
    Send HID Control Connection Request

    And it sits there for ages, the wiimote and dongle both blink for a while and then go dark but nothing happens beyond that, am I doing something wrong? I assumed that at some point it would reach a state where it reported back what I’m pushing etc.

  2. August 22nd, 2012 at 19:50 | #2

    @Christian Gerefalk
    Try to create the instance like so: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wiimote/Wiimote.ino#L11 so it does a inquiry. If that doesn’t work then try to uncomment EXTRADEBUG (https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp#L20) and send me the output.
    Also try to use a different dongle πŸ˜‰

  3. Christian Gerefalk
    August 23rd, 2012 at 14:49 | #3

    I got two dongles one tiny that isn’t much larger than the USB port itself, and an old big box on a lead, both give the same result:


    Wiimote Bluetooth Library Started
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Local Bluetooth Address: 00:08:F4:00:6D:ED
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Wiimote found
    Create the instance like so to connect automatically:
    WII Wii(&Btd,0x00,0x18,0x00,0xF0,0x1D,0x18);
    Connecting to Wiimote
    Connected to Wiimote
    Send HID Control Connection Request

    If it matters my wiimote is a chinese copy, it works with an actual Wii and Wii emulators/gamepad utilities (glovepie etc).

    I uncommented that line, should the output have been in the serial monitor? I only get what I pasted above.

  4. Christian Gerefalk
    August 29th, 2012 at 14:12 | #5

    I never got the old library to work at all since I got a 2.0 shield and 1.0.1 IDE

    Small stick:


    Wiimote Bluetooth Library Started
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 01
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Local Bluetooth Address: 00:02:5B:46:86:DC
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Number of responses: 1
    Wiimote found
    Create the instance like so to connect automatically:
    WII Wii(&Btd,0x00,0x18,0x00,0xF0,0x1D,0x18);
    Connecting to Wiimote
    Connected to Wiimote
    Send HID Control Connection Request”

    Both the wiimote and LED on the stick flash for a while after reaching there.

    Large dongle:

    “Wiimote Bluetooth Library Started
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 01
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Local Bluetooth Address: 00:08:F4:00:6D:ED
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Number of responses: 1
    Wiimote found
    Create the instance like so to connect automatically:
    WII Wii(&Btd,0x00,0x18,0x00,0xF0,0x1D,0x18);
    Connecting to Wiimote
    Connected to Wiimote
    Send HID Control Connection Request”

  5. Christian Gerefalk
    August 29th, 2012 at 14:18 | #6

    Bah can’t edit.

    I did add that line btw here is my Wii.ccp in full: http://pastebin.com/hEzK1M3C and BTD.ccp in full: http://pastebin.com/XRngCHCH

    Copied yours from the links you gave but that gave me “AnalogHat not defined in this scope” errors, so these are based on the ones I downloaded from github

  6. Christian Gerefalk
    August 29th, 2012 at 14:35 | #7

    Just updated the library and tried again with the same results, I do get warnings when compiling both the new and old version of the library btw, mostly:

    “C:Program Files (x86)arduino-1.0.1librariesUSB_Host_Shield_2RFCOMM.cpp:1233: warning: only initialized variables can be placed into program memory area” a ton of those on that file and confdescparser.h etc, full log here: http://pastebin.com/xpk97ArE

  7. September 2nd, 2012 at 19:00 | #8

    @Christian Gerefalk
    It sounds like you have added the library incorrectly if you are getting compiler errors. See this page for more information: http://www.arduino.cc/en/Hacking/Libraries
    Make sure that you can select the example sketch in File>Examples>”folder name”>Bluetooth>Wii. Don’t try to copy and paste the code from github.

  8. Christian Gerefalk
    September 7th, 2012 at 16:02 | #9

    I did add it as I’ve done with all others I have working, I can open the example in the IDE, I got warnings etc turned on which isn’t the default setting in the IDE, it warns me about those, it doesn’t error out and stop.

  9. September 8th, 2012 at 17:22 | #10

    @Christian Gerefalk
    What hardware are you using?
    I will try the same to reflect your setup.

  10. Christian Gerefalk
    September 11th, 2012 at 17:22 | #11

    Recent uno and and older mega1280, bluetooth dongles: http://dx.com/p/world-s-smallest-bluetooth-2-0-edr-usb-dongle-12696?item=20 something like that, exact same “design” anyway, and a credit card sized 1cm thick ancient dongle on a lead, controller: http://dx.com/remote-and-nunchuck-controller-for-wii-blue-37855?item=6 not loading for me here atm but it’s the third on this search: http://dx.com/s/Remote+and+nunchuck+controller+for+wii+blue ($13.90 one) as said before I’ve tried both dongles and the remote on my PC (dolphin, GlovePIE) and the remote with a real wii, works fine.

  11. September 12th, 2012 at 18:58 | #12

    @Christian Gerefalk
    Your comment was caught in our spam filter, so I haven’t seen it until now.
    Okay, I still think that you are including the libraries wrong, I have several people who has confirmed that the library works great and they don’t get any errors at all.

  12. September 16th, 2012 at 19:43 | #13

    @Christian Gerefalk
    I thought a bit more about the problems you are having. Do you by any change got other version of the USB library inside the library folder? If so then remove them from there.

  13. Fisher Wei
    September 18th, 2012 at 08:18 | #14

    Hi,

    Thanks for your job first, and I got the following error message, when I pluged in a nunchuck:

    Extension connected
    Checking extension port
    Unknown Device: 00FA
    Data: FF 00 A4 20 00 00

    or a classic controller pro:

    Extension connected
    Checking extension port
    Unknown Device: 00FA
    Data: 01 00 A4 20 01 01

    what is wrong with this?

  14. September 18th, 2012 at 12:37 | #15

    @Fisher Wei
    It seems like you Nunchuck is not returning the correct signature. The right one should be 00 00 A4 20 00 00. See: https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp#L230 and http://wiibrew.org/wiki/Wiimote/Extension_Controllers.
    Is it a third party Nunchuck? It’s pretty easy to fix. Just remove “l2capinbuf[15] == 0x00 &&” from the code at the line I just sent you.
    The library doesn’t support the Classic controller as I haven’t got my hands on one yet.

  15. Fisher Wei
    September 18th, 2012 at 13:38 | #16

    @Lauszus
    Hi, I think my nunchuck is not 3rd party, and if I plug nunchuck in before powering arduino on, it will work fine. If power on and pair at first, it will report error message. I don’t know why. πŸ™‚

  16. September 18th, 2012 at 14:07 | #17

    @Fisher Wei
    Okay. Sounds weird. I can plug the Nunchuck in and out of the Wiimote without any problems. Try to remove the line I told you in the earlier reply and tell me if it works then. If so I will add it to the library.

  17. Fisher Wei
    September 19th, 2012 at 10:08 | #18

    @Lauszus
    Yes, it works. I removed “l2capinbuf[15] == 0Γƒ?00 &&”.
    And then, I have a new issue: I pluged motion plus in, arduino has not any responses, no “Unknown Device”, no “Motion Plus connected”. If I plugin before powering on, it also works.

  18. September 19th, 2012 at 10:48 | #19

    @Fisher Wei
    That is normal. You have to plug in the motion plus before powerup.

  19. Michael Motes
    October 24th, 2012 at 17:21 | #20

    Is there any plans to support the IR camera?

  20. October 24th, 2012 at 18:17 | #21

    @Michael Motes
    No not currently πŸ™‚

  21. Rick
    November 11th, 2012 at 20:44 | #22

    Very nice!

    However, when I wanted to run the latest Wii example from git I had to comment out some DEBUG macros within the library code in order to produce a sketch that could fit on my Uno… The sketch is still around 26 kB and I was wondering if there is more debug code that takes up lots of space?

  22. November 11th, 2012 at 20:48 | #23

    @Rick
    All the debug messages can be disabled by comment out these line: https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp#L19 and https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp#L19, but I guess you have already done that?

  23. Rick
    November 11th, 2012 at 21:27 | #24

    Yup…and that left me with a binary size of roughly 26 kB (Wii example). Is this ‘normal’? Kinda limits the possibilities when using the Uno with this library. But I guess that may be a problem of the complexity of USB…

  24. November 11th, 2012 at 21:32 | #25

    @Rick
    Yes that is normal. But you have to know that the example sketch actually takes up a lot of flash as it got so many strings.
    Yes I’m afraid too, but take a look at the atmega644 (aka Sanguino: http://sanguino.cc/) at my github repository: https://github.com/Lauszus/sanguino it got the double amount of flash than the Uno and it’s also available in a DIP package.

  25. Neni
    March 8th, 2014 at 20:13 | #26

    Hi.
    Thank you very much for your work. I am using arduino ADK with one of suggested Bluetooth dongle. I am unable to make it work with WII mote it is getting stuck at “Send HID connection request” I am enclosing debug information. Any help will be appreciated.

    Wiimote Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    Connection established
    HCI Reset complete
    Unmanaged HCI Event: 24
    Write class of device
    Local Bluetooth Address: 00:15:83:0C:BF:EB
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Or press sync if you are using a Wii U Pro Controller
    Number of responses: 1
    Wiimote found
    Now just create the instance like so:
    WII Wii(&Btd);
    And then press any button on the Wiimote
    Connecting to Wiimote
    Connection established
    Connected to Wiimote
    Unmanaged HCI Event: 11
    Unmanaged HCI Event: 11
    Received Key Request
    Pairing with wiimote
    Pairing successful with Wiimote
    Send HID Control Connection Request

  26. March 9th, 2014 at 13:04 | #27

    @Neni
    Could you try another Bluetooth dongle?
    Also it look like that it aborted an ongoing connection. Please try to unplug the Bluetooth dongle and turn off the Wiimote and then try again.

  27. Neni
    March 9th, 2014 at 17:43 | #28

    Tried another dongle, received similar messages. It worked once and is not working again. Any delay issues with ADK?

    Wiimote Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    Connection established
    Connection established
    Connection established
    HCI Reset complete
    Unmanaged HCI Event: 24
    Write class of device
    Local Bluetooth Address: 00:13:EF:F1:43:AC
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Or press sync if you are using a Wii U Pro Controller
    Number of responses: 1
    Wiimote found
    Now just create the instance like so:
    WII Wii(&Btd);
    And then press any button on the Wiimote
    Connecting to Wiimote
    Connection established
    Connected to Wiimote
    Unmanaged HCI Event: 1D
    Received Key Request
    Pairing with wiimote
    Pairing successful with Wiimote
    Send HID Control Connection Request

  28. March 9th, 2014 at 23:31 | #29

    @Neni
    Hmm try to add:

    delay(5);

    In your loop and see if that helps.

  29. Neni
    March 10th, 2014 at 02:07 | #30

    Tried and no luck. Still same issue. Tried three dongles so far. Bluetooth SPP works fine on all three.
    Any more suggestions??

  30. March 10th, 2014 at 22:28 | #31

    @Neni
    No unfortunately no. We will start start to sell the Bluetooth dongles we use for the Balanduino in our shop, so people like you don’t have to search for a dongle that works with the library.
    I expect that we will list it this month.

  31. Neni
    March 13th, 2014 at 02:13 | #32

    Thanks. I will wait for it. I have one more problem. I tired to compile PS3BT with Arduino 1.56 Beta 2 for Mega ADK. I am getting error whenever I enable host debugging.

    Arduino: 1.5.6-r2 (Windows XP), Board: “Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)”

    c:/program files/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function `__vector_default’:
    (.vectors+0x94): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_37′ defined in .text section in c:/program files/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o

  32. March 13th, 2014 at 13:07 | #33

    @Neni
    This is a bug in avr-gcc: https://sourceware.org/bugzilla/show_bug.cgi?id=13410.

    Try to remove some of the strings stored in flash like so:

    Serial.print(F("rnCross"));

    Becomes:

    Serial.print("rnCross");

    Btw I can’t reproduce this, so I can not give you any more guidance than this. Also I know that the Arduino team is working on updating the toolchain, so this bug should get fixed when they do that.

  33. Neni
    March 14th, 2014 at 05:43 | #34

    Thank you very much. Worked by removing all strings stored in Flash.

  34. March 14th, 2014 at 13:41 | #35

    @Neni
    You are welcome πŸ™‚

  35. NicoHood
    May 20th, 2014 at 14:24 | #36

    Hi again πŸ˜€
    Finally got the shield but as expected i got some problems as always πŸ˜€

    So first what works:
    HID Keyboard
    Wiimote with all 3 doogles (2 had some probs first but now its fine)

    What doesnt work:
    Wiiu Pro controller sync with 2 doogles (cheap 1? china doogles). My old Bluetooth doogle thats nearly broken works. The weird thing is: all 3 work for the wiimote, but the cheap once dont for the pro controller. But they DO work on my pc with software, all 3!

    Okay so i got the controller synced with one doogle. Led is on, fine. But no button Press is recognized. I had no idea what to do, googled and noticed the controller disconnected. Pressed a key, reconnected and whoops! works O.o So i have to start the sketch, connect the controller, turn it off and on again. Any idea why that happens, and how to solve? I am using the 1.0.5 IDE and a MEGA 2560. It would be also nice to get the cheap doogles to work with the pro controller.

    A general question: How does the sync work? Is something stored in eeprom or does each shield or doogle has a specific id to sync with? I dont want to overwrite that eeprom later.

    Debug output for the working doogle:
    http://pastebin.com/u31Spwrr

    Debug output for the not working doogle:
    http://pastebin.com/sKj0rbP1

    Thx for ya help πŸ™‚

  36. June 21st, 2014 at 00:44 | #37

    @NicoHood
    Unfortunately I don’t own a Pro U Controller, so I will have to wait until I can get my hands on one again.

    The sync simply work by when you pair with the controller, the Wiimote/Pro Controller will store the Bluetooth address of your dongle inside it’s EEPROM and then it will try to connect to that Bluetooth address when you press on any button, so the Arduino’s EEPROM is actually not used at all.

  37. NicoHood
    June 21st, 2014 at 00:52 | #38

    @ lauszus:
    oh, okay. I had no time to get my hands on that. I will try to seperate the wiimote and the controller if ive got time.

    I also noticed that the motion control doesnt work for a normal wiimote. The value is always the same.

    I am wondering how often you need to call the usb task, to keep the connection. Do you know that maybe? and how long does this operation take?

  38. June 21st, 2014 at 00:55 | #39

    @NicoHood
    My experience is that you need to call Usb.Task a lot more when you the Wiimote compared to for example the PS3 controller, as it looks like it will just stack up all measurements in a buffer, so it will end up being delayed, so basically you need to prevent using any delays in your code at all and instead use millis and micros and state-machine in order to keep calling Usb.Task.
    The code itself does not take very long, but I haven’t actually measured it as it depends on how many drivers you have running at the same time.

  39. Izco
    February 25th, 2015 at 11:59 | #40

    Hi, If Wiimote without motion plus and not nunchuck connected, then Wii.getPitch() and Wii.getRoll() from Wii example are always 180ΒΊ. With nunchuck connected, all right.
    Is possible solution this problem? Thanks.

  40. February 25th, 2015 at 13:06 | #41

    @Izco
    Could you try to call getWiimotePitch() and getWiimoteRoll instead? Does it only happen when the Nunchuck is connected?

  41. Izco
    February 25th, 2015 at 19:34 | #42

    @Lauszus
    The change produces the same result. The problem (always 180ΒΊ roll and pitch) happen when the Nunchuck is not connected (only the first light of wiimote is ON) and wiimote is not motion plus (second light is OFF). If the Nunchuck is connected (first and third lights ON), then everything works fine.

  42. March 5th, 2015 at 21:24 | #43

    @Izco
    Hmm okay. I haven’t got the old Wiimote (borrowed it from a friend), so I can’t test it right now. Can you try another dongle? Or post your serial output when you connect to the controller? Please remember to enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging.

  43. Daniel
    March 6th, 2015 at 23:17 | #44

    @Lauszus

    Is there any possibility of having the wii balance board supported?
    I have been trying to add support for a project but without success.
    I have been successful paring with the wiimote but need similar capability with the balance board.
    any help/advice would be greatly appreciated

  44. March 9th, 2015 at 22:52 | #45

    @Daniel
    I haven’t got access to one, so that is why I haven’t added support for it.

  45. Daniel
    March 12th, 2015 at 12:16 | #46

    @Lauszus
    Hmm, well would it be possible to hire you to add support +/- send you a balance board?
    This is potentially the incorrect forum for such a discussion however I would love to get the balance board up and running and think that there would be others that would appreciate support for their projects. Let me know if this is possible
    Thanks
    Dan

  46. March 15th, 2015 at 00:27 | #47

    @Daniel
    Yes that is possible. Please contact me by my email: kristianl@tkjelectronics.com.

  47. kodiakbear32
    March 25th, 2015 at 21:56 | #48

    @NicoHood
    Did you ever figure out the issue with the pro-controller not registering button presses until after a power cycle? I am having the same issue. Not a huge deal just a little annoying.
    Thanks

  48. NicoHood
    March 26th, 2015 at 18:30 | #49

    No. I never had time to look into the code. I was more focused on USB Device rather than HOST mode. And since I got even more busy I think it wont ever have a chance to look into the code. Sorry.

  49. April 16th, 2015 at 16:02 | #50

    @kodiakbear32
    @NicoHood
    @Izco
    I believe I found the bug that was causing the issue. Please see: https://github.com/felis/USB_Host_Shield_2.0/commit/9cb31799a8f14e5036ad35f06ff5502ba7dcc4b6.

    Note that it is currently only in the WiiBalanceBoard branch: https://github.com/felis/USB_Host_Shield_2.0/tree/WiiBalanceBoard, but should be merged into master shortly.

  50. NicoHood
    April 16th, 2015 at 16:35 | #51

    Great! Have not tested it but thanks for the note. I really have no time for USB-Host sadly.
    Once ive finished with my HID-Project and HoodLoader2 I will present a simple Wiiu to USB adapter as ive done with the Gamecube controller.

    But you could also built this yourself. Seems i’ve never posted my project here:
    https://github.com/NicoHood/HID
    https://github.com/NicoHood/HoodLoader2
    https://nicohood.wordpress.com/2015/02/10/diy-gamecube-to-usb-pc-adapter-with-arduino/

  51. April 16th, 2015 at 17:55 | #52

    @NicoHood
    Okay should be pretty straightforward with your enchanted HID functionality! I will properly use it in the near future to emulate the Wii Balance Board.

  52. July 6th, 2015 at 21:37 | #53

    Hello, I’m french.

    Thank you for work and share.
    I want connect a chinese wiimote (http://fr.eachbuyer.com/remote-and-nunchuk-controller-set-for-nintendo-wii-game-p3452.html) on my arduino UNO.

    i use Wii.ino.
    I put 1 button and 2 button together. Wiimote Blue leds flash.
    I start the arduino.
    In the Serie monitor i have : Wiimote Bluetooth Library Started
    and that’s all.

    I was test with 2 differents wiimote.

    Can you help me?

    My Bluetooth dongle (http://www.banggood.com/Wholesale-Super-Mini-Bluetooth-2_0-Adapter-Dongle-Vista-Compatible-p-29703.html) is connected to USB shield V2 (http://www.banggood.com/USB-Host-Shield-Compatible-Google-Android-ADK-Support-UNO-MEGA-p-90129.html)

    USB_desc.ino result is:
    Device descriptor:
    Descriptor Length: 12
    Descriptor type: 01
    USB version: 0110
    Device class: E0
    Device Subclass: 01
    Device Protocol: 01
    Max.packet size: 10
    Vendor ID: 0A12
    Product ID: 0001
    Revision ID: 0134
    Mfg.string index: 00
    Prod.string index: 00
    Serial number index: 00
    Number of conf.: 01

    Configuration descriptor:
    Total length: 006C
    Num.intf: 02
    Conf.value: 01
    Conf.string: 00
    Attr.: 80
    Max.pwr: 32

    Interface descriptor:
    Intf.number: 00
    Alt.: 00
    Endpoints: 03
    Intf. Class: E0
    Intf. Subclass: 01
    Intf. Protocol: 01
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 81
    Attr.: 03
    Max.pkt size: 0010
    Polling interval: 01

    Endpoint descriptor:
    Endpoint address: 82
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 00

    Endpoint descriptor:
    Endpoint address: 02
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 00

    Interface descriptor:
    Intf.number: 01
    Alt.: 00
    Endpoints: 02
    Intf. Class: E0
    Intf. Subclass: 01
    Intf. Protocol: 01
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 83
    Attr.: 01
    Max.pkt size: 0000
    Polling interval: 01

    Endpoint descriptor:
    Endpoint address: 03
    Attr.: 01
    Max.pkt size: 0000
    Polling interval: 01

    Interface descriptor:
    Intf.number: 01
    Alt.: 01
    Endpoints: 02
    Intf. Class: E0
    Intf. Subclass: 01
    Intf. Protocol: 01
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 83
    Attr.: 01
    Max.pkt size: 0009
    Polling interval: 01

    Endpoint descriptor:
    Endpoint address: 03
    Attr.: 01
    Max.pkt size: 0009
    Polling interval: 01

    Interface descriptor:
    Intf.number: 01
    Alt.: 02
    Endpoints: 02
    Intf. Class: E0
    Intf. Subclass: 01
    Intf. Protocol: 01
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 83
    Attr.: 01
    Max.pkt size: 0011
    Polling interval: 01

    Endpoint descriptor:
    Endpoint address: 03
    Attr.: 01
    Max.pkt size: 0011
    Polling interval: 01

    Addr:1(0.0.1)

  53. July 6th, 2015 at 21:40 | #54
  54. Nickhil
    July 11th, 2015 at 08:54 | #55

    I have been trying for a while now but I’m not able to connect the wiimote to the arduino. I am using the example code, my usb dongle works (tried with a playstation controller and is the recommended one), my reset pin and pin 7 are connected and I do have external power (sparkfun shield). I am using the newest version of the library on github. It wont work for some reason though. I’ve tried both using the pair button and pressing both the 1 and 2 buttons simultaneously. A little confused here.
    -Nick

  55. July 11th, 2015 at 11:03 | #56

    @Nickhil
    Please enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging and post the output.

  56. Mike
    July 17th, 2015 at 17:11 | #57

    Hi, thanks for your work. I’m having trouble pairing my wiimote to the arduino, I’ve set ENABLE_UHS_DEBUGGING 1 but all I see in the serial monitor is “Wiimote Bluetooth Library Started” and nothing else. My setup is Arduino UNO + Arduino usb host shield + the recommended bt dongles (I have 2) + stock wiimote. I also have a Arduino MEGA to test with. I’ve tested the mouse example and it is working fine, but I can’t get my wiimote to work (or pair at all). Is there something else I gotta setup than just plugging the shield and dongle in and loading the sample program? Thanks a lot

  57. July 18th, 2015 at 21:36 | #58

    @Mike
    Please uncomment this line: https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp#L20 and post the output.

  58. AndyW
    August 24th, 2015 at 20:48 | #59

    Hi Kristian,

    I’m hoping you can help me with a problem I’ve got attempting to connect to a Wii Balance Board.

    I’m using an Arduino Uno with a USB Host Shield and a BT dongle.

    The Arduino refuses to connect to the board when I press the sync button and produces the following debug:-

    Wii Balance Board Bluetooth Library Started
    BTD ConfigureDevice
    BTD Init
    Addr: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 81
    Attributes: 03
    MaxPktSize: 0010
    Poll Intrv: 01
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 82
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Endpoint descriptor:
    Length: 07
    Type: 05
    Address: 02
    Attributes: 02
    MaxPktSize: 0040
    Poll Intrv: 00
    Bluetooth Dongle Initialized
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:15:83:0C:BF:EB
    Starting inquiry
    Press 1 & 2 on the Wiimote
    Or press the SYNC button if you are using a Wii U Pro Controller or a Wii Balance Board
    Number of responses: 1
    Class of device: 00 25 04
    BT Addr: A375B0F32400

    Wiimote found
    Now just create the instance like so:
    WII Wii(&Btd);
    And then press any button on the Wiimote
    Check remote name
    Remote Name: Nintendo RVL-WBC-01
    Wiimote is connecting – Wii Balance Board
    Setting state to HCI_CONNECT_DEVICE_STATE
    Connecting to Wiimote
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B
    HCI Command Failed: 0B

    Can you help me out here with the connection error ?

    Thanks,

    Andy.

  59. AndyW
    August 24th, 2015 at 20:49 | #60

    @AndyW

    (I’ve added some of my own debug lines too just in case some of the output isn’t what you’re expecting)

  60. August 24th, 2015 at 22:09 | #61

    @AndyW
    Please see: https://github.com/felis/USB_Host_Shield_2.0/issues/169. Unfortunately you will just have to try another dongle.

  61. AndyW
    August 25th, 2015 at 08:35 | #62

    @Kristian Sloth Lauszus

    Thanks for the quick reply!

    I’ve tried a couple of dongles, I guess I’ll have to try and source one from the list.

    One thing which I was confused about though. It looks like the hci_connect() call which results in the failure state is passing a PIN value based upon the MAC address of the Wii Board. Looking at the Wiimote Wiki it mentions that if the sync button is pressed then the connect/pair attempt should be based upon the MAC address of the host.

    “If connecting by holding down the 1+2 buttons, the PIN is the bluetooth address of the wiimote backwards, if connecting by pressing the “sync” button on the back of the wiimote, then the PIN is the bluetooth address of the host backwards.” *

    Is the Wii board different in this regard or have I just got the wrong end of the stick (I’m not a Bluetooth protocol guru by any means).

    Thanks,

    Andy.

    * http://wiibrew.org/wiki/Wiimote#Bluetooth_Pairing

  62. August 25th, 2015 at 13:47 | #63
  63. AndyW
    August 31st, 2015 at 16:03 | #64

    @Kristian Sloth Lauszus

    I can report back that the Trendnet TBW-107UB dongle (as listed on the compatible dongle list) does indeed work πŸ™‚

    Local Bluetooth Address: 00:15:83:D0:FF:9E
    Wait For Incoming Connection Request
    Class of device: 00 25 04
    Incoming Connection Request
    Remote Name: Nintendo RVL-WBC-01
    Wiimote is connecting – Wii Balance Board
    Connection Established:

    Connected to Device: 00:24:F3:B0:75:A3
    HID Control Incoming Connection Request
    HID Control Successfully Configured
    HID Interrupt Incoming Connection Request
    HID Channels Established
    Checking if a Motion Plus is connected
    Extension connected
    No Motion Plus was detected
    Checking if there is any extension connected
    Wii Balance Board connected
    Wait For Incoming Connection Request
    Reading Wii Balance Board calibration values
    Wii Balance Board calibration values read successfully
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.00 0.00 0.00 0.00 Total Weight: 0.00
    Weight: 0.25 0.22 1.76 2.00 Total Weight: 4.23
    Weight: 0.40 0.31 2.19 2.47 Total Weight: 5.36
    Weight: 0.40 0.31 2.19 2.47 Total Weight: 5.36
    Weight: 0.40 0.31 2.19 2.47 Total Weight: 5.36
    Weight: 0.40 0.31 2.19 2.47 Total Weight: 5.36
    Weight: 0.55 0.42 2.62 2.83 Total Weight: 6.42
    Weight: 0.55 0.42 2.62 2.83 Total Weight: 6.42
    Weight: 0.73 0.59 2.96 3.16 Total Weight: 7.45
    Weight: 0.73 0.59 2.96 3.16 Total Weight: 7.45
    Weight: 0.73 0.59 2.96 3.16 Total Weight: 7.45

    w00t!

  64. August 31st, 2015 at 16:15 | #65

    @AndyW
    Awesome πŸ™‚

  65. Dan
    December 4th, 2015 at 14:43 | #66

    Hi

    I was using the library, but my wiimote wouldn’t pair with this, so I tried enabling serial debugging as suggested here, but now the Arduino IDE displays an error message saying that the program is too large. My board is an Arduino Uno R3. Is there any way to fix this?

  66. December 4th, 2015 at 20:53 | #67
  67. Dan
    December 5th, 2015 at 18:33 | #68

    @Kristian Sloth Lauszus
    Thanks for the quick reply! That fixed it and it works now. (sorry if I sent the message twice but I wasn’t sure if it sent the first time).

  68. December 6th, 2015 at 18:52 | #69

    @Dan
    You’re welcome πŸ™‚

    No problem. We have to accept the first comment in order to prevent spam messages.

  69. Tony
    March 25th, 2016 at 07:32 | #70

    Hi Kristian,
    I hope you can help me with this problem

    I’ve connected wiimote to my Arduino Mega 2560 and give following debug


    Remote Name: Nintendo RVL-CNT-01
    Wiimote is connecting
    Connecting to Wiimote
    Connection established
    Connected to Wiimote
    Received Key Request
    Pairing with Wiimote
    Pairing successful with Wiimote
    Send HID Control Connection Request

    That’s all, and didn’t give another feedback. How to fix this? What’s my next step?
    Thank you..

  70. Tony
    March 25th, 2016 at 07:37 | #71

    I’m sorry I haven’t read previous comment at 1st page which has same problem.

  71. March 27th, 2016 at 08:53 | #72

    @Tony
    So does this mean that you solved the issue?

  1. No trackbacks yet.