An attempt to build a daemon for a Nintendo Classic Mini controller (and maybe others) for use with RetroPie and similar.
These controllers use the standard I2C protocol to communicate and thus can be read by a Raspberry Pi using its I2C bus.
Connecting to the Raspberry Pi
Connecting the controller is simple, you can either cut off the plug and wire directly, or use an adapter such as this one from adafruit.
There are four wires that need to be connected;
- 3.3v - Power Input - Raspberry Pi Pin 1
- Gnd - Power Input - Raspberry Pi Pin 6
- SDA - I2C Data - Raspberry Pi Pin 3
- SCL - I2C Clock - Raspberry Pi Pin 5
The pinout is as per below;
and a pinout for the Raspberry Pi is available at here.
I found a cheap controller called a "Gioteck Nintendo Mini" These can be had in the UK from from Poundland, Argos, Ebay and similar.
I got mine for £5 from Poundland and it is what I am using for testing, as it was so cheap I opted to cut the plug off and add header sockets to plug directy linto the Raspebrry Pi. You can also find them on ebay.
Building and using the daemon
You will need NodeJS installed on your Raspberry Pi before you can use this package, for instructions on how to do that go here.
You will also need to have the i2c bus enabled and the controller connected, follow the instructions here to do this. The controller should show at address 0x52 and 0x54.
Once you've got NodeJS setup and the controller connected and detected, you can follow the below instructions;
- Clone the source by running;
$ git clone https://github.com/mickwheelz/NintendoI2C-Node.git
- Change to the directory and install the dependancies by running;
$ cd NintendoI2C-Node/
$ npm install
- Now you start the daemon by running;
$ sudo node main.js or if you want it to run in the background
$ sudo node main.js &
You can also configure it to run at boot
How it works
The daemon translates button presses into keyboard presses.
If you press 'Up' on the controller dpad, the program sends a keyboard 'Up' to the system.
You then map these keys in your application or emulator and you can use the controller as you would normally.
Default Key Mappings
|Dpad Up||Up Arrow|
|Dpad Down||Down Arrow|
|Dpad Left||Left Arrow|
|Dpad Right||Right Arrow|
These mappings can be changed by editing