wusbmote: Wiimote accessory to USB adapter

Project overview

Wii-USB

Wii-USB

This time, for a change, I decided to create an adapter that uses controllers from this era, as in still sold in stores, as new items, and no, not in one of those wireframe bins full of items sold at a price 4 times less than the original. (Still, I do know many treasures are found there...)

Specifications

  • USB HID Compatible. No drivers required on most systems (Win7, Win8, Win 8.1, 32&64 bit, Linux)
  • The connected peripheral can be changed on the fly.

Joystick mode (default)

  • Supports the Nunchuk, official version and clones, at its full resolution (8 bit for th eXY joystick and 10 bit or the accelerometers)
  • Supports the Wii classic controller (Tested RVL-005 and RVL-005(-02)) and clones (such as the HORI Battle pad for Wii U). By default, the analogic L slider is disabled. Hold HOME for 3 seconds to toggle between enabled/disabled. (Required to complete button assignment in many games)
  • Partial support for the Wii motion plus. Connecting a peripheral to the Wii motion plus is NOT supported. Yaw, Roll and Pitch speeds scaled down to fit in the 10 bit USB report which severely limits precision.

Mouse mode (Since version 1.2)

  • Note: This mode must be enabled using the configuration tool
  • Supports the Nunchuk, official version and clones. Joystick: Pointer. Scrolling is possible by pressing C while moving the joystick.
  • Supports the Wii classic controller (Tested RVL-005 and RVL-005(-02). Left stick: Pointer. Right stick: Scroll.
  • Configurable: Divisor (controls speed), dead zone, scrolling threshold, invert scroll direction.

Applications

There are no doubts regarding the usefulness of the Classic controller since it is basically a Playstation controller. But what about the much simple Nunchuk controller? With only two buttons and one joystick, I was not sure it would be very useful. But during testing, I quickly realized I was wrong. This controller is perfect for simple games as found for the Sega Master System and of course, NES.

Nunchuk pros:
  • Playing with a single hand is possible. The other hand is therefore freed and usable to drink wine or use a smartphone while keeping a distracted eye on the game (especially during "grinding" in RPG games).
  • Not being required to use two hands also allows one to assume postures that would not have been possible otherwise such as playing with an arm relaxed, far from the other hand, hanging below the chair...
  • Playing with either hand is also surprisingly easy.
Nunchuk cons:
  • Only two buttons is not much. Luckily for NES games, the missing buttons, start and select, are not used too often. Using the keyboard to control these is not too inconvenient though.
  • The accelerometers are not very useful at the moment.


Pictures

Here are a few pictures of the project and the supported peripherals:
Development setup

Development setup

Official Nunchuk

Official Nunchuk

Wii MotionPlus

Wii MotionPlus

Official classic controllers

Official classic controllers

Nunchuk clones (Wired and wireless)

Nunchuk clones (Wired and wireless)

Finished adapter

Finished adapter


Please send me your pictures if you build this project! I would be happy to add them here.


Schematic

An Atmel Atmega8 (or Atmega8a), clocked with a 12mhz crystal is used.
MCU and USB

MCU and USB

Wiimote connector

Wiimote connector


3.3v supply
A 3.3v source is required by the game controller and for the R4 and R5 pull up resistors in the above schematic. A voltage regulator reducing the USB 5v supply to 3.3 volt can be easily implemented using the popular LM317 integrated circuit such as suggested for the N64/Gamecube to USB project: http://www.raphnet.net/electronique/gc_n64_usb/index_en.php#2

Wii connector
There a the following options:

  • Cut an extension cord. (There are a lot on eBay and they are cheap)
  • Use an equivalent connector (Sold in my online store)
  • Use the connector from a damaged Wiimote. (On eBay, just search for "broken wiimote")
  • Using no connector is also possible. Just cut the Nunchuk / Classic controller cable. (Only recommended when installing/building the circuit inside a controller)
Important: I am not specifying a color code for the cables since it changes depending on the manufacturer. You must find out what color code is used by your cables by using a continuity tester to fill a table such as the example below. Once you have done this, wiring should be easy.

Very important: Do not blindly follow the colors in the above example. Sorry to insist, but blindly following a color code may result in a non-functional project, or worst, into permanent damages to your equipment (Controllers, PC, House?). Whatever happens, I will not be held responsible.

What about the cable shield?
Simply connect it to GND.


PCB

As is often the case, I used my multiuse pcb2 circuit which is designed to use an Atmega8 with all the components required for this USB implementation:
Multiuse pcb2

Multiuse pcb2

Wiring instructions

Wiring instructions

Wiimote connector pinout

Wiimote connector pinout



The wiimote wires on the second picture are intentionally desaturated since it is dangerous to follow them blindly, as stated in the schematic section.



Software

Version v1.3
May 29, 2014 (Thursday)
Configuration improvements:
  • Created a separate interface (HID-Generic) for configuration. This makes it possible to send commands under Windows, even in mouse mode.
  • Updated configuration tool for above change.
  • Implemented an I2C interface mode (useful for raw controller access, and experimentation. See the i2c_tool/ subdir for an example.
File(s):
wusbmote-1.3.tar.gz (129 KB)
wusbmote-1.3-m8.hex (19.1 KB)
wusbmote-1.3-m168.hex (19.9 KB)
Show previous releases...
Version v1.2.1
May 11, 2014 (Sunday)
Quick fixes:
  • Now working again under Windows (Corrected report descriptors)
  • Add a makefile to compile the configuration tool under windows.
File(s):
wusbmote-1.2.1.tar.gz (122.2 KB)
wusbmote-1.2.1-m8.hex (17.2 KB)
wusbmote-1.2.1-m168.hex (17.9 KB)
Version v1.2
May 4, 2014 (Sunday)
New features:
  • Add mouse support (Using Nunchuk or Classic controller)
    • Classic controller mouse scroll using right stick
    • Nunchuck mouse scroll wheel by moving then holding C
  • Configuration now stored in EEPROM. Includes:
    • Serial number
    • Operating mode (Mouse or Joystick)
    • Mouse parameters: Divisor, deadzone, invert wheel.
  • Implement an HID Feature report to set configuration
  • Add a Linux tool to set configuration through USB (Uses hidapi)
  • Change VID/PID
  • Atmega168 now compatible (Use Makefile.atmega168)
  • Code cleanup
File(s):
wusbmote-1.2.tar.gz (111.7 KB)
wusbmote-1.2-m8.hex (17.3 KB)
wusbmote-1.2-m168.hex (18 KB)
Version v1.1
April 26, 2014 (Saturday)
Maintenance release:
  • Update V-USB and fixes for modern GCC
  • Optimized I2C code
File(s):
wusbmote-1.1.tar.gz (102.7 KB)
wusbmote-1.1.hex (10.8 KB)
Version v1.0
November 4, 2012
Initial release.
  • Supports the Nunchuk
  • Supports the classic controller
  • Partially supports the Wii MotionPlus
  • USB HID Compatible
  • The connected controller can be changed at any time
File(s):
wusbmote-1.0.tar.gz (81.7 KB)
wusbmote-1.0.hex (11.5 KB)
This project is also available on GitHub!
To request features, report issues or contribute, you may send me an email or use the GitHub repository:
https://github.com/raphnet/wusbmote
Source code:
The source code is available under the GPLv2 license. See License.txt for more information. The project compiles with avr-gcc.

Using .hex files
  • Atmega8: The *-m8-*.hex or *.hex files prior to version 1.4 are for programming an Atmega8. The fuse bytes for Atmega8 are: high byte = 0xc9, low byte = 0x9f.
  • Atmega168: The *-m168*.hex files are for programming an Atmega168. The fuse bytes for the Atmega168 are: high=0xdd, low=0xd7, extended=0x01

For informations about how to program an AVR MCU, visit my AVR programming page.

USB implementation:
I used an Atmega8 which does not support USB natively so I used the V-USB software only USB driver for AVRs.

Combinaison Vendor ID/Product ID USB:
In order to prevent driver problems and conflicts, please do not re-use my VID/PID pair for derived or other projects. Instead, please obtain your own.


Configuration

A command-line tool for configuring the adapter is supplied with the source code under the tool/ directory. At the moment, I only tested it under Linux, but as hidapi also supports Windows and Mac OS X, it should be possible to use the tool under those OSes as well.

Note that:
  • The parameters configured with the tool are saved in the adapter and will be restored the next time the adapter is used.
  • This tool requires adapter firmware v1.2 or newer to work.

Help

Display help:
$ wusbmote_ctl --help
./wusbmote_ctl [OPTION]... [COMMAND]....
Control tool for WUSBmote adapter. Version 1.1.1

Options:
  -h, --help   Print help
  -l, --list   List devices
  -s serial    Operate on specified device (required unless -f is specified)
  -f, --force  If no serial is specified, use first device detected.

Configuratin commands:
  --set_serial serial                Assign a new device serial number
  --mouse_mode                       Put the device in mouse mode
  --joystick_mode                    Put the device in joystick mode
  --mouse_divisor val                Set the mouse rate divisor (Higher = slower). Typ: 4
  --mouse_deadzone val               Set the deadzone for mouse mode. Typ: 5
  --scroll_joystick_invert val       Invert joystick scrolling direction. (0 = normal, 1 = inverted)
  --scroll_nunchuck_invert val       Invert scroll direction (0 = normal, 1 = inverted)
  --scroll_nunchuck_threshold val    Set the nunchuck roll threshold for scrolling. Typ: 127
  --scroll_nunchuck_step val         Set the scroll step size (Higher = more scrolling). Typ: 5
  --scroll_nunchuck_c val            Enable/disable scrolling by move + C. (1 = enable, 0 = disable)
  --scroll_nunchuck_c_threshold val  Stick deflection threshold for scrolling. (Typ: 64)

Example: Listing adapters

Each adapter has an unique serial number which can be used to configure a specific adapter, even if several are connected to the same computer. The --list command will display the serial numbers.

If you only have one adapter, you may use the --force option which will configure the first (and only) adapter from the list.
$ ./wusbmote_ctl -l
Simply listing the devices...
Found device 'WUSBmote_v1.2', serial '1001'
1 device(s) found

Enabling mouse mode

By default, the adapter is in joystick mode. Mouse mode must be explicitely enabled. Note that you must use the serial number corresponding to your adapter (not 1001 as in the example below. See listing adapters above). Note: When switching between mouse and joystick mode, the adapter must be disconnected and reconnected for the setting to become effective.
./wusbmote_ctl -s 1001 --mouse_mode
Setting mouse/joystick mode...command result: 0

Mouse configuration

  • If the mouse pointer moves too quickly (or too slowly), speed can be adjusted using the --mouse_divisor option. Higher values result in a slower moving pointer.
  • If the pointer is moving even though the joystick is centered, try increasing the dead zone using --mouse_deadzone. Ideally, this value should be kept as low as possible for better control. Note that the dead zone is applied after the scale is adjusted (--mouse_divisor). The higher the divisor, the smaller the required deadzone (if needed at all) becomes.

Permissions under Linux

Typically, it won't be possible for a normal user to configure the adapter:
./wusbmote_ctl -s 1001 --mouse_mode
Error opening device. (Do you have permissions?)
A quick fix is to run the tool as root using sudo:
sudo ./wusbmote_ctl -s 1001 --mouse_mode
Setting mouse/joystick mode...command result: 0




Disclaimer

I cannot be held responsible for any damages that could occur to you or your equipment while following the procedures present on this page. Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability of the informations on this page. Please note, however, that the procedures above have worked in my case without any damages or problems.

Now you cannot say that I did not warn you :)