Author Topic: Permanent wiimote sync: HOW TO DO IT!  (Read 53402 times)

Offline Carsten Frigaard

  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
on: June 10, 2009, 07:28:58 AM
There have been a lot of activity regarding the permanent synchronization between a Windows PC and a wiimote. I made some test, and finally found a working solution!!!

Please see the "README_FIRST" text below, or just goto

to get the source files and binaries for a Windows XP PC. The code is able to permanently pair a wiimote and a PC. After a registration you only need to press "1-2" on the wiimote to reestablish the connection. It even stays connectable even after a PC shutdown/restart.

The code is still in demo phase, specifically I just encountered a problem, when there are more BT radio in close vicinity of the wiimote.

And if anyone know how to check for an established connection (like the one you see in the BT device list gui: "Connection established")  programatically, then I am all ears!!

Any comments or test results are naturally welcome...


README_FIRST text  (from the zip file):

Copyright 2008 MergeIt, Aps.
License GPLv3+: GNU GPL version 3 or later <http:\/\/>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby granted, provided that
the above copyright notice appear in all copies and that both that copyright notice
and this permission notice appear in supporting documentation.

   a connection utility for wii console remotes - this version is rewritten to
   encompass permanent pairing of a wiimote and a Windows PC.

   1.0 demo, (note that the source is not "cleaned" up yet)

   Just run bin/Release/wiiscantray.

   Right-click on the trayicon to see menu; use register to pair a wiimote;
   use unregister to remove the pairing.

   Be sure to unregister all wiimotes, before doing a fresh paring.

   IMPORTANT: Modify the address in the Release/wiiscan.ini file to make the
   connection more robust: replace the line "allowed_wiimote_adr=00:00:00:00:00:00"
   with your specific address, like "allowed_wiimote_adr=00:22:D7:94:13:2B".

   The paring between a wiimote and a PC consist of:
      1: Hard-syncing the wiimote, to get it to know the PC bluetooth address.
      2: Establish a paring-key between the wiimote and the PC. This is initiated
         on the PC side, using the bluetooth adapters MAC address as key. The
         PC BT radio key could be something like "00:50:B6:A0:48:8C", such that
         the paring key gets to be:

            // adr of btadapter
            WCHAR pass[6];

         in c-code, and what is then needed is a simple call to the authentication
         procedure, like

            DWORD r=BluetoothAuthenticateDevice(0,hRadio,&bdi,pass,6);

         The problem of entering some hex values in a GUI paring window, is hence
         solved by programmatic doing the same thing. BT address entries of the
         form ":00:" is also only (and always) encountered in the end of the address.
         Notice also that the BT MAC address is read from the right to the left, that
         is from least-significant-byte to most-significant-byte (this explains some
         of the confusion regarding "reversing the MAC address byte order").
      3:   Once a pairing have been established, it persist! Check the pairing status
         by looking into the Bluetooth device properties.
      4:   Powering the wiimote down and up; that is pressing the power-button for a
         couple of seconds, and then pressing a soft-sync button, like "1-2",
         immediately reestablish   the connection. No software external software is
         involved in this process, but the wiiscantray will try to continuously
         monitor the connection.

      5:  And, voila...from here you can run all the Whiteboard software.

   Once paired, the wiimote and PC keeps the pairing information, and it as such
   persist through both a PC shutdown/restart and wiimote power-down (press the
   wiimote power button for a couple of second) and soft-resync, that is a "1-2"
   keypress or   likewise.

   A peculiarity in the pairing process, is that it only seems to work stable after
   a long period, say a minute. Hence the software wait a long time, such that the
   connection is stable. This may be attributed to some unknown "Windows-features",
   but the long wait is only necessary at a hard-sync, so its really a minor
   problem. This problem may be attributed to the BT caching mechanism in Windows.

   Do not hard-sync the wiimote after a successful pairing.

   Old pairing to other computers are lost, as they should be, when paring the
   wiimote   with a new computer.

   Two PC in close vicinity, with unique wiimote pairing, do not interfere with
   each other.   They pair individual to their respective wiimote, as expected.
   The hard-sync registering phase, may however require a setup of a single online
   PC and wiimote only (not tested).

   A severe problem, is however, that the wiimotemay try connect with the BT
   address, of the lowest order. A current observed defect is that an otherwise
   perfect paired wiimote and PC may not be able to reestablish the connection if
   another, secondary BT adapter is switch on.   The problem needs to be futher investegated.
   The wiiscantray continuously polls the BT connection, using the MS Bluetooth API,
   but this may sometimes cause interference with the pairing. A better solution is
   on its way. You can exit the wiiscantray software immediately after a successful
   pairing, if you experience problems.

   .NET framework 3.5
   Windows XP or above.
   Microsoft Bluetooth stack.
   Bluetooth radio compatible with the wii-remote.

   If you are running a non-Microsoft Bluetooth stack (like Widcomm),
   you must follow the procedure found in the document doc/CHANGEINGBTSTACK.rtf

   The software was tested under these three setups:
      1: Lenovo Thinkpad R500
         XP professional, version 2002, SP2
         Trendnet TBW-102UB bluetoohg dongle (=Broadcom Ultimate Low Cost Bluetooth 2.0+EDR USB), driver 5.1.2535.0
         Microsoft BT stack, driver 5.1.2600.2180

      2: "bambus" PC
         XP professional, SP3
         Trendnet TBW-102UB bluetoohg dongle (=Broadcom Ultimate Low Cost Bluetooth 2.0+EDR USB), driver 5.1.2535.0
         Microsoft BT stack, driver 5.1.2600.5512

      3: eeePC (does not work 100% stable)
         XP Home,version 2002, SP3
         Azware BT252 bluetooth dongle, driver  5.1.2600.5512
         Microsoft BT stack, driver 5.1.2600.5512

      (Not tested yet: "bambus" PC
         Vista Buissnes
         Trendnet TBW-102UB bluetoohg dongle (=Broadcom Ultimate Low Cost Bluetooth 2.0+EDR USB)
         Microsoft BT stack, driver ??

   Not tested: multiple simultaneous wiimote connections to the same computer.

Offline Carsten Frigaard

  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Reply #1 on: June 11, 2009, 01:57:14 AM
Well, the trees does not grow into heaven: I encountered a problem regarding my solution in the previous post. One some PC's the pairing seems to be successful, but it is not persistent. This means that the PC and wiimote looses connection abilities again.

The reason for this behavior may be found in the Microsoft BT API, and I am currently investigating the issue. This also means, that the demo software may or may-not be able to create a permanent connection....please post you result here, if you try it out!


Offline benpaddlejones

  • Support Admin
  • *
  • Posts: 1178
  • Karma: +49/-0
    • View Profile
    • Inter.Connect.Ed
Reply #2 on: June 11, 2009, 06:17:50 AM
Carsten Frigaard
The joys of software development, this app looks fantastic, look forard to testing this w/end.

benpaddlejones :-)

See my full profile and links on my Google Profile:

Offline macman005

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #3 on: August 16, 2009, 10:51:40 PM
I get the message using the demo that the sync was successful but it's not a permanent connection.  I'm using the Microsoft Wireless Transceiver for Bluetooth 2.0 with the default Microsoft bluetooth stack. The computer is using Windows XP SP3.  I'd like to get it working so if there is any further debug information that could be provided let me know.

Offline Bizzy

  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Reply #4 on: August 17, 2009, 12:44:49 PM
Reliable permanent sync would be a BIG step forward for the project ! Keep up the good work.

Offline John Peterson

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #5 on: August 19, 2009, 12:21:56 AM
Very nice work Mr. Frigaard. Would it be possible to also emulate how the Wii is turned on and off to turn the Wiimote and the connection on and off quickly?

Offline jowbloe

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #6 on: October 31, 2009, 04:53:42 PM
Hi, the link appears to be dead. Any chance you could put it back up :)

Best wishes

Offline Aqualung

  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Reply #7 on: November 16, 2009, 09:04:39 AM
Hi, the link appears to be dead. Any chance you could put it back up :)

... And maybe you could investigate this in a Windows 7 environment as well, hopefully x64 :-)

Offline Metacore

  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Reply #8 on: January 11, 2011, 01:13:04 AM
I happen to have the file, it does actually authenticate the wiimote, and it seems to be open source, so I hopefully it won't be a problem if I uploaded it...
That is both the binary, a sample version of Wiimote Whiteboard that WiiScanTray works with, and the source itself, if someone needs it. Maybe someone else can figure out what's going on, since it does seem to authenticate, but not reconnect when needed. One thing you need to note is the wiiscan.ini file, where the MAC address of the intended wiimote is. The current filter should match your wiimote, but might not.

Also, as far as the program's function, this is what it does in Windows 7 x64
GlovePIE's Auto-connect

Registered with WiiScanTray

While it works after after the initial connection, once it disconnects, it never becomes reconnected again, though it continues to show it as "Authenticated."  I'm not a developer, so I'm not really sure what it means, but I'm guessing there is more to creating a permanent connection then just authenticating it, so even with authentication(which this does seem to provide) you'd still need some kind of auto-connect feature. That's just a guess though, hopefully someone with an SDK can actually look at the nitty gritty and shed some light.
« Last Edit: January 11, 2011, 01:51:21 AM by Metacore »