Maker Pro
Maker Pro

Custom GamePad

alexey7783

May 24, 2016
2
Joined
May 24, 2016
Messages
2
Hi guys,

my name is Alex and I am currently working on a project for a custom gamepad. You have to know, I only have basic skills in electronics and some advanced skills in programming in c# and Java. But I am a swift learner :)

So following task:

I need to build a custom gamepad, that needs to run wireless. There are digital buttons and switches for now, maybe more to come (like analog inputs). I already found the EZ-Key HID from Adafruid, which gives me everything out of the box, with one big thing missing: I need a feedback from the PC to the gamepad as well, for now only digital (switches on/off).

I managed to get something working via a virtual serial COM port in Unity3D, but this is not what I need, because this isn't plug and play at the end (COM port management, etc). What I need is a "real gamepad" that is recognized via the OS and can directly be used in the different games and game engines. I don't want to write custom SDKs for all the game engines out there....

So here my requirements:

- wireless (with standard Bluetooth dongle on PC side or even a custom USB receiver/transmitter like the XBOX360 has?)
- bidirectional, sending keystrokes to the PC and receiving digital (and later analog) data from the PC
- directly integrated and recognized by the OS as Gamepad (or keyboard also OK) after pairing
- based on Arduino or comparable parts, or easy accessible

I was told that that shouldn't be to hard, but to be honest, I didn't succeed yet after hours of research HID seems perfect apart from the unidirectional communications

Please be so kind and help me, I don't have much time left for this project :-(

Thank you very much and my kind regards

Alex
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Hi guys,

my name is Alex and I am currently working on a project for a custom gamepad. You have to know, I only have basic skills in electronics and some advanced skills in programming in c# and Java. But I am a swift learner :)

So following task:

I need to build a custom gamepad, that needs to run wireless. There are digital buttons and switches for now, maybe more to come (like analog inputs). I already found the EZ-Key HID from Adafruid, which gives me everything out of the box, with one big thing missing: I need a feedback from the PC to the gamepad as well, for now only digital (switches on/off).

I managed to get something working via a virtual serial COM port in Unity3D, but this is not what I need, because this isn't plug and play at the end (COM port management, etc). What I need is a "real gamepad" that is recognized via the OS and can directly be used in the different games and game engines. I don't want to write custom SDKs for all the game engines out there....

So here my requirements:

- wireless (with standard Bluetooth dongle on PC side or even a custom USB receiver/transmitter like the XBOX360 has?)
- bidirectional, sending keystrokes to the PC and receiving digital (and later analog) data from the PC
- directly integrated and recognized by the OS as Gamepad (or keyboard also OK) after pairing
- based on Arduino or comparable parts, or easy accessible

I was told that that shouldn't be to hard, but to be honest, I didn't succeed yet after hours of research HID seems perfect apart from the unidirectional communications

Please be so kind and help me, I don't have much time left for this project :-(

Thank you very much and my kind regards

Alex
That's an ambitious project to start with... it's not exactly 'hard', but will be time consuming.
What kind of data do you want to 'return' to the controller?
You can always modify an existing gamepad. You should have at least 5 analogue outputs, and 14 digital outputs if you use an Xbox-like or PS2/PS3 type controller.
Otherwise, you will need to revisit the HID project... Look at the Arduino HID projects out there. You can use an existing framework, just modify to suit your needs.
Take a look here for some info > https://learn.adafruit.com/trinket-usb-keyboard/overview

Your actual gamepad will be really simple... wireless transmitter, power, some buttons/joystick, and a basic program on a microcontroller that will send a very frequent serial steam to the transmitter.
The receiver will be the tricky part... Your wireless receiver will receive the serial stream and pass it to your second microcontroller and will be tasked with converting the serial stream or however you want to encode your button/joystick presses to the HID compatible stream to the computer via USB.
That tinket usb thing I posted, should help you figure out how to make an arduino act like a keyboard/mouse/joystick/MIDI device. This really sounds like the only hurdle you have...

As far as 'return' data is concerned... This will entirely depend on the specific HID device that's being presented... some game controllers support returning data to control rumble motors or force feedback... they often require their own drivers though. You may need to create your own ID for the USB device you are working with so you can make your own driver that will actually send data back.

I've seen people be creative and actually use the 3 LED indicators for scroll, number, and caps lock to get the PC to send data to a connected device... low data rate, and only digital though. Also prone to interference from the user pressing the (Caps|Num|Scroll)-Lock button.
 

alexey7783

May 24, 2016
2
Joined
May 24, 2016
Messages
2
Hello Gryd,
That's an ambitious project to start with... it's not exactly 'hard', but will be time consuming.
What kind of data do you want to 'return' to the controller?
You can always modify an existing gamepad. You should have at least 5 analogue outputs, and 14 digital outputs if you use an Xbox-like or PS2/PS3 type controller.
Otherwise, you will need to revisit the HID project... Look at the Arduino HID projects out there. You can use an existing framework, just modify to suit your needs.
Take a look here for some info > https://learn.adafruit.com/trinket-usb-keyboard/overview

Your actual gamepad will be really simple... wireless transmitter, power, some buttons/joystick, and a basic program on a microcontroller that will send a very frequent serial steam to the transmitter.
The receiver will be the tricky part... Your wireless receiver will receive the serial stream and pass it to your second microcontroller and will be tasked with converting the serial stream or however you want to encode your button/joystick presses to the HID compatible stream to the computer via USB.
That tinket usb thing I posted, should help you figure out how to make an arduino act like a keyboard/mouse/joystick/MIDI device. This really sounds like the only hurdle you have...

As far as 'return' data is concerned... This will entirely depend on the specific HID device that's being presented... some game controllers support returning data to control rumble motors or force feedback... they often require their own drivers though. You may need to create your own ID for the USB device you are working with so you can make your own driver that will actually send data back.

I've seen people be creative and actually use the 3 LED indicators for scroll, number, and caps lock to get the PC to send data to a connected device... low data rate, and only digital though. Also prone to interference from the user pressing the (Caps|Num|Scroll)-Lock button.

Hello Gryd,

thank you very very much for your answer, much appreciated :) The trinket thingy sounds promosing. Is it similar to the leonardo board?

Writing drivers sounds difficult :-( I think I need to reactivate some old friends who are much better in this than I am, but let's see if they find the time. I will go through your tipps and give a feedback!!

Cheers

Alex
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Hello Gryd,


Hello Gryd,

thank you very very much for your answer, much appreciated :) The trinket thingy sounds promosing. Is it similar to the leonardo board?

Writing drivers sounds difficult :-( I think I need to reactivate some old friends who are much better in this than I am, but let's see if they find the time. I will go through your tipps and give a feedback!!

Cheers

Alex
The trinket can be viewed as a very restricted arduino... You will use the same programs, and programming language to write for both the Trinket, and Lernardo.
I linked it more as a resource to see how you can program an HID device with an arduino. If you want to use a trinket with a wireless receiver, then that's certainly an option for you ;)

As far as custom drivers are concerned, that will really depend on the type of data you want to 'return' to the controller... if it's simple, maybe you can piggy-back on an existing driver...
This feature will be the trickiest part for you though.
 
Top