Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

latchdevel/NunchukUSBKeyboard

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nunchuk USB Keyboard

Converts a Nunchuk controller into a USB HID-compliant keyboard.

Plug-and-play USB device with native HID compliance, enabling driverless support on Windows, macOS, and Linux.

Maps the Nunchuk joystick's eight directional movements to arrow key presses, with simultaneous key combinations for diagonals. Button inputs are translated into keyboard events, with default mappings to the '+' and '-' keys on the numeric keypad, but they can be reassigned to any key bindings.

Nunchuk USB Keyboard

Hardware Overview

A microcontroller with native support for the USB HID (Human Interface Device) class is required. One of the simplest and most widely used options is the ATMega32U4, a low-cost 8-bit microcontroller with built-in USB functionality. It is commonly found on Arduino development boards and similar boards from other manufacturers.

For this use case, the SparkFun Pro Micro 3.3V/8Mhz is the best choice. Its compact size allows it to fit easily inside the Nunchuk enclosure, and its 3.3V operating voltage ensures direct connection with the Nunchuk circuit. It is easy to use and widely available, with low-cost clones on the market that make it an accessible option for hobbyists and developers alike.

The connection with the Nunchuk is straightforward, requiring only four wires: two for the 3.3V power supply and two for the I²C interface: SDA (data) and SCL (clock).

Pro Micro to Nunchuk connection

Firmware Implementation

The firmware implementation is responsible for managing communication between the microcontroller and the Nunchuk, interpreting input signals, and executing the necessary logic to process and transmit data.

To simplify development and ensure compatibility, the Arduino framework is used. It offers an accessible programming environment and provides ready-to-use libraries for handling both USB HID Keyboard functionality and I²C communication, making it an ideal choice for this particular use case.

Note: If you haven't previously used the Pro Micro board within the Arduino environment, you'll need to add it manually by following the instructions provided by SparkFun. These steps typically involve adding the appropriate board URL to the Arduino IDE's preferences and installing the board package through the Boards Manager.

The Arduino sketch relies on only two libraries: the Keyboard library, which must be installed via the Arduino Library Manager, and the Wiichuck library, which is included directly within the source code. This minimal dependency setup simplifies portability and ensures that all necessary components are either readily available or self-contained.

The Wiichuck library is one of many available options for interfacing the Nunchuk with Arduino, but it stands out as the oldest and most widely used. It handles communication with the Nunchuk via the I²C protocol, relying on the Wire library, which comes preinstalled in the Arduino development environment. This makes it a convenient and reliable choice for basic Nunchuk integration without requiring additional dependencies.

With everything in place, all that's left is to open the sketch in the Arduino IDE, compile it, and upload it to the board. The process is straightforward and requires no additional configuration beyond selecting the correct board and port.

Pro Micro Bootloader Mode: To upload firmware to a Pro Micro board, you need to activate its bootloader mode, which remains available for only about 8 seconds. Since the board lacks a physical reset button, you must quickly short the RST pin to GND twice in succession to trigger the bootloader. This can be done using a wire, tweezers, or a momentary switch. Once in bootloader mode, the Arduino IDE will recognize the board, allowing you to upload the sketch successfully.

License

Copyright (c) 2025 Jorge Rivera. All right reserved.

License GNU Lesser General Public License v3.0.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

See the LICENSE file for license rights and limitations (lgpl-3.0).

About

Converts a Nunchuk controller into a USB HID-compliant keyboard

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.