Saturday, 5 November 2011

Building a interactive multi touch surface on the cheap using a Wiimote

Interactive projectors are beginning to come a critical part of both education and presentation, I certainly enjoy using them to play out different networking scenarios, draw over network diagrams and give demonstrations. The key drawback to installing this technology is the expensive, interactive whiteboards such as smart or starboards are very expensive and multi touch interfaces are even costlier.

The next step in the interactive whiteboard revolution is the interactive table. Manufactures like Smart Tech are beginning to get into this field more aggressively but the technology is even more expensive than its wall hanging cousin.

The table brings the projector to a new level, you can write as if you were writing on paper and draw images with much more detailed brush strokes. It also has the potential to be more engaging with people sitting closer to the presentation and being more involved.

Thanks to the pioneering work of Johnny Chung Lee we can all have access to this great technology at a fraction of the cost. While it is not as polished as a commercial product, it is very usable and more than suitable for a wide variety of  uses.



What you need
  • A Windows 7 system (preferably 32bit) with bluetooth adapter.
  • A projector - I am using an old, end of life projector
  • Some form of mount for the projector.
  • A Wiimote.
  • Software: MultiTouchVista - WiiTUiO - WiiScan
  • An infrared pen, you can buy one from a site such as infraredpens.com or build your own.
  • Optional: A remote on/off switch and AC power modification to the Wiimote
  • Optional: my WiiSync script to automate the launching process



The Challenges ahead

The most challenging part of this configuration is making it easy to use for the end user, if its not easy, they won't use it. As I am installing this unit into an area where multiple users want to use it, it must be extremely easy to use.

The main problems that we need to address are:

Problem
How can we ensure the Wiimote stays paired with the PC's bluetooth adapter? 
Solution
Thanks to a project called WiiScan, we can make the Wiimote remember the bluetooth connection. In most other Wiimote projects a fresh synchronization is established every time the Wiimote connects to the PC. In this scenario the Wiimote never attempts to connect to the PC, the PC always initiates the connection, this adds an extra configuration step for the end user. WiiScan helps us save the synchronization settings in the Wiimote, so every time you turn on the Wiimote and press 1+2 it will attempt to connect to the PC.

Problem
How does the end user turn on and synchronize the Wiimote without misaligning it?
Solution
If the user has to touch the Wiimote no matter how careful they are, eventually it will misalign. I am going to run an extension lead to the Wii's power input via an on/off switch. This will let me connect an AC adapter to power the Wii and allow the user to turn it on and off without ever touching the Wii itself. Furthermore I am going to "jam" on the 1+2 buttons, so as soon as the Wii is turned on, it initiates a synchronization with the PC. 

Problem
How does the end user connect the Wii to the PC with minimum interaction or technical skill?
Solution
The multi-touch interfaces relies on a piece of software called WiiTUiO. WiiTUiO works extremely well but requires the user to first launch it, then tick 2 boxes and press connect in the right order. I have chosen to write a simple AutoIt script that will handle the configuration of WiiTUiO.




Hardware Modifications and Setup

Further to the power/sync modifications I decided it was necessary to "jam" on the 1+2 buttons, this means as soon as someone turns the Wiimote on with the remote on/off switch it will try to connect to the PC.

The Pens
I have built my own infra-red pens, which is really simple to do. You can buy a  infra-red LED from your favourite electronics store (the more powerful, the better), some wire, a AA battery and a click switch and then fit them into a pen or highlighter. The pen builds are out of the scope of this tutorial, but there are lots of great tutorials explaining how to do it.


Further Modifications
Boon Jin has some great tutorials on adding extensions to both the power and red sync button.

Included are some pictures of my further modifications.

Battery lead extension for AC power and switch

Solder points for remote sync button

Remote On/Off and Sync switch


Software Setup

1. Boot your system, copy WiiTUiO, MultiTouchVista (works with Windows 7) and WiiScan onto your computer. Ensure you have a bluetooth adapter installed.

2. Our first task is to installed the MultiTouchVista driver and configure it. MultiTouchVista is the driver that takes our Wiimote from a humble single touch device into a multi touch monster. Under the "multitouchvista" folder, navigate to "Driver" and then "x32" for 32bit or "x64" for 64bit.

3. Run the "Install driver.cmd" to install the base driver.

4. Once the installation is complete. Open "Device Manager", navigate to "Human Interface Devices" and select "Universal Software HID device". Right click "Universal Software HID device" and select "Disable", then immediately "Enable" it again.

Disabling and re-enabling this driver triggers the appropriate services to restart and lets us move onto step 5. If you fail to disable/re-enable it, the following steps will fail.

5. Next we need to configure MultiTouchVista to use the TUIO protocol. To do this navigate to the "multitouchvista" folder and start the "multitouch.service.console.exe", leave it running and also launch "multitouch.configuration.WPF.exe".

6. The default configuration will be "MultipleMice". Select the "Tuio" option from the Available Devices list, then click the blue arrow. At this point "Tuio" should be listed under "Active Device", click "Restart Service". You can now close both windows.

7. Next we need to use WiiScan to create a semi-permanent connection between the Wiimote and the PC. Before we proceed, if you have already connected your Wii to the PC, go into the bluetooth devices list and delete the Wiimote or the next step will fail.

8. Open Wiiscan by launching "wiiscantray.exe". Next promptly press the red synchronization button on your Wiimote and select "Register Wiimote" from WiiScan.

After waiting for about a minute, the confirmation box should appear saying the connection was successful. If it does not, please repeat the process a few times until it pairs successfully.

9. The hard work is done, the Multi Touch driver is configured and the Wiimote has a semi-permanent pair with the PC. Now we need to launch the WiiTUiO software to process the multi touch events.

Launch WinTUiO and tick both "TUIO Multi Touch Evnets" and "Win 7 Multi Touch Events" then press "Connect". If it reports the connection has failed, press the 1+2 buttons on your Wiimote to ensure it is connected to the PC and then try pressing "Connect" again.

10. The last step in the process is to hit "Calibrate" and go through the calibration process. At this point you can also adjust your Wiimote to get the best coverage of your touch area.



Making life easy for the end user

As I mentioned earlier I am planning to put this multi touch table in a heavily used area where different users will be using it all the time. To make things easier I have written a very simple AutoIt script. I don't claim for a minute to have any scripting skills so I am sure this can be cleaned up nicely.

Click here to download the script

Please ensure you put WiiTUiO in a folder called c:\wiimote, also put beyond logic's process.exe in the folder. For this to work perfectly you should also apply the following registry edit, this edit ensures the WiiTUiO icon doesn't get hidden in the systray, which is something my dodgy script relies on!

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v EnableAutoTray -t REG_DWORD /d 0 /f


The process for the end user is extremely simple:

1. Click on the compiled WiiSync script.

2. The WiiSync script asks you to flick the "on/off" switch and then press "OK".

3. The WiiSync script briefly disables keyboard/mouse input and sets up WiiTUiO.

4. The user is then informed they can begin using the touch interface.



The Cost

The biggest cost is obviously a projector if you don't already have one, but an old projector that is too weak for other areas will work perfectly.

The other costs for my project are:

Build cost of pens - $10
Wiimote - $50
Bluetooth Adapter - $5
Remote on/off switch - $7
Materials for future mount - $30
Total - $92



Troubleshooting

I found with certain bluetooth adapters I simply couldn't get the connection to be consistent. On the HP laptop I was initially using, the built-in bluetooth adapter would only give me 1 minute of connectivity before I had to repeat the pairing process. I tried a number of different bluetooth stacks, driver versions and configurations, none of which worked.

As soon as I changed to a $5 bluetooth adapter from ebay, things worked perfectly. If you are having issues with pairing you will need to experiment with different bluetooth stacks (bluesoleil seems to be the stack of choice for most people), change the adapter or both.

Some users also reported issues installing VistaMultiTouch if they had previously uninstalled it. This is due to the windows service that VistaMultiTouch leaves behind, your should be able to resolve that problem by opening a command prompt and typing: 

sc delete unisofthid

Then try the driver installation again.



In Action

Here are a few pictures and a youtube video of my set-up in actio. The Windows 7 Multi Touch Pack is a great way to show off this technology, Microsoft Onenote and even Paint also work great.



4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi, I am using w7 64 bits and getting an error in point 8...
    Wiiscan is telling me "wiiscan wiimote not found in hid device list".
    What about the bluetooth dongle, why did you never mentioned it in your tutorial?
    Could I use Bluesoleil instead? I am experimenting with this project for a long time already. Please try to help me.
    Thanks!

    ReplyDelete
  3. Hi mate,

    I am just using some generic cheapo usb from ebay,

    You can try bluesoleil but I didn't have luck with it. Well actually bluesoleil works very well, but what it wouldn't do is automatically reconnect each time, something that I was able to achieve with the default Windows bluetooth stack.

    Did you do step 2 (MultiTouchVista driver), if you don't do this step, or it fails then you will get the error you are recieving

    Also you can try typing "sc delete unisofthid" into a command prompt, then re-installing the MultiTouchDriver

    ReplyDelete
  4. Dear James,
    I am trying over and over again to make my wii-touchboard multitouch, but for any other reason it doesn't work. Can you help me please? I will tell you step by step what I have done.

    1. I made and connected the hardware. The IR-pens work, the wii-controller is connected and I can use the pens by touch on the projector screen. Only one pen works at the same time (like my mouse cursor on the computer).

    2. I downloaded and installed MultiTouchVista: I installed the driver, and disabled and enabled the Universal Software HID device. After this, I opened the "multitouch.service.console.exe", left it running and also launched "multitouch.configuration.WPF.exe". I tried several things in this step: pushed the MultipleMice button and blue arrow, selected and deselected the configure device option "Block native window mouse input....." as well as for the Tuio option.

    With doing this, I get 3 red dots on my screen. One is linked to my laptop's touchpad, on to my computer mouse and one to one IR pen. Nevertheless, none of them got a multitouch function.

    If I next launch the WiiTUIO.exe (otherwise it will not appear in my windows toolbar to edit the TUIO settings), there will not happen anything. I select the 2 options in the TUIO settings, and it says I am connected. It also shows the battery level of the Wii-controller. Still it is not multitouch.

    What am I doing wrong?? I hope you can find the mistake I've made! I am trying it for a long long time now and am trying to combine all possibilities, but nothing works! The only thing I want to do is to be able to use 2 or more pens, so we can zoom in and out and turn pictures, etc.

    Thank you so much!

    Wendy

    ReplyDelete