usb gamepad... sort of...
Moderators: adafruit_support_bill, adafruit

usb gamepad... sort of...

by cauzality on Thu Dec 06, 2012 7:44 pm

hi. I don't really know much about what i'm doing but want to try to make something. I've attached a picture to help you visualize it.

gamepad.png
what the computer sees
gamepad.png (22.21 KiB) Viewed 1161 times

What it really needs to be is a buzzer system for a computer game im making. I want 5 buzzers (big push buttons with LEDs) on wires connecting to a central usb device, which connects/communicates to the computer. I want all the processing to be done by the game (pc's cpu) rather than the buzzer system. All the central device needs to do is pass button state info to the computer and light control info to the LEDs. I think of it as a gamepad without the pad (used by five teams rather than 1 person).

The problem: I don't know how to switch from bytes from the computer to signals in electronics (or vise versa).

So I have a couple questions:
(1) Do I even need a microcontroller for this or can a passive board somehow bridge the gap between computer and the buzzer leads, and
(2) assuming i do need the microcontroller, how many pins/wires of what kind does it need for all these buttons and lights?

again, the game is on the PC, this is just to be an interface device.

Thank You in advance for any time/consideration you give this.

EDIT: I don't actually want it to look like a gamepad :)
cauzality
 
Posts: 19
Joined: Thu Dec 06, 2012 5:04 pm

Re: usb gamepad... sort of...

by adafruit_support_bill on Fri Dec 07, 2012 6:02 am

If I understand what you are trying to do, the way you have it drawn is probably the simplest approach. Start with a game controller (there are inexpensive 3rd party controllers out there). Open the case and remove the buttons. Wire your big buttons to the button pads on the controller. The controller already implements the USB communication to the game computer.

Not sure what you want to do with the LEDs. Most game controllers that I am familiar with have only one output for the vibration motors. If you need to control each led separately, you may need a different solution.
User avatar
adafruit_support_bill
 
Posts: 29736
Joined: Sat Feb 07, 2009 9:11 am

Re: usb gamepad... sort of...

by cauzality on Fri Dec 07, 2012 6:58 pm

thank you for your response. i didnt really take the gamepad visualization seriously - i wanted to convey that i was writing the program for a gamepad so that's what the device could emulate - but when you say it, i kinda feel stupid for not realizing an already made and programmed gamepad could be commandeered! thank you :)

it does somewhat take the fun out of it though and isn't exactly ideal for my purposes (though i might do it anyway being probably the cheapest fix)... however both the games i'm working on which will use this interface in slightly different ways are buzz-in/lock-out style trivia games. This isn't the best for just rigging up a gamepad i dont think. The sound from any buzzer will be played by the common pc speakers that all the buzzers use and IF the computer projects to a larger screen, the on-screen representation of each player's buzzer state might be confusing if not in the order as the players are in physically and it would be uncomfortable for the moderator to have to turn to the screen to try to figure out who beat who when many people try to buzz in and no one is sure who got it first. So i'm afraid the LEDs on the buttons are a must. Also, I do feel a need to learn how make my own usb electronic... for the future! :)

So thank you very much again but, if it's not too much more trouble, can i ask how you might go about building one of these up "from sratch"? TY again.
cauzality
 
Posts: 19
Joined: Thu Dec 06, 2012 5:04 pm

Re: usb gamepad... sort of...

by tastewar on Fri Dec 07, 2012 9:37 pm

I believe the Arduino Leonardo is designed to be able to emulate a USB keyboard/mouse, so that might be a good place to start.
tastewar
 
Posts: 352
Joined: Thu Mar 17, 2011 9:16 am

Re: usb gamepad... sort of...

by adafruit_support_bill on Sat Dec 08, 2012 7:23 am

the Arduino Leonardo is designed to be able to emulate a USB keyboard/mouse

The Micro will do this too.
User avatar
adafruit_support_bill
 
Posts: 29736
Joined: Sat Feb 07, 2009 9:11 am

Re: usb gamepad... sort of...

by cauzality on Sat Dec 08, 2012 11:59 am

thank you both of you, i see i will need a microcontroller and i guess ill just see which is cheaper. I have just one more question then (sorry)...

How many pins of what type do I need for each LED and each Button? I was thinking they would each need two leads per button/led but I don't know if I want GPIOs or what.

Sorry, I really know very little about this stuff and don't want to have to keep ordering more and more stuff because I choose things that won't work for what i'm trying to do.
cauzality
 
Posts: 19
Joined: Thu Dec 06, 2012 5:04 pm

Re: usb gamepad... sort of...

by adafruit_support_bill on Sat Dec 08, 2012 2:55 pm

You will need one GPIO pin for each button and one for each LED. Check out our tutorials for lots of good information on how to connect and program buttons and leds:
http://learn.adafruit.com/category/learn-arduino
User avatar
adafruit_support_bill
 
Posts: 29736
Joined: Sat Feb 07, 2009 9:11 am

Re: usb gamepad... sort of...

by cauzality on Sat Dec 08, 2012 7:52 pm

Awesome - thank you very much! That's an immense help. I'm gonna buy some stuff for a christmas gift i think and try to put it together afterward. I'm feeling more confident that I now know what i need.
cauzality
 
Posts: 19
Joined: Thu Dec 06, 2012 5:04 pm