I have a confession to make: I don't love playing video games with a keyboard. While the keyboard/mouse combo is the preferred input method for most PC gamers, I find my left hand often gets cramped using WASD-based keyboard input, and wish for a more ergonomic input method sometimes.
I had an idea to make a simple adapter to map Wii Nunchuck input into keyboard events a game would recognize. I figured I could map the Nunchuck's analog stick to keyboard events for movement, and could map the two digital buttons on the Nunchuck to other keys while I was at it.
This setup would allow me to use the Nunchuck to partially or entirely replace input from my keyboard.
Overview
This no-solder adapter is built with either a QT Py RP2040 or a Trinkey QT2040 microcontroller, coupled with a Wii Nunchuck breakout board connected by a Stemma QT cable. The firmware, written in CircuitPython 9, translates Wii Nunchuck analog stick and button events to keyboard events. Thanks to CircuitPython, customization is easy, allowing you to make changes to the generated key events any time. So far, I have used this adapter for games like XCOM-2, FTL: Faster Than Light, and Half-Life 2!
I've included 2 build variants here, one for those with access to a 3D printer, and one for those without. The QT Py build uses a 3D printed case for mounting the QT Py and the Nunchuck breakout board. The Trinkey QT2040 build takes advantage of the identical screw hole placing on the Trinkey and the Nunchuck breakout adapter board, using a handy standoff mounting kit to make a nice tidy little USB-A adapter.
Table of Contents
If you have access to a 3D printer, this is the recommended build. Follow the instructions in this section to build the adapter.
Materials
These materials are required for the QT Py build:
- Wii Nunchuck controller (if you don't already have one)
- Wii Nunchuck breakout adapter
- 50mm Stemma QT cable
- QT Py RP2040
-
M2.5 screws and nuts
- 2 M2.5 x 8mm screws
- 2 M2.5 nuts
- USB-C cable to plug the adapter into your computer
Install CircuitPython
Install the latest stable version of CircuitPython 9 on your QT Py using the directions from QT Py RP2040's learn guide.
Install Firmware Source
Download or clone the CircuitPython 9 source code from github. Copy the contents of the CIRCUITPY directory into the root of your QT Py or Trinkey's CIRCUITPY drive.
1. Print out 3D printed parts
Download and print out the two 3D printed parts found here.
2. Connect QT Py and Nunchuck breakout
Plug one end of the 50mm Stemma QT cable into the QT Py and the other end into either Stemma QT port on the Nunchuck breakout adapter.
3. Mount QT Py
Snap the QT Py into the snap-fit geometry in the case as shown in the photo above.
4. Mount Nunchuck Breakout
Using 2 M2.5 scews and nuts, mount the Nunchuck breakout adapter to the case as shown in the photo above.
5. Attach cover
Snap the 3D printed cover on the the 3D printed case. That's it! Continue on to the Operation section for usage details.
If you do not have a 3D printer, this is the recommended build. Follow the instructions in this section to build the adapter.
Materials
These materials are required for the Trinkey build:
- Wii Nunchuck controller (if you don't already have one)
- Wii Nunchuck breakout adapter
- 50mm Stemma QT cable
- Trinkey QT2040
- Stacking M2.5 Hardware Kit for Trinkey QT2040
- (Optional: USB-A to USB-C adapter, if your computer does not have USB-A ports)
Install CircuitPython
Install the latest stable version of CircuitPython 9 on your Trinkey QT2040 using the directions from the Trinkey learn guide.
Install firmware source
Download or clone the CircuitPython 9 source code from github. Copy the contents of the CIRCUITPY directory into the root of your QT Py or Trinkey's CIRCUITPY drive.
1. Mount Nunchuck to Trinkey
Using the stacking M2.5 hardware kit, mount the Nunchuck adapter to the QT2040 Trinkey in whatever configuration you like. One possible configuration is shown in the photo above.
2. Connect Trinkey and Nunchuck breakout
Plug one end of the 50mm Stemma QT cable into the Trinkey, and the other into the Nunchuck breakout. That's it!
Operation
Plug the Nunchuck controller into the adapter, making sure the notch on the Nunchuck connector is on the same side as the Notch Up text on the breakout. Connect the adapter to your computer depending on which version you built:
- QT Py: Connect the adapter to your computer with a USB-C cable.
- Trinkey: Plug the Trinkey into a USB-A port on your computer or USB hub.
Once connected, you can use the analog stick and C and Z buttons to trigger keyboard events on your computer!
Customization
You can easily customize the adapter's settings by modifying the nunchuck_config.py file on your QT Py/Trinkey's CIRCUITPY drive. The settings are contained in a dictionary using the following keys:
- "up": key code for the key to be pressed when the analog stick is pressed up
- "right": key code for the key to be pressed when the analog stick is pressed right
- "down": key code for the key to be pressed when the analog stick is pressed down
- "left": key code for the key to be pressed when the analog stick is pressed left
- "c": key code for the key to be pressed when the C button is pressed
- "z": key code for the key to be pressed when the Z button is pressed
- "x_dead_zone": threshold for detecting key presses on the analog stick's x axis
- "y_dead_zone": threshold for detecting key presses on the analog stick's y axis
- "debounce_time": short delay between Nunchuck sampling to create a simple debounce mechanism. By default the debounce time is set to 1/60th of a second.
- "debug": if True, debug information will be printed to the serial console. False by default.
This page (Wii Nunchuck USB Adapter) was last updated on November 16, 2024.