Joystick using GPIO and USB at the same time
-
Thank you for all your inputs.
@ senkun
Adding a usb board takes a lot of space for my project that is why I am trying to use the Raspberry pi GPIO's
The ControlBlock migth be a solution it is a little bit expensive but it is a option.@ Riverstorm
I just have to configure the mapping of the inputs once right?
O I have to configure, compile the file run the command for every game I have to run (When you say compile the file I assume that is not a true compiler but a parser). -
@edsousa84 said in Joystick using GPIO and USB at the same time:
Thank you for all your inputs.
@ Riverstorm
I just have to configure the mapping of the inputs once right?
O I have to configure, compile the file run the command for every game I have to run (When you say compile the file I assume that is not a true compiler but a parser).Yes, you only need to do it once and it's the 'make' command, if that's a parser?
You're basically tying the button to a keyboard input. So if I go out to the prompt and press button 5 on the game console it literally prints z as if I pressed z on a keyboard, the buttons act just like a keyboard. From there you just tie the buttons to the emulator inputs. So MAME buttons A & B are Left-Ctrl & Left-Alt. Above you can see I tied KEY_LEFTCTRL to GPIO 23 and KEY_LEFTALT to GPIO 18. In MAME Left-Ctrl and Left- Alt are already the default keys so right off the bat my A & B buttons worked in MAME. In other emulators I had to reassign the keys to work with Left-Ctrl and Left-Alt, etc.
With that being said if you plan to use more than one emulator I would change the control keys like Left-Ctrl and Left-Alt as they do seems to wreak havoc in other emulators sometimes. Avoid them altogether and use letters which work the best when using GPIO. Except for like Enter, Escape, Tab which work fine for management like exiting the emulator, entering the settings, etc. I just avoided control keys as the main game buttons.
As I remember a little. If you're a button masher or hitting a lot of buttons it does confuse the GPIO occasionally where as an I-PAC keeps up flawlessly. The tradeoff is the price, GPIO is pretty much free as you still need to run the wires and ground regardless of input. For wire organization and I suppose troubleshooting I used multiple grounds grouping main keys, joystick, management buttons, etc. but I think you could use a common ground through the whole wiring harness if you wanted.
The main difference between the I-PAC and GPIO is configuring the retrogame.c file, running make and setting the polling to auto-load on boot. Once you have your retrogame.c file setup you can reuse it for other setups (using the same input setup) which makes things much quicker. I also just pull the emulator config files and as long as the version doesn't change in RetroPie I reuse the config files by copying and overwriting the default files.
Some of this is sketchy as it's been a few years since I worked with the GPIO inputs.
-
One more question is it possible to use Retropie without a mouse and a keyboard? Not the configuration part ofcourse but to a normal alredy configurated usage is it possible?
-
@edsousa84 said in Joystick using GPIO and USB at the same time:
One more question is it possible to use Retropie without a mouse and a keyboard? Not the configuration part ofcourse but to a normal alredy configurated usage is it possible?
Absolutely, take a look at the link of the project I did above. That's all I use. I plugin the power and away I go. I pull up the Emulationstation Quit Menu and Shutdown System when done. I have to manually unplug the power cord or the Pi still gets power but it should be easy enough to wire in a switch with some light soldering and shrink tubing or there are several inline pigtails with an off/on switch. The issue I am currently working out is adding volume buttons to the back with normal open switches. A power button later but I don't mind unplugging it for now since it's such a small counter top unit really. It's a fun unit and not so much for serious gaming even though it does a fairly decent job.
I use a keyboard for troubleshooting or adding a game, etc. and it doubles nicely for ScummVM games or other emulators that might need a keyboard like C64, etc. I bought a wireless keyboard/mouse with a built-in Trackpad. It's about an 80% full size keyboard so it's compact enough to move around until you get the bugs ironed out. The wireless dongle is one of those penny micro size ones I just leave plugged in. Here's the keyboard I use. I got it on sale for $20.
http://www.amazon.com/Logitech-Wireless-Keyboard-Built-In-Multi-Touch/dp/B005DKZTMG
-
@edsousa84 said in Joystick using GPIO and USB at the same time:
One more question is it possible to use Retropie without a mouse and a keyboard? Not the configuration part ofcourse but to a normal alredy configurated usage is it possible?
Depending on which emulators you're setting up with Retropie, but generally with mame and all console gaming emulators you can ditch the kbd/mouse once you've got em all configured.
Seriously, have a good look and read up on the ControlBlock, it has everything you'd want, all worked out nicely and would save you a ton of headaches trying to piecemeal something together.
-
@senkun said
would save you a ton of headaches trying to piecemeal something together.
Honestly it's a nice project and learning experience especially for younger folks in so many aspects from hardware, electrical to software. I enjoyed the "journey" almost more than the gaming. Well I should say I have spent more time building the boxes than I have playing them.
Anyway the ControlBlock looks awesome! I see they are sold out of "+ 4 LOCKING POSTS (DUAL SIDE LOCK-IN SUPPORT, MADE OF NYLON) ($41.50) (SOLD OUT)". Is there mounting hardware with the Block or is that a separate order? The city I live in has very little in the way of proper nylon washers and spacers.
-
@Riverstorm you don't really need the locking posts if you're careful not to apply pressure while wiring it up. They just take the strain off the gpio pins in case you press too hard on the board. Just wire up everything before you plug in on to your pi.
-
Thank you again for all your help.
-
@senkun said in Joystick using GPIO and USB at the same time:
I know, sad to admit, but that is one sexy pic!
-
@Riverstorm said:
I know, sad to admit, but that is one sexy pic!
lol it is innit? look at all them slots waitin to be filled... ;P
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.