USB Connected controller for PC

Simply put, I want to make a custom controller for my PC similar to products like the Razer Tartarus and other type keypads.
However, I don't want the key interpretation to be done on the Arduino side, as I want to be able to macro key combinations, etc.... to it.
As well, I also want to have an analog joystick for the thumb control.

As some background, I've been using Arduino's and Raspberry Pi's for about 7 years now, on various costume/cosplay projects that have involved plenty of buttons, servos, motors with feedback, LED's, wireless communications, voice modules, etc.....

But this is my first project delving into the realm of PC control in any way, and in particular, a controller.

I know very little about Windows programming, but I'm less worried about that for now. I have a feeling I can handle it just fine once I get there.

My issue is getting that far.

Personally, I'd prefer to not have it be seen as a keyboard or joystick or mouse. I'd prefer to have it seen as a generic HID device that I can then connect to programmatically on the PC and interpret the data that it sends, and have it function then accordingly.

My issue is I'm not sure how to go about that from a USB perspective, programmatically, on the Arduino side.

I'm planning on using the Adafruit Metro M4 Grand Central board, as this has the ATSAMD51 on it, so plenty of inputs to handle the required buttons, etc.....and should have native USB as well.

I'm planning on having roughly 30 buttons, along with an analog joystick.
The joystick will either be a 'playstation/xbox' thumb type joystick, or possibly a higher accuracy robotics type joystick. Either should work, and generally be the same for all intents and purposes (accuracy will be the biggest difference).
I plan on having at least a 5 x 6 configuration of 'buttons' as well (more or less, half a keyboard).

So, I guess my biggest concerns moving forward. Does this make sense? Is it feasible?
And then, lastly, maybe some links or information on an example for HID input that isn't just a straight up keyboard or mouse or joystick? That's been the biggest issue I've run into, is finding an example that I can understand and relate to.

Thanks!

If you don't want your device to appear as a keyboard or gamepad, you need a windows driver that would work with it. I think it's best to have your device appear as a gamepad so your keys map into the generic gamepad keys and joysticks. You don't need to make a driver for that. Then if you wish your keys to map into some macros or actions, you either find a software that does that or write your own. Unless your device falls so far outside the generic gamepad usage, you should stick with something generic and universally supported.

liuzengqiang:
If you don't want your device to appear as a keyboard or gamepad, you need a windows driver that would work with it. I think it's best to have your device appear as a gamepad so your keys map into the generic gamepad keys and joysticks. You don't need to make a driver for that. Then if you wish your keys to map into some macros or actions, you either find a software that does that or write your own. Unless your device falls so far outside the generic gamepad usage, you should stick with something generic and universally supported.

That's sort of the point. It doesn't really fall into the 'gamepad' or 'joystick' category. If anything, it's more a keypad with a joystick added onto it.

I was really hoping to not have to generate something to deal with it, but it's sounding more and more like just making something generic is going to prove to be impossible.

Then it's just a composite device with two interfaces, one is a keypad and the other is a joystick. Pretty sure people have hodgepodged things like that but it's still not a custom device by usb class. Arduino Leonardo acting simultaneously as a keyboard, a mouse, and up to 3 gamepads, and a serial port, is a composite device, not a custom USB class.

liuzengqiang:
Then it's just a composite device with two interfaces, one is a keypad and the other is a joystick. Pretty sure people have hodgepodged things like that but it's still not a custom device by usb class. Arduino Leonardo acting simultaneously as a keyboard, a mouse, and up to 3 gamepads, and a serial port, is a composite device, not a custom USB class.

Interesting.....so it just shows up as multiple different devices then?

Sorry, my understanding of that side within windows is pretty limited, mainly just a hardware (electrical engineer) with more than enough embedded coding to do what I've needed, but this is my first time delving into the Windows side of things.

I think I know what you are trying to do. If so, I did a similar project. I like to fly flight simulators/games. One in particular is a WWI flight simulator called Rise of Flight. There are dozens of things to control and each is done with key strokes but it is a clumsy thing to do while trying to fly in the sim.

I designed a console that connects to the computer via USB. Each button, switch, knob, etc. on the panel sends the appropriate keystrokes (or whatever) to the computer.

Is this the kind of project you are trying to do?

Sort of, but not quite.
I wish to incorporate a joystick/thumbstick (analog), along with using more of a virtual type keyboard (basically, the ability to bind a key, macro, set of actions, set of keys, or even media actions, etc....) to it.
Preferably, I'd prefer the software on the PC to control what any key does.
Meanwhile, the joystick would be used more for analog movement (think forward/backward/strafe). This way you not only get slight movement forward/backward/sides, but full movement.

If that makes sense?

Get installed with the suitable library and sort out

vishkas:
Get installed with the suitable library and sort out

That's about as helpful as "Google it". Actually, google it is more helpful than your comment.....

You need a custom HID driver, which is not easy on Windows. The device side is quite easy, define your own report format, such as a sequence of presses and releases of generic keys say from key 1 to key 16, and later part of the report has analog values of the joysticks of any format you want. The report can be as long as 64 bytes long. Then you may map each key to anything by your device driver, which I wish I knew how to write. Driver development is a specialized skill set in software and firmware engineering. Then your driver needs to get certified by Microsoft.

virtual type keyboard (basically, the ability to bind a key, macro, set of actions, set of keys, or even media actions, etc....) to it.
Preferably, I'd prefer the software on the PC to control what any key does.

There are lots of Windows key macro programs. For example, https://www.autohotkey.com/. A Leonardo/Pro Micro can send the key(s) that trigger the desired macro. For example, press Arduino button, Arduino sends Ctrl-Alt-F1. autohotkey triggers on this key combo to execute the desired script. The idea is to use obscure key combos as triggers that are not used in real life. This avoids accidental triggers when using a real keyboard. The action for each key is determined on by the script running on the PC so the Arduino firmware does not need to be updated.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.