trcclub / n64-arduino

Plug two N64 controllers to an Arduino and turn your Arduino in a USB HID joystick! Play your favourite games on the pc with the best controller ever!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

n64-arduino

Plug two N64 controllers to an Arduino and turn your Arduino in a USB HID joystick! Play your favourite games on the pc with the best controller ever!

I've had some trouble setting up MickMad's original project, so I decided to fix it. Somehow my Arduino swapped the buttons with the joystick, so I had to fix the order. I use mupen64plus (github), so I generated the config file so that both controllers work with it directly.

Instructions

We will use Linux or OSX to program the Arduino's main processor and also the atmega16u2 (the programmer). The atmega16u2 chip allows us to use the Arduino as a USB HID device.

0. Download this project to somewhere you like

git clone github.com/twinone/n64-arduino n64-arduino

1. Install dfu-programmer

osx:

brew install dfu-programmer

aptitude:

apt-get install dfu-programmer

2. Upload the sketch

  • Make sure you use an Arduino Uno R3 (or other board with an atmega16u2 for the programmer).
  • Open the sketch in the Arduino IDE and upload it to your Arduino.

3. Metaprogramming: Programming the programmer

  • Connect your Arduino to your computer via USB.
  • Short the two pins marked in this picture together with a jumper wire (don't worry, you won't burn anything):

  • Unshort them again.
  • Make sure your Arduino isn't listed in the Arduino IDE's serial port list.

I've attached a very simple script that does the flashing, mainly because I was too lazy to write the 3 commands all the time while I was debugging.

  • ./flash.sh joystick.hex

This will render the programmer useless. If you want to upload a new sketch to your Arduino, you'll have to use ./flash.sh uno.hex again, which contains the programmer's original firmware.

4. The wiring

Here's the pinout for your N64 Controller's plug:

  • Connect the Controller's VCC to the Arduino's 3v3 pin (3.3v)
  • Connect the Controller's DATA to the Arduino's digital pin 2 (pin 3 for the second controller)
  • Connect the Controller's GND to the Arduino's GND pin

5. Reconnect, configure, play!

  • Reconnect your arduino to your computer
  • Copy the config file to where it belongs:
mkdir -p ~/.config/mupen64plus/
cp mupen64plus.cnf ~/.config/mupen64plus/

(If you already have a config file, just copy the controller parts)

  • Play!

Credits

This project is an extension of MickMad's awesome project

More awesome people this project is built upon Darran original Arduino Joystick

Andrew Brown's instructable

About

Plug two N64 controllers to an Arduino and turn your Arduino in a USB HID joystick! Play your favourite games on the pc with the best controller ever!


Languages

Language:Makefile 59.0%Language:C 18.7%Language:Arduino 11.8%Language:C++ 7.4%Language:Objective-C 3.1%Language:Shell 0.1%