LabVIEW Robotics Documents

Showing results for 
Search instead for 
Did you mean: 

LabVIEW interface to a Wii Remote ("Wiimote")

by sshearman on ‎02-12-2008 02:33 PM

With a high-resolution camera, a 3-axis accelerometer, buttons, speaker, LEDs, vibration feedback, and a Bluetooth wireless link, the Nintendo Wii Remote Controller ("Wiimote") offers exciting possibilities beyond use as a video game controller for the Nintendo Wii video game console. With the examples in this document, you can easily access these data sources in NI LabVIEW.

The attached zip file includes a LabVIEW project with examples that show how you can access a Wiimote with LabVIEW.

Getting Started

  1. Download and Unzip the attached file into a new folder.
  2. IMPORTANT: These examples rely on a third party .NET Managed Library called “WiimoteLib” to establish the link. This library is freely downloadable from this site: http://www.codeplex.com/WiimoteLib. The download includes a version of WiimoteLib that I used to build the examples--you may want to check the WiimoteLib site for a newer version. Ensure that the dll ("WiimoteLib.dll") from the managed library is in the same folder as the files that you unzipped.
  3. IMPORTANT: Establish a Bluetooth link "pair" with the Wii controller and your PC. The specific instructions for doing so will depend on the specifics of your Bluetooth software / hardware. (I found some instructions for how to do so in the "Getting Connected" section of this article.)
  4. Open the LabVIEW project file WiimoteExamples.lvproj in LabVIEW and access the examples from the project explorer window.
  5. If you are new to LabVIEW, start with the examples Simple Flash LEDs (Polled).vi and Simple Acquisition (Polled).vi. These contain the simplest LabVIEW programming of the example set. The Simple Acquisition (Polled).vi example polls for new data (accelerometer data and button status) from the Wiimote within a loop.
  6. The example Roll Pitch (Event).vi contains more involved LabVIEW programming, but is a more efficient implementation that relies on event callbacks to acquire the Wiimote state.  The example registers a callback VI to acquire accelerometer data and button status from the Wiimote as it is available. It's more involved than the polling in a loop method of the Simple Polled Acquisition.vi example, but it's more efficient and returns events as they occur.
  7. The example Acquisition + IR (Event).vi registers a callback VI to acquire accelerometer data, button status, and IR camera data from the Wiimote as it is available. Uses a picture control “IR Camera” to display the location of the IR sources from the IR flashlight bar.  The IR Camera display will be blank unless Wiimote is pointed at a pair of valid IR sources (such as those from the IR flashlight bar).
  8. For LabVIEW programming help, be sure to see the comments found on the block diagrams.
  9. Have fun.

Wish List

  • In an ideal world, with infinite time to code for fun I might address the following. Lacking infinite time, I’ll present these as ideas for future development…
  • The current code returns basic X, Y, Z acceleration values and some simple trig is applied to convert these values to roll and pitch. The conversion routine isn’t ideal and has at least a few problems. For instance, it jumps to incorrect orientation when the Wiimote is rotated more than 180 degrees on one axis. Another issue is that one axis will lose precision when a related axis is tilted close to an extreme.
  • Apply data from the accelerometers and the IR camera for better absolute position measurement
  • Interface with the WiiMotionPlus
  • Analyze the accelerometer / IR data to identify “gestures”—patterns of motion.
  • Access the vibration feedback output of the Wiimote
  • Access the sound output of the Wiimote (see Wii Remote "Wiimote" Speaker Functionality (with action engine and acceleration/IR data access for f...)
  • Access data from a Nunchuck connected to your Wiimote
  • Access data from Drums / Guitar controller

Note

This thread includes discussion related to the example code posted here and also references another LabVIEW to Wiimote interface example.http://forums.ni.com/ni/board/message?board.id=170&thread.id=249428&view=by_date_ascending&page=1

Release Notes

6/4/2009

  • Filename: WiimoteManaged(wml17).zip
  • Removed Older 1.5.2
  • Examples more consistently named, revised documentation
  • Added example showing how flash the LEDs

3/11/2009

  • Filename: WiimoteManaged(wml17).zip
  • Relies on WiimoteLib Ver 1.7
  • Examples more consistently named
  • Added example showing how to access multiple Wiimotes
  • Added example showing how to access data from a Nintendo Balance Board. (Note that this support is untested, as I don’t actually own or have access to a balance board!)

Initial release (8/2008)

  • Filename: WiimoteManaged(wml152).zip
  • Relies on WiimoteLib Ver 1.5.2
Comments
nighthawk0501
N/A

Additional Wii-mote developments can be found here;

www.cs.cmu.edu/~johnny/projects/wii/

jcz
N/A

Is there any chance of having version for LV 8.2 ?

po0
N/A

there is a problem with the IR data acquisition rate both for Polling and Event driving methods.  The acquisition rate drop from 100Hz down to 20 Hz in few minutes. I have tried different bluetooth adapters and no help. Please help why the acquisition rate drop and any solution?

sshearman
N/A

Haven't seen this problem. My first thought would be that it is related to the Bluetooth driver software that you are using. I know you mentioned that you had tried different bluetooth adaptors, but did you also try different bluetooth driver software e.g. Bluesoleil versus Microsoft built in?

My experience has been that adaptors that work with the BlueSoleil bluetooth driver  software seem to be the most robust.

macaba
N/A

For information on doing Step 3 automatically (pairing with the Wii Remotes), please see my Example here

muks
N/A

WOW!! I am really eager to try it out. Will do just that and getback

macaba
N/A

Ok, I couldn't resist going further with this- speaker functionality

tom1234
N/A

Hi

I'm using the Vi provided and trying to save the values to a file. There is a problem because the timing values are repeated twice or more when i saved the IR values. Any idea on how can i solve this issue?

limpeh
N/A

Excellent discovery...Happy New Year.Finally found an idea for my fyp...Thanks bro

SaeedMech
N/A

Hello to every innovation lovers.Check it out !! hope it will be useful and enjoyable :

http://youtu.be/bl55bCb2gqg

Cheers

aavazmay
N/A

Congratulations from Argentina! Saw your video, it's great. I'm doing a similar project, I hope you can get me some small doubt, I'm a newbie labview.Saludos from Argentina!

A.Hakim
N/A

Hello

Good Job

When I tried it using my Wii Remote, after I got it paired to my PC

and when I ran any of your examples I got the following error

Error calling method WiimoteLib.Wiimote.Connect, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

          Inner Exception: WiimoteLib.WiimoteException: Timed out waiting for status report) <append><b>WiimoteLib.WiimoteException</b> in subInitWiimote.vi->Simple Acquisition (Event).vi

hope to know why and solve

thanks

rfandrade
N/A

Hello,

some of the functions are not working for me, the error out prints "Code:-1 Source: Wiimote Set Output Report.vi".

I've tried to found what was wrong, but when running the Highlighted Mode, for example, it show the error only after this subvi, and I'm not able to find what's wrong.

What can I do?

Thanks


sshearman
N/A

Probably a bluetooth pairing problem. Ensure your Wiimote is paired with your PC before using these VIs.