Homepage › Forums › RetroPie Project › Everything else related to the RetroPie Project › Tutorial to get wiimotes with classic controllers to work with RetroPie
Tagged: classic controller, controllers, wii, wiimote
- This topic has 21 replies, 16 voices, and was last updated 9 years, 3 months ago by dertak.
-
AuthorPosts
-
11/10/2013 at 21:19 #3145rolschParticipant
This tutorial shows how to get one to four wiimotes (the controller of Nintendo Wii) running with RetroPi with or without a classic controller (attached to the wiimote).
Prerequisites
1. For the following I assume that RetroPi was installed and is running with other controls (like keyboard, joystick etc.). I followed the excellent tutorial http://supernintendopi.wordpress.com/2013/01/23/an-a-to-z-beginners-guide-to-installing-retropie-on-a-raspberry-pi/ for this (using the “RetroPie Project SD Card Image”).
2. You have a blue-tooth dongle (sometimes called blue-tooth adapter). For a list of dongles known to work with Raspberry Pi see http://elinux.org/RPi_USB_Bluetooth_adapters#Working_Bluetooth_adapters ).
Note: Put the dongle in one of the USB ports of the Raspberry Pi directly, don’t put it into a USB hub (I read somewhere that it doesn’t work even with an active USB hub).
Installation
Now install the needed parts:
sudo apt-get install bluetooth sudo apt-get install python-cwiid sudo apt-get install wminput
Getting the wiimotes to work
. uinput device needs to work with non-root users. To do so, create a file called /etc/udev/rules.d/wiimote.rules with the following line:
KERNEL==“uinput“, MODE:=“0666“
Reboot the Raspberry Pi to make this change active.
. Check that the blue-tooth dongle works: Command
/etc/init.d/bluetooth status
should return that bluetooth is working. Scan for the wiimotes. Start
hcitool scan
and press 1+2 on your wiimote(s). After a short while, the output should be something likeScanning ... 00:19:1D:87:90:38 Nintendo RVL-CNT-01 00:19:1D:88:EF:12 Nintendo RVL-CNT-01
Take a note of the addresses of your wiimotes (the 00:19:1D:87:90:38 in the output above), we need that later.
Note: If the scan is not successful try it again. Sometimes you need to try it several times (I read that somewhere, but it always worked for me the first time).. Correct usage of wminput
For every wiimote, we need one wminput command to map the wiimote (and the classic controller) buttons to something emulationstation and the emulators can work with. wminput comes with configuration files (in directory /etc/cwiid/wminput). I created my own configuration file, which works if you use a wiimote with or without a classic controller. Create the file /home/pi/mywminput with the following content:Classic.Dpad.X = ABS_X Classic.Dpad.Y = ABS_Y Classic.LStick.X = ABS_HAT0X Classic.LStick.Y = ABS_HAT0Y Classic.RStick.X = ABS_HAT1X Classic.RStick.Y = ABS_HAT1Y Classic.A = BTN_A Classic.B = BTN_B Classic.X = BTN_X Classic.Y = BTN_Y Classic.Minus = BTN_SELECT Classic.Plus = BTN_START Classic.Home = BTN_MODE Classic.L = BTN_TL Classic.R = BTN_TR Classic.ZL = BTN_TL2 Classic.ZR = BTN_TR2 Wiimote.A = BTN_A Wiimote.B = BTN_B Wiimote.Dpad.X = -ABS_Y Wiimote.Dpad.Y = ABS_X Wiimote.Minus = BTN_SELECT Wiimote.Plus = BTN_START Wiimote.Home = BTN_MODE Wiimote.1 = BTN_X Wiimote.2 = BTN_Y
If the Raspberry Pi is started and emulationstation starts, we want to register the wiimotes so they can be used with emulationstation and the emulators.
I did it the following way:
mkdir /home/pi/bin
create file /home/pi/bin/attachwii.sh with the following content:#!/bin/bash hcitool dev | grep hci >/dev/null if test $? -eq 0 ; then wminput -d -c /home/pi/mywminput 00:19:1D:92:90:38 & wminput -d -c /home/pi/mywminput 00:19:1D:84:EF:33 & else echo "Blue-tooth adapter not present!" fi
Note: You need one wminput line for every wiimote you want to use (i.e. the above is for two wiimotes)
Note 2: You need to replace the addresses of the wiimotes above by the addresses of your wiimotes (shown by command „hcitool scan“ as shown above).
make the script executable with
chmod 775 /home/pi/bin/attachwii.sh
have the script be started just before emulationstation starts. To do so, edit the file /etc/profile
The last line should be
[ -n "${SSH_CONNECTION}" ] || emulationstation
right before this line, add the line
/home/pi/bin/attachwii.sh
and save the file.If you now do a reboot, wait until emulationstation has been started. When it did, press 1+2 on all of your wiimotes to register the wiimotes. Now you can „tell“ emulationstation and the emulators to use the wiimotes (and the classic controllers). Here are my configuration files.
For emulationstation:
Content of /home/pi/.emulationstation/es_input.cfg for two wiimotes:<?xml version="1.0"?> <inputList> <inputConfig type="joystick" deviceName="Nintendo Wiimote"> <input name="a" type="button" id="0" value="1" /> <input name="b" type="button" id="1" value="1" /> <input name="down" type="axis" id="1" value="-1" /> <input name="left" type="axis" id="0" value="-1" /> <input name="menu" type="button" id="2" value="1" /> <input name="pagedown" type="button" id="4" value="1" /> <input name="pageup" type="button" id="5" value="1" /> <input name="right" type="axis" id="0" value="1" /> <input name="select" type="button" id="3" value="1" /> <input name="up" type="axis" id="1" value="1" /> </inputConfig> <inputConfig type="joystick" deviceName="Nintendo Wiimote"> <input name="a" type="button" id="0" value="1" /> <input name="b" type="button" id="1" value="1" /> <input name="down" type="axis" id="1" value="-1" /> <input name="left" type="axis" id="0" value="-1" /> <input name="menu" type="button" id="2" value="1" /> <input name="pagedown" type="button" id="4" value="1" /> <input name="pageup" type="button" id="5" value="1" /> <input name="right" type="axis" id="0" value="1" /> <input name="select" type="button" id="3" value="1" /> <input name="up" type="axis" id="1" value="1" /> </inputConfig> <inputConfig type="keyboard"> <input name="a" type="key" id="13" value="1" /> <input name="b" type="key" id="8" value="1" /> <input name="down" type="key" id="274" value="1" /> <input name="left" type="key" id="276" value="1" /> <input name="menu" type="key" id="32" value="1" /> <input name="right" type="key" id="275" value="1" /> <input name="up" type="key" id="273" value="1" /> </inputConfig> </inputList>
For retroarch:
End of file /home/pi/RetroPi/configs/all/retroarch.cfg (for two wiimotes):input_player1_joypad_index = "0" input_player1_b_btn = "0" input_player1_y_btn = "2" input_player1_select_btn = "8" input_player1_start_btn = "9" input_player1_up_axis = "+1" input_player1_down_axis = "-1" input_player1_left_axis = "-0" input_player1_right_axis = "+0" input_player1_a_btn = "1" input_player1_x_btn = "3" input_player1_l_btn = "4" input_player1_r_btn = "5" input_player1_l2_btn = "6" input_player1_r2_btn = "7" input_player1_l3_btn = "10" input_player1_r3_btn = "10" input_player1_l_x_plus_axis = "+2" input_player1_l_x_minus_axis = "-2" input_player1_l_y_plus_axis = "-3" input_player1_l_y_minus_axis = "+3" input_player1_r_x_plus_axis = "+4" input_player1_r_x_minus_axis = "-4" input_player1_r_y_plus_axis = "-5" input_player1_r_y_minus_axis = "+5" input_player2_joypad_index = "1" input_player2_b_btn = "1" input_player2_y_btn = "3" input_player2_select_btn = "8" input_player2_start_btn = "9" input_player2_up_axis = "+1" input_player2_down_axis = "-1" input_player2_left_axis = "-0" input_player2_right_axis = "+0" input_player2_a_btn = "0" input_player2_x_btn = "2" input_player2_l_btn = "4" input_player2_r_btn = "5" input_player2_l2_btn = "6" input_player2_r2_btn = "7" input_player2_l3_btn = "10" input_player2_r3_btn = "10" input_player2_l_x_plus_axis = "+2" input_player2_l_x_minus_axis = "-2" input_player2_l_y_plus_axis = "-3" input_player2_l_y_minus_axis = "+3" input_player2_r_x_plus_axis = "+4" input_player2_r_x_minus_axis = "-4" input_player2_r_y_plus_axis = "-5" input_player2_r_y_minus_axis = "+5"
Make sure that the settings are only one time in retroarch.cfg file (i.e. if you have a line
input_player1_b_btn = "0"
in the retroarch.cfg file before adding my lines, remove (or out-comment) the whole section. If you want to use more than two wiimotes, search for the line
input_player1_joypad_index = 0
in retroarch.cfg and add the a corresponding line for the other wiimotes. For example you should have the following lines in retroarch.cfg for four wiimotes:input_player1_joypad_index = 0 input_player2_joypad_index = 1 input_player3_joypad_index = 2 input_player4_joypad_index = 3
Finally, add the following two lines at the end of /home/pi/RetroPi/configs/all/retroarch.cfg:
input_enable_hotkey_btn = "0" input_exit_emulator_btn = "1"
This will exit the emulator when you press A+B simultaneously on the wiimote (or the classic controller).
Note: the config files above work for wiimotes with or without classic controller.
Note 2: If you want to use the wiimote (i.e. not only the classic controller) and you are using my config files, you need to hold the wiimote horizontally (with the power button on the right).Hope that helps.
11/10/2013 at 21:37 #3146petrockblogKeymasterThanks a lot for that!
I have also added this guide to the wiki at https://github.com/retropie/RetroPie-Setup/wiki/Wiimotes-with-classic-controllers.
01/08/2014 at 16:38 #3998rogueapacheParticipantHow would I change the config files to use the nunchuck instead of classic controllers?
08/29/2014 at 16:25 #47384paulGuestHi, I went through this tutorial and it seems that the location of the config files has changed from
$home/RetroPie/configs/
to/opt/retropie/emulators/RetroArch/configs
. While the configs for the individual emulators is in/opt/retropie/configs/
.Thanks for the tutorial!
09/23/2014 at 16:09 #75948AMeyerGuestHello there,
thank you for the tutorial.
I´m on retropie 2.3- I have followed all the steps, but I get an
unable to open uinput
at startup.
Any ideas?
09/23/2014 at 17:59 #76124escherParticipantGreat tutorial!
There is any game that we can use the wiimote as a gun that runs in rpi ? Like The house of the dead ?
10/23/2014 at 22:57 #81977troyektoParticipantThere is a little mistake:
KERNEL==“uinput“, MODE:=“0666“
Should be:
KERNEL=="uinput", MODE:="0666"
( ” instead of “ ).
Anyway, excellent tutorial.
01/06/2015 at 04:47 #84661selimParticipantHow would you make the remote’s LED’s automatically turn on then too so that you can clearly see when it is connected?
Edit:
Better question, do any of the scripts ever store the remote as a variable? Because I couldn’t find that spot if it does.01/08/2015 at 02:26 #84776buggersParticipantI did everything here and when it loads the emulation station screen it says no gamepad detected. Even though I know the bluetooth device paired it.
controller also doesn’t even work in games either
any idea?
01/08/2015 at 03:21 #84778selimParticipantAfter connecting the remote, do:
`jstest /dev/input/js0
Does that show your button presses?01/08/2015 at 05:19 #84786buggersParticipant[quote=84778]After connecting the remote, do:
`jstest /dev/input/js0
Does that show your button presses?[/quote]actually comes up as jstest command not found
01/08/2015 at 23:50 #84816selimParticipantHm
01/09/2015 at 11:33 #84832jayp76ParticipantNice tutorial.
Is cwiid a daemon? That would be awesome.
I would try to connecy my 8-bitdo FC30 Blueetooth controllers with this in wiimote mode. Seems to be the missing piece of my portable retro console.
I’ll report if it is working with FC30 in wiimote mode.01/24/2015 at 10:44 #85848bobinioParticipantGuys,
Is this what I need to get a wii u pro controller working?
I guess the “Mywminput” file needs to have more button map pings in it?
Any help is appreciated.
02/18/2015 at 22:46 #87994squiffybagshawParticipantThanks for the Tutorial.
I’ve run through it and got stuck part way through. Trying to get Wiimotes working with my Raspberry Pi B+ and Retropie.make the script executable with
chmod 775 /home/pi/bin/attachwii.sh
I get an “Operation not permitted” for the
chmod
.
I tried to prefix the command withsudo
and that didn’t visibly do anything, but no error.And, on reboot, pressing the 1+2 buttons on my wiimote, Emulation Station doesn’t recognise them.
Everything up to that point seemed to go OK.
Any thoughts?
Thanks02/22/2015 at 19:44 #88623brainfrzParticipantThank you for this helpfull tutorial, i got it working, but i’m breaking my thoughts over the following:
Whenever i connect my wiimote, my SSH session floods with the following message: Socket connect error (control channel)
As soon as i disconnect my wiimote, all is fine again. I can’t figure out where to start looking to fix this. i hope there’s someone here that knows how to fix this, or can point me in the right direction.Also a minor issue, after using the above retroarch.cfg example, the buttons X and Y, and A and B were swapped. easy to fix though. Edit: on SNES only it seems, so i just added the lines to the console-specific .cfg, so i can set them up per console.
Also it would be really nice if the LED would light up to show me it’s powered on. And could i use the “home” button to go back to emulationstation?
02/26/2015 at 09:05 #89215brainfrzParticipantJust a quick add for reference, i found the attachwii.sh script started too fast on my rpi2. 9 out of 10 times the bluetooth dongle wasn’t initialized before it ran, so it gave me the “Blue-tooth adapter not present!” notification. After starting it manually it worked fine. So i added a simple “sleep 1” in the script so it would wait a second. After that, i haven’t had this problem again.
#!/bin/bash sleep 1 hcitool dev | grep hci >/dev/null if test $? -eq 0 ; then wminput -d -c /home/pi/mywminput 00:19:1D:92:90:38 & wminput -d -c /home/pi/mywminput 00:19:1D:84:EF:33 & else echo "Blue-tooth adapter not present!" fi
04/04/2015 at 05:29 #93705kelemvorParticipantSo are these still the best instructions to use for the Wiimote?
When my Attachwi.sh file runs and the last line “fi” runs, I get spammed with “unexpected character”.
Is that normal?I was able to scan the bluetooth and get the MAC for my Wii mote.
If I load into Emu Station, then I can’t use my keyboard at all if my BT adapter is plugged in. As soon as I unplug it then the keyboard starts working normally. Anyone have any ideas what the problem might be?
I just want to use the u/d/l/r pad and the 1/2 buttons to play things like Mario until I can get an Xbox controller or something like that.
Thanks!
04/05/2015 at 19:10 #93873lakespiralParticipantWhy on earth would you hold it with the power button to the right? Are you left handed? In emulationstation only button accepted was “A” (not 2). I started SMB1 with my keyboard. Start and select buttons weren’t anywhere and 1 & 2 didn’t do nothing. Only A & B. And now my playstation controllers or nes controllers won’t work anymore. So after few hours of work, nothing works anymore.
Edit: Fucked up saving es_input.cfg. My bad. But the buttons are still wrong…
04/05/2015 at 20:51 #93883kelemvorParticipantNevermind my question. I picked up a wired Xbox compatible controller and had this whole thing setup within a couple minutes. :) Too much messing around to use the Wii controller.
04/05/2015 at 21:15 #93894bruncheroParticipantIf you want your WiiMotes giving a connection status, just add a line to your mywminput file:
Plugin.led.Led1 = 1
You probably want different leds active on two controllers, which means you have provide different mywminput files to wminput, e.g. one with Led1 and one with Led2 activated.
09/10/2015 at 13:08 #105777dertakParticipantEDIT: I think I cleared all problems. And I’m stupid :)
PROBLEM 1:
Wiimote detected only If I login via SSH:
Really stupid problem because this tutorial mention it:
https://github.com/RetroPie/RetroPie-Setup/wiki/Wiimotes-with-classic-controllerssleep 1 was the solution
#!/bin/bash sleep 1 # Wait until Bluetooth services are fully initialized hcitool dev | grep hci >/dev/null if test $? -eq 0 ; then wminput -d -c /home/pi/mywminput 00:19:1D:92:90:38 & ... fi
PROBLEM 2:
select and start buttons didn’t work.
Just delete /home/pi/.emulationstation/es_input.cfg and follow GUI-Incstructions for button mapping. I was lazy and used mapping from this tutorial.My mapping (just Classic Pro Controller):
<?xml version="1.0"?> <inputList> <inputConfig type="joystick" deviceName="Nintendo Wiimote" deviceGUID="050000$ <input name="a" type="button" id="0" value="1" /> <input name="b" type="button" id="1" value="1" /> <input name="down" type="axis" id="1" value="-1" /> <input name="left" type="axis" id="0" value="-1" /> <input name="leftanalogdown" type="axis" id="4" value="-1" /> <input name="leftanalogleft" type="axis" id="3" value="-1" /> <input name="leftanalogright" type="axis" id="3" value="1" /> <input name="leftanalogup" type="axis" id="4" value="1" /> <input name="leftbottom" type="button" id="6" value="1" /> <input name="lefttop" type="button" id="4" value="1" /> <input name="right" type="axis" id="0" value="1" /> <input name="rightanalogdown" type="axis" id="5" value="-1" /> <input name="rightanalogleft" type="axis" id="2" value="-1" /> <input name="rightanalogright" type="axis" id="2" value="1" /> <input name="rightanalogup" type="axis" id="5" value="1" /> <input name="rightbottom" type="button" id="7" value="1" /> <input name="righttop" type="button" id="5" value="1" /> <input name="select" type="button" id="8" value="1" /> <input name="start" type="button" id="9" value="1" /> <input name="up" type="axis" id="1" value="1" /> <input name="x" type="button" id="2" value="1" /> <input name="y" type="button" id="3" value="1" /> </inputConfig> </inputList>
I have other values for Start and Select.
<input name=”select” type=”button” id=”8″ value=”1″ />
<input name=”start” type=”button” id=”9″ value=”1″ /> -
AuthorPosts
- The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.