Skip to content

Wiimote (Nintendo Wii Remote)

Ravbug edited this page Jan 14, 2019 · 1 revision

If your computer has Bluetooth, you can control games with the Nintendo Wii Remote. The Wiimote has accelerometers, buttons, an infra-red camera, LEDs, vibration, a speaker, and storage for Miis. Or you can connect a Nunchuk (with joystick, two buttons, and accelerometers) or Classic Controller (with 9 digital buttons, two analog shoulder buttons, two joysticks and a D-Pad). Every feature is now supported. If you have Wii Motion Plus connected, then the Wii Remote also has 3 rate gyros.

Bluetooth

You need a Bluetooth adapter, unless your laptop has one built in. Cheap old Bluetooth versions work fine for Wii Remotes, but they won’t work at all for a SIXAXIS or Dual Shock 3. Those PS3 controllers require Bluetooth 2.0 or above. Different ones come with different Bluetooth drivers called Bluetooth Stacks. Some adapters allow you to install other stacks, some don’t. All Bluetooth stacks are very buggy. But different stacks have different bugs. Most Bluetooth stacks will now work with GlovePIE.

I strongly recommend using the Microsoft Bluetooth Stack, since GlovePIE 0.40 and above can now automatically connect to Wii Remotes when you use that stack. Autoconnecting also sort of works on BlueSoleil, but not as well. If you have Vista or above, then you will almost certainly have one of those two stacks.

The “bluetooth fix” menu item has been removed in GlovePIE 0.40, since GlovePIE now automatically detects which kinds of bluetooth writes to use.

To autoconnect, press or hold down the 1 and 2 buttons at the same time on each Wii Remote. Then wait. You can only autoconnect when GlovePIE first starts, or when you click on the GUI tab, or when you are running a script that uses more Wii Remotes than are currently connected. If you do it when GlovePIE first starts then all the LEDs will flash, but while running or using the GUI, the LEDs will show which player when they have finished connecting.

On BlueSoleil, the blue B icon in the system tray will turn green to show that it is connected. On Microsoft, you will see a balloon showing that a device has been discovered and connected.

Note: BlueSoleil is buggy and unstable, and this feature may cause GlovePIE to stop responding for a while, or may not work sometimes, or sometimes causes BlueSoleil to beep the PC speaker. If this feature causes problems for you, you can disable it by checking the TroubleShooter > No Auto-Bluetooth Connect menu in GlovePIE.

Note: The Microsoft stack is also a little buggy and unstable, and sometimes autoconnecting will make Windows pop up a dialog box saying that you need to restart your computer for settings to take effect. That box is a LYING bug! Don’t restart your computer, just click “Restart Later”!

Note: Once a Wii Remote is connected, you need to remember to disconnect it later by holding down the Power button on the Wii Remote, otherwise it will drain your battery! Just because the LEDs are off, doesn’t mean it is disconnected!

You can show the Bluetooth window by choosing the CP-Settings > Bluetooth menu in GlovePIE.

To connect Wii Remotes manually, you need to start the Bluetooth program, hold down the 1+2 buttons on the Wiimote, tell your Bluetooth program to search for devices, then when it finds a device either tell it to search for services and connect to the HID service, or tell it to connect. There is no PIN (actually the PIN is your computer’s bluetooth address backwards converted to Ascii characters, but it’s impossible to use the PIN because it contains NULLS) so tell your Bluetooth program to skip the PIN step, or not to use a PIN. Only after it is completely connected, can you release the 1+2 buttons.

You can disconnect a Wiimote at any time, whatever Bluetooth Stack you use, by holding down the Wiimote’s power button. GlovePIE does not have to be running for that.

Normally only connected Wiimotes will show up in GlovePIE.

Using the Wiimote in GlovePIE

NEW! When you run a script, and a Wiimote is initialising it will show the first and last lights. It will then show the player number once it is ready. If it shows the middle 2 lights it means it is calibrating the gyros in the Wii Motion Plus, and you should keep the Wiimote as still as possible (preferably on a table).

GlovePIE 0.40 now supports lots of gestures! The gestures can even be automatically recognised by using the GUI.

You can use the GUI to assign the Wiimote’s actions, or you can use scripting with the “Wiimote” object. The GUI has an advanced automatically detect input feature. The GUI is easy, but it can’t edit or create anything too complex. You should use scripting to make fancier scripts.

GlovePIE now supports an unlimited number of Wii Remotes, but only 7 per bluetooth adapter. You need to have several bluetooth adapters if you want to connect more than 7 Wii Remotes.

In scripts you can access Wiimotes with “Wiimote” followed the number of the Wiimote, followed by a dot, then followed by the Wiimote property you want to use. eg. Wiimote1.Home If you leave out the number then it will assume you mean Wiimote1.

Buttons

The Wiimote has the following buttons, which are either true or false:

Up, Down, Left, Right, A, B, Minus, Home, Plus One, Two

The Power button, and the Sync button (hidden under the battery compartment) aren’t implemented yet.

Sensor Bar

The sensor bar is just a bunch of Infra Red lights which are always on. You can make your own fake sensor bar with candles, Christmas tree lights, or Infra-Red remote controls with a button held down. Or you can order a wireless sensor bar off the internet, or you can build your own. Or you can use your Wii’s real sensor bar, by connecting the Wiimote to the PC first, then turning your Wii on with the console’s power button.

There are new values for using the Wiimote’s IR sensor like a pointer:

PointerX, PointerY, PointerXY, PointerVisible, PointerOnScreen

Or you can individually read the position of the infra-red dots that the Wiimote can see with: wiimote.dot1x, wiimote.dot1ywiimote.dot4x, wiimote.dot4y

You can tell whether an infra-red dot can be seen with Wiimote.dot1vis to Wiimote.dot4vis

You can tell the size of a dot (between 0 and 15) with Wiimote.dot1size to Wiimote.dot4size

The size will always be reported as 16 if your script uses the Nunchuk or Classic Controller, because the report needs to contain more information.

LEDs

You can set the 4 LEDs on the Wiimote by setting:

Wiimote.Leds

to a value between 0 and 15. It is binary.

Or you can set:

Wiimote.Led1, Wiimote.Led2, Wiimote.Led3, and Wiimote.Led4

to either true or false individually.

Force Feedback

You can activate force feedback by setting:

Wiimote.Rumble

to either true or false

Speaker

You can play sounds on the Wiimote simply by setting these values:

Frequency, Volume

If you set Frequency to 0 it will switch the speaker off. If you set it to non-zero it will switch the speaker on again. The frequency is measured in Hz. Don’t confuse frequency with pitch, they are different in this context.

You can set the volume to a value between 0 and 2, (between 0% and 200% in other words). I don’t recommend setting it above 100% though, unless you want to go deaf.

You can also turn the speaker on and off by setting either of these values:

Speaker, Mute

Setting speaker to true switches on the speaker (slowly) and setting it to false switches off the speaker. Setting Mute to true mutes the speaker, and setting it to false un-mutes it. Using ”Mute” works faster than using “Speaker”. Note that you don’t need to turn the speaker on if you set the frequency, because setting the frequency to non-zero does it automatically. Turning sound on and off with mute is also faster than doing it by changing the frequency to 0.

You can also set the sample rate with this variable:

SampleRate

Currently GlovePIE only supports sample rates around 3640 Hz. Sample rates must be multiples of 280 added or subtracted from that value. The default is 3640 Hz. The sample rate is also measured in Hz. The sample rate will automatically increase if you set the frequency higher than 1820 Hz. There isn’t much point in changing the sample rate.

Nunchuck, Classic Controller, Guitar, Balance Board, etc.

NEW! GlovePIE 0.40 now sorts Balance Boards, Guitars, Drum Kits, and DJ Hero Turntables into their own separate categories! So BalanceBoard1 is always the first Balance Board, Wiimote1 is always the first Wii Remote, and WiiGuitar1 is always the first Wii Guitar, etc.

You can avoid that by adding “Wiimote.” in front of the expansion type. Eg. “Wiimote1.BalanceBoard.TopLeft”. When you do that, it tells GlovePIE to merge Wiimotes and Balance Boards into the same category with a shared numbering system, in which case Wiimote1 and BalanceBoard1 now refer to the same device.

To tell whether a Nunchuk, Classic controller, Guitar, Drum Kit, DJ Hero Turntable, Wii Motion Plus or BalanceBoard is plugged in, use these values:

Wiimote.HasNunchuck
Wiimote.HasClassic
Wiimote.HasMotionPlus
Wiimote.HasBalanceBoard
Wiimote.HasGuitar
Wiimote.HasDrums
Wiimote.HasTurntable
Wiimote.HasBladeFX

They are true or false. They are less useful when they have their own separate categories.

Note that GlovePIE now knows the difference between classic controllers and guitar controllers. Old guitar scripts should still work, as long as they didn’t use HasClassic to detect the guitar. But new guitar scripts won’t work if you have a real classic controller plugged in instead.

The Balance board doesn’t really plug into the expansion port of a real Wiimote. But the Balance Board has its own built in dummy Wiimote. Normally they are added to a separate category.

So if you have one real Wiimote, and one Balance Board, then Wiimote1 might be your real Wiimote, and Wiimote2 might be the Balance Board. Then Wiimote1.HasBalanceBoard will be false, and Wiimote2.HasBalanceBoard will be true. You could then the read the balance board by reading Wiimote2.BalanceBoard.Weight or you could read the balance board by reading BalanceBoard2.Weight (which is just a shorter way of saying Wiimote2.BalanceBoard.Weight).

To detect which expansion is plugged in you can also use these, which return a number that says which expansion it is:

Wiimote.Expansion
Wiimote.Expansion2
Wiimote.Expansion3

Wiimote.Expansion will be one of these values:

0: No expansion 1: Unidentified expansion, or not plugged in properly 2: Nunchuk 3: Classic controller, WiiGuitar or anything compatable with a classic controller (anything that can be used to navigate the Wii Home menu has this value). 4: ?? 5: ?? 6: Balance Board …Other values are possible if someone creates a new expansion.

Wiimote.Expansion2 will be one of these values:

0: No expansion 1: Unidentified expansion, or not plugged in properly 2: Really a nunchuk 3: Really a classic controller 4: Really a balance board 5: Really a musical instrument controller …Other values are possible if someone creates a new expansion.

NEW! Wiimote.Expansion3 identifies which kind of musical instrument it is. Note that these values all have 2 added to them, compared to the decoded values of the last two bytes of the expansion registers.

Motion Plus

You can read the Motion Plus’s 3 gyros like this:

Wiimote.MotionPlus.YawSpeed
Wiimote.MotionPlus.PitchSpeed
Wiimote.MotionPlus.RollSpeed

The speeds are Relative to the Wiimote’s orientation. So PitchSpeed isn’t the same as Delta(Wiimote.Pitch)/Delta(TimeStamp).

The Motion Plus is automatically used to calculate the Wiimote.Yaw, Wiimote.Pitch and Wiimote.Roll, and many other values, so you can use Motion Plus without manually reading the 3 gyro speeds, if you prefer.

Nunchuk

NEW! Gestures! The Nunchuk has accelerometers too! Most of the same acceleration values and rotation values are the same as the Wiimote, so see the gesture and motion descriptions in the sections above. The difference is that the Nunchuk accelerometers have a lower range.

Nunchuks share the number of the Wii Remote they are connected to. So “Wiimote1” and “Nunchuk1” are connected. If Wiimote2 has a Nunchuk, but Wiimote1 doesn’t, that Nunchuk is still called “Nunchuk2” because it is connected to Wiimote2.

The Nunchuk also has two buttons. NOTE: Unlike a playstation or xbox controller, pushing in the joystick is not a button, don’t try it. The two buttons are:

CButton (NEW!: aka C) ZButton (NEW!: aka Z)

You no longer need the word “Button” on the end, even though Z is the name of an axis, I’m no longer reserving it for future axis use.

The Nunchuk also has a joystick. It uses the following values:

JoyX (NEW! aka StickX) JoyY (NEW! aka StickY)

JoyX is -1 to the left, 0 in the middle, and +1 to the right. JoyY is -1 up, 0 in the middle, and +1 down.

These are the same ranges used by PPJoy and other joysticks.

NEW! If you want to recalibrate the Nunchuk joystick if the Nunchuk’s built-in calibration isn’t working, you can set Nunchuk.Calibrated to false. That will make it automatically recalibrate. After setting it to false, you should move the joystick in a circle to let it know the maximum and minimum values. This will not change the values stored inside the Nunchuk.

You can also read the joystick as a vector [x, y]:

Joy (NEW! aka Stick)

eg. WASD = Nunchuk.Joy

You can even read the joystick as a 3D vector [x, y, z]:

NEW! Joy3D: Where the nunchuk is pointing in 3D space, taking into account both rotation and the joystick. For example, to go up, you could either point the Nunchuk at the ceiling and push forward on the joystick, or roll it to the right and press left on the joystick, or point at the floor and push back on the joystick, etc. This allows movement in all directions, not just a flat plane. The nunchuk can never measure yaw, so yaw is assumed to be zero.

NEW! You can also read the 4 joystick directions like they were buttons:

up, down, left, right

Unlike the other Nunchuk values, these 4 directions take into account whether you are looking at your watch, in which case the directions swap to match the new orientation.

The Nunchuk does NOT have vibration, or a speaker, or gyros, or an L3 button when you push in the stick. But it does have accelerometers.

Datel BladeFX Wireless Nunchuk

The BladeFX Wireless Nunchuk is sometimes hard to detect from a regular Nunchuk. But if you unplug the BladeFX’s adapter then plug it back in, it will be detected as a BladeFX.

Nunchuk.IsBladeFX: true if the Nunchuk is a BladeFX. Nunchuk.BladeFXReplugged: if the BladeFX was unplugged then replugged.

The “FX” button can’t be read, but the Classic button can:

Nunchuk.ClassicButton: true while the classic button is held down and for half a second afterwards.

Note that the Classic button has the side effect of toggling the nunchuk into classic controller mode, which disables the motion sensing while in that mode. ClassicButton will stay true for about half a second after you release the button. Holding the button for more than 5 seconds will be recognised as unplugging the Nunchuk)

Nunchuk.ClassicMode: True if the BladeFX is in Classic controller mode

Classic Controller

Classic controllers share the number of the Wii Remote they are connected to. So “Classic1” and “Wiimote1” are connected. If Wiimote2 has a Classic controller, but Wiimote1 doesn’t, that Classic controller is still called “Classic2” because it is connected to Wiimote2.

The classic controller does NOT have accelerometers or gyros, or rumble, or a speaker, or L3 and R3 buttons, or LEDs!

The classic controller does have an unexplained lock button in the top centre, which physically opens and closes two slots in the back. The two slots can’t connect to anything and seem totally pointless. The lock button can’t be read.

You can read the following buttons:

a, b, x, y
Minus, Home, Plus
Up, Down, Left, Right (on the DPad)
ZL, ZR
LFull, and RFull (the click at the bottom of the L and R buttons)

They are either True or False.

The L button and the R button (LFull, and RFull above) also have analog versions:

L, and R

They will be between 0 and 1. Although mine won’t go below 0.03 when fully released, and yours may not reach 1 when fully pressed.

There are also two joysticks and 1 D-Pad. They are called LeftStick (or Joy1) and RightStick (or Joy2), and DPad.

LeftStickX, LeftStickY,
RightStickX, RightStickY
DPadX, DPadY

They are between -1 and 1, the same as the Nunchuk joystick described above.

You can read the Sticks or the DPads as a vector [x, y]:

LeftStick (or Joy1) RightStick (or Joy2) DPad ButtonDir (this is actually the a, b, x, and y buttons pretending they are a DPad)

Guitar Hero Controllers (for Wii)

The WiiGuitar comes with Guitar Hero 3 or Guitar Hero World Tour. It has 5 coloured fret buttons, which are either true or false. It has a strum switch which can be strummed upwards, or strummed downwards. You can hold down the strum switch in either position, or you can strum it so that it is only held for a short time. The strum switch is not analog. There is a Plus and a Minus button on the Guitar. There is a whammy bar (a lever) which is analog. It will be between 0 and 1, although it's range is actually much less than that, and varies between guitars. It also has a joystick.

In addition, you can still use the buttons on the front of the Wiimote, which will be embedded in the guitar face. And you can use the accelerometers in the Wiimote to find the angle or motion of the Guitar. And you can play notes through the Wiimote speaker, and you can flash the lights on the Wiimote. I don't know whether you can feel the Wiimote vibrate or not. The IR will no longer work when the guitar is plugged in, and neither will the B button.

The WiiGuitar values will only be true if a Guitar is plugged in. If a Classic controller or Nunchuk is plugged in, the values will always be false.

You can use the following WiiGuitar fields:

Fret1, Fret2, Fret3, Fret4, Fret5: The five fret buttons counting from the end. These are either true or false. You can also use the names of the colours instead.
Plus, Minus: The + and - buttons on the guitar. They are true or false.
JoyX, JoyY: The joystick. It is between -1 and 1, like any joystick in GlovePIE.
Joy: The joystick as a 2D vector [x,y].
StrumUp: True when the strum switch is held in the up position.
StrumDown: True when the strum switch is held in the down position.
WhammyBar: A value between 0 and 1.
Exists: The same as Wiimote.HasGuitar. True if the guitar is attached, false if it isn't.

Guitar Hero World Tour has some extra values for the 5 extra touch-sensitive frets lower on the neck:

TouchFret1, TouchFret2, TouchFret3, TouchFret4, TouchFret5: You can also use the names of the colours instead.

TouchBar: An analog value between 0 and 1 representing where the bar is being touched.

#Wii Fit Balance Board

The Wii Fit (or Wii Fitness) Balance Board is a new Wii controller that you stand on. It has four weight/pressure sensors, one in each corner.

Balance Boards support is working now, although I haven’t implemented any gesture recognition like walking, jumping, crouching, etc. yet.

The Balance Board behaves like an extra dummy Wiimote with a Balance Board attachment plugged in. The dummy Wiimote’s LED1 controls the power LED on the top of the board, and the dummy Wiimote’s A button is actually the power button on the Balance Board. The other things on the dummy Wiimote do nothing, except the built-in balance board “attachment”.

NEW! The Balance Board is now in a separate category from Wii Remotes, so you can read from the first Balance Board with “BalanceBoard1”.

You can read your total weight like this:

Weight

You can read the weights on the four sensors (in kilograms) like this:

FrontLeft, FrontRight
BackLeft, BackRight

You can also read the weights on each side like this:

WeightFront, WeightBack,
WeightLeft, WeightRight

You can read the raw values of the four sensors like this:

BalanceBoard.RawFrontLeft
BalanceBoard.RawFrontRight
BalanceBoard.RawBackLeft
BalanceBoard.RawBackRight

Unlike the previous version, the sensors now have the correct names. The back is the side with the power button.

Different sensors vary quite a bit.

There are some unknown values you can try:

BalanceBoard.EE
BalanceBoard.QuestionQuestion

You can set the LED like this:

eg. BalanceBoard.LED = true

You can read the button like this:

BalanceBoard.Button

NEW! Drum Kit (for Wii)

NEW! Versions prior to 0.43 couldn’t detect the Drum Kit due to a bug. It has theoretically been fixed.

The drum kit comes with the game Guitar Hero World Tour. Drums for the game “Rock Band” are USB and are not supported (yet).

You access it with “WiiDrums” or “WiiDrumKit”.

It has the following fields which are like buttons:

Red, Blue, Green, Yellow, Orange, Pedal (or Bass) HiHat (you need to build this pedal yourself and plug it into the unused plug)

And it has the following fields which are analog and represent how fast you are currently hitting each drum:

RedSpeed, BlueSpeed, GreenSpeed, YellowSpeed, OrangeSpeed,
PedalSpeed (or BassSpeed)
HiHatSpeed
Speed

HasSpeed is true or false and tells you if the speed is known.

And it has these buttons and axes:

Plus, Minus, JoyX, JoyY, Joy

And these values from the Wiimote itself which you can reach at the top of the drum kit:

``DPad, DPadUp, DPadDown, DPadLeft, DPadRight (these already compensate for the rotation)
`A, Home, One, Two`
`WiimoteMinus, WiimotePlus` (not to be confused with the other Minus and Plus buttons)
`LedLevel `(a level meter, set it to the range 0 to 1)
`Leds, Led1, Led2, Led3, Led4, LedPlayer`
`Speaker, Mute, SampleRate, Volume, Frequency, Rumble`

DJ Hero Turntable (for Wii)

NEW! Versions prior to 0.43 couldn’t detect the Turntable due to a bug. It has theoretically been fixed.

This turntable comes with the game DJ Hero. It has a record turntable which can spin infinitely in each direction, with 3 coloured finger buttons on it: red, green, and blue. It also has a slider for mixing, a “Euphoria” (star power) button, an effects dial, and plus and minus buttons. The turntable can be plugged into either side of the base, or into both sides at once (if you have 2).

Since I don’t have a DJ Hero controller, I’m relying on the incomplete protocol specifications posted on the web, and it is totally untested. Please send me your results and more information.

The Turntables are accessed with “WiiTurntable” followed by an optional number, then a dot, then the field name, eg. “WiiTurntable.RightGreen”.

The buttons are like this (left and right are for which side it is plugged into):

LeftGreen, RightGreen, Green
LeftBlue, RightBlue, Blue
LeftRed, RightRed, Red
Euphoria, Plus, Minus

The turntable spin is accessed like this:

RawLeftTurntable, RawRightTurntable (units and meaning are completely unknown)

You can also access these values:

StickX, StickY, Stick
EffectDial
CrossFade

And these fields correspond to the buttons from the Wii Remote that you can press if you open the lid:

DPad, DPadUp, DPadDown, DPadLeft, DPadRight (these already compensate for the rotation)
A, Home, One, Two
WiimoteMinus, WiimotePlus (not to be confused with the other Minus and Plus buttons)
LedLevel (a level meter, set it to the range 0 to 1)
Leds, Led1, Led2, Led3, Led4, LedPlayer
Speaker, Mute, SampleRate, Volume, Frequency, Rumble

Low level stuff

You can read the data reports from the Wiimote with:

debug = Wiimote.InByteString

Or you can read them individually with:

var.a = Wiimote.InReport
var.b = Wiimote.InByte1

You can send data reports to the Wiimote with this function (it has no dot):

WiimoteSend(1, 0x12, 1, 0x33)

The first parameter of WiimoteSend is the Wiimote number you want to send it to, normally 1. The second parameter is the report number. The remaining parameters are the report payload. In this case, the report tells the Wiimote to start vibrating, and to send data via report 0x33.

The one-byte reports can also be sent another way by setting one of these values (it will only send the report when the value changes):

Wiimote.Report11, Wiimote.Report13, Wiimote.Report14, Wiimote.Report15, Wiimote.Report19, Wiimote.Report1A

You can set bytes in the Wiimote’s onboard memory (where Miis are stored) with the WiimotePoke command, and read bytes from its memory with the WiimotePeek command.

WiimotePoke(1, 0x04B00033, 0x33) var.value = WiimotePeek(1, 0x04B00033)

The first parameter is optional, and it is the Wiimote number. The second parameter is the address. The third parameter is the value you want to set it to (between 0 and 255).

Note that the Nunchuk and Classic Controller have their own memory space which is mapped to the Wiimote’s when they are plugged in.

You can set the Channel with Wiimote.Channel. The Channel should be a hexadecimal number between 0x30 and 0x3F, which determines which information the Wiimote sends back to the computer.

Don’t use these low level functions unless you know what you are doing and have read the www.wiibrew.org/Wiimote page. One person has bricked their nunchuk by experimenting with writing to all its addresses (although that is how we discovered how the nunchuk works).

Multiple Wiimotes

You can tell how many Wiimotes there are with Wiimote.Count

You can access a particular wiimote by putting a number after the word “wiimote” and before the dot. For example:

Enter = wiimote2.A

You can tell whether a particular Wiimote exists with Wiimote.Exists

You can’t read the Serial number (as text) anymore with Wiimote.Serial, because I disabled it. It rebooted computers with BlueSoleil when you tried to read the serial.

Don’t forget to sync both Wiimotes with the PC before you try to use them.

Clone this wiki locally