PiChuk, a wireless Raspberry Pi joystick controller.

PiChuk, a wireless Raspberry Pi joystick controller.

Description

This is my attempt to stick a Pi Zero inside of a Wii Nunchuk. I use this to control an organization-type program I made, but I can see this being useful for videogames as well. It is powered by a 750mAH LiPo battery used for drones. I used an Adafruit Powerboost to regulate the power. It uses the Wii Nunchuk's joystick PCB, buttons, and top cover. I tried to get this as compact as possible, but there wasn't nearly enough room to actually fit a Pi Zero completely in a Wii Nunchuk, not even considering the other parts. I modelled the lower body of the Nunchuk to fit all the components in the hand-grip part. I planned to make a cover for the grip portion, but it feels ok to hold already, and I didn't want to add extra bulk. I use this with my Vufine wearable display, which is why I needed it to have a standard HDMI port. Thankfully, the Nunchuk's PCB has a built-in analogue-digital converter, so I didn't have to use a separate one. *** **Components:** * Wii Nunchuk * [Adafruit Powerboost 1000C](https://www.adafruit.com/product/2465) * [750mAH 3.7V Holy Stone Model 752555](https://www.amazon.com/Holy-Stone-750mAh-Battery-Quadcopter/dp/B00X9HIPVW) * HDMI ribbon cable assembly: * [Female standard HDMI](https://www.adafruit.com/product/3551) * [Male mini HDMI](https://www.adafruit.com/product/3553) * [10cm ribbon cable](https://www.adafruit.com/product/3560) *** To get the Pi to recognize the joystick's signal, I used [this module](https://github.com/Boeeerb/Nunchuck).To use the Nunchuk's hardware to control the cursor, I used the Python module [Pynput](https://pypi.org/project/pynput/). *** **This is the script I made to control the mouse and click buttons:** from nunchuck import nunchuck import time from pynput.mouse import Button, Controller wii = nunchuck() mouse = Controller() while True: x = wii.joystick_x() y = wii.joystick_y() x_scaled = ((x - 130)*2)/260 y_scaled = ((y-135)*2)/270 x_curve = int((x_scaled * abs(x_scaled))*100) y_curve = int((y_scaled * abs(y_scaled))*100) time.sleep(0.02) mouse.move(x_curve, y_curve) if wii.Button_z() = True: mouse.click(left,1) if wii.Button_c() = True: mouse.click(right,1) ''' You might have to tweak the values for x_curve and y_curve because each Wii joystick potentiometer I've tried had different limits. It's just rise over run, where 2(x-130) is Δx and 260 is Δy, so if your cursor moves in the opposite direction after moving the joystick all the way, you need to lower the value of that direction. '''

Statistics

Likes

54

Downloads

0

Category

Computer