Wii Nunchuk & Raspberry Pi 4

The Wii Nunchuk is an IIC/I2C/I2C UI device. It offers a 2-axis joystick, 2 buttons labelled C [the smaller, roundish one on top] and Z [the larger, squarer one on the bottom], and a 3-axis accelerometersthat measures the position of the device in 3 dimensions.

I’ve always thought it would be fun to use one as an input device on the RPi, and I’m not alone in that. There are many examples of python implementations using the nunchuk, but apparently only one that turns it into a general Linux uinput device: https://github.com/xerpi/nunchuk2pi

I first just tried cloneing the repository and compiling it, but it wouldn’t work. Some basic research led to some other software having similar issues due to a change in header file layout as well as deprecated inline functions between versions of uinput.

So I gave up at the time.

But my brain wouldn’t leave it. So I poked at one issue, and prodded at another, and eventually found all the pieces I needed to put the puzzle together! I haven’t written C of any kind for a while, so this was an interesting stretching of those creaky muscles. I’m also using Tint2 as the panel on this desktop, so I wrote an executor that shows the status of the n2pi driver, and allows you to run it if it’s not already running.

So my I forked xerpi’s code and did mine up properly, so the other maybe 6 people in the world who cares about this stuff can find if if they want: https://github.com/scriven42/nunchuk2pi

Thanks for reading, and I hope everyone’s doing OK in these extended C19 times!

2 Replies to “Wii Nunchuk & Raspberry Pi 4”

  1. Hi Mr MakerCave,
    My name is Gabriel Costa, I live in Brazil and I’m setting up a research project for the Nintendo snes and I’ll use this project to present it to college, and for months I’ve had a code that works on Nintendo’s Wii Classic Controller on RaspBerry pi 3 or 4 or Orange PI H3 on the I2C port. your driver, it works i appear with the nunchuck when i connect the wiiclassic control its driver “Try to open /dev/devexec2c-0” but the buttons don’t work. my question is, how do i make it work the buttons? Can you help me? or rewrite your driver to make it work with the controller? Can you give me this advice?
    The driver is attached where the control is, but it only works with the wiringPI library, I would love it to work the same as your driver without needing the wiringPI library.

    https://github.com/scriven42/nunchuk2pi your driver

    “https://github.com/Teck1/wiiclassic-kbd” This driver is giving error when compiling.

    “https://github.com/havencking/WiiClassicPi” This driver only works with the WiringiPI Library, it’s not working for me.

    “https://github.com/nutki/rpi-nintendo-classic-controller” this driver doesn’t work

    Thank you, have a great day.
    Attached Driver do havencking@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *