Game Controller

I would like to create a game controller for Windows. In fact, I have already done this, and my game controller sends a JSON via serial communication. This data contains values for 10 axes that I want to use for a computer game. The hardware and microcontroller part are all done, but I don't know how to make Windows recognize my game controller so that I can use it in games.

JSON example data:

{"axis":[12,145,134,1023,...,0]}

I don't want to use a direct USB connection because in that case, I would have to use microcontrollers that have this capability, and default libraries also have limitations.

your setup - your rules. you need no JSON, just send 10 integers(but Hex will make messages shorter) separated comma with '\n' ending.
then Python script can readUntil('\n') and split on commas to an array.
then you must somehow send values to game. or this game can deserialize by itself?

The thing about using one of the many USB-chip Arduinos is that they put the connection into HID mode rather than CDC and use the driver your PC supports.

Arduino software is Open. It may be easier extending that than writing a driver for the PC.

who needs CDC when HID is available? anyway, how you plan to give axis values to the game?

This is exactly my question, how can we introduce the game controller to the game

@GoForSmoke
@kolaha
AVR microcontrollers with this feature (BUILT IN USB) are expensive and rare in my country, on the other hand, I have heard that this feature has limitations that limit me from 10-axis support.

which microcontrollers are produced in your country?

@mmahyara-eng Try searching for "virtual gamepads". For example, GitHub - ViGEm/ViGEmBus: Windows kernel-mode driver emulating well-known USB game controllers. ViGEmBus emulates real gamepads althrough real gamepads do not have 10 analog axes. But source code is available so perhaps it can be modified to create the controller of your dreams.

Adafruit sells a tiny board with 32U4 for $10 here.

Have you dug into the HID spec? The Arduino end is Open Source.

Knowing this, you don't have to write a Windoze driver.

In my country, there are various chips such as avr stm32 esp series available. However, avr chips with usb connectivity are very expensive, but I can use STM32F103C8T6 which is almost reasonable price, I'm not sure about esp32, does it have usb connectivity?

It was hard for me to understand, but thank you.

I'm sorry but Adafruit sell USB-AVR boards for $10 ea. Whoever fabs those boards is not paying expensive for those chips.

What is expensive is board size. How many on a sheet is why I bought modules instead of $hields.

What you can get from HK, not the same since Xi. Sorry, also the pandemic shipping disasters and piracy of deliveries need to clear before business can turn around like before. I saw what the PC clones did to the price of not just computers but the advances that sales drove. I know how it works, economies have inertia.

is perfect choice. check this out
https://github.com/FreeJoy-Team/FreeJoy

More and more it is true, whatever you want, see if someone else already solved it free.

It's good, maybe I can say it's great, but I would have liked to write the program myself, well, naturally, when I write it myself, I'm familiar with all the limitations, and I can consider, for example, 10, 12, or maybe more axes instead of 8.

if windows has 7-8 axis limitation pro gamepad, then use multireport and declare two gemapads with 5 axis each.

1 Like

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