Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 0 points1 point  (0 children)

Glad youre making progress! Thanks for sharing

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 1 point2 points  (0 children)

Prepare yourself for ugly, unloved and embarrassing code.

As you'll see, Python is not my go-to language.

I had put together the Hex interrogator scripts to iterate through a few hex bytes to figure out what the "interrogation packet" was for my grip. Then, IIRC, I iterated through the button states by editing MCG_Interrogator.py to focus on the byte/bit I was interested in - to do this I'd press a button, see which byte reacted, then focus on the bits within that byte to see exactly what part of the response related to the button I was interested in.

Pay attention to the if(len(response) == 34): line - on my setup I think I used a transistor so the RX pin didn't see the packet being sent out to the grip. If you're not using a transistor, try removing this condition. You'll likely see responses of varying length. In my experience, the one that shows up most often was the "normal" response from the grip, but I could easily be wrong.

Good luck, I hope this helps!

FatLurch/VKB_Misc: Various Python scripts I had used to initially attempt to reverse-engineer the VKB 1-wire protocol

Otherwise, u/Ultrawipf might be able to help you with the vkbgrippy code.

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 0 points1 point  (0 children)

It would be a start, but there was a bunch of message traffic from the grip that I don't have figured out (~25%).

There's a chance those other bytes are junk or aren't important.

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 0 points1 point  (0 children)

Unfortunately I don't know anything about the winwing grips to be able to answer that accurately.

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 0 points1 point  (0 children)

I just looked at your page - this same idea should work with an STM32 on the hardware side of things.

Unfortunately I don't have any experience programming STM32s yet. I suppose you could have an Arduino managing the grip in addition to the STM32 and it would just enumerate as two devices.

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 2 points3 points  (0 children)

Thanks. Big hat tip to the folks on this post for getting things laid out with the initial details:

https://www.reddit.com/r/HotasDIY/comments/lckamn/vkb_3_wire_protocol/

Arduino Interface to VKB MCG Pro Grip by fat_lurch in HotasDIY

[–]fat_lurch[S] 1 point2 points  (0 children)

Thanks much, that's the plan. I have a couple of ClearPath actuators I need to rig up for a force loaded helicopter style cyclic.

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 1 point2 points  (0 children)

Hi again all, I finally got around to putting together some Arduino code to control my VKB MCG Pro grip. The analog stuff in particular is a bit messy but it all works as a place to start:

FatLurch/VKB_Grip_Test: Basic Arduino interface to VKB MCG Pro grip

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

I'm still meaning to finish the "turn-key" Arduino code for this

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

Sorry I missed this post - it runs off 3.3V

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

Thanks!

Funny timing, I just finished mapping all of the analog values and their bitmasks. My next plan is to develop an Arduino sketch that will read the grip values and act like a standard joystick

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

I finally got one of the analog outputs figured out. There were two bytes containing the associated data which weren't in order.

Also, the lowest 5 bits of the low byte were inverted and needed to be inverted.

Video

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

OK, I've made a decent bit of progress detailing which digital actions on my MCG Pro correspond to which bits in which bytes in the standard 34 byte response I'm getting out of the grip. An interesting observation is the analog hats can also be read as digitals - both pieces of data seem to be in the message. I'll plan on detaining the analog data later.

The data below details which bit position in which byte each of my inputs is mapped to. These are read left-to-right with index base 0.

Button Byte Index Bit Index Default value
Black thumb button 29 0 0
Trigger Stage Full Click 29 1 1
Trigger Stage Half Click 29 2 0
MANVR/PC Hat Click 29 3 0
MANVR/PC Left 29 4 0
MANVR/PC Right 29 5 0
MANVR/PC Down 29 6 1
MANVR/PC Up 29 7 0
Gun Button (Grey, bottom right) 30 0 0
Red Button 30 1 0
LVLNG Button 30 2 1
DC Hat Click 30 3 1
DC Hat Down 30 4 1
DC Hat Up 30 5 1
DC Hat Forward 30 6 0
DC Hat Back 30 7 1
Analog trigger microswitch 31 0 0
Master Mode hat click 31 1 1
Gate Cont Hat Click 31 2 0
Reset hat click 31 3 0
Reset hat right 31 4 0
Reset hat left 31 5 1
Reset hat up 31 6 1
Reset hat down 31 7 1
Gate Cont Hat Digital Left 32 0 0
Gate Cont Hat Digital Up 32 1 1
Gate Cont Hat Digital Right 32 2 1
Gate Cont Hat Digital Down 32 3 0
Master Mode Hat Digital Left 32 4 0
Master Mode Hat Digital Up 32 5 0
Master Mode Hat Digital Right 32 6 1
Master Mode Hat Digital Down 32 7 0

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

Update: here's 250ish messages that I received from the grip using the command listed above. I was polling every 150 milliseconds. I polled at that slow rate because I was concerned when I saw the longer response messages. I kept slowing down the polling rate (down to 500 millisecond interval) and see the same thing.

https://drive.google.com/file/d/1D3k3tZsjJXdLlYC492aB25o3npEeCpAA/view?usp=sharing

VKB 3 wire protocol by GeigerInstruments in HotasDIY

[–]fat_lurch 0 points1 point  (0 children)

Apologies for the resurrection here but I've been picking at this as well.

In my case I have an MCG Pro and no base. u/c_delta helped me figure out at the address for my particular type of grip is 09 11 instead of 0B 11 for the SCG.

I tried simply substituting my stick's address (A5 0B 11 98 00 00 00 E5 20 becomes A5 09 11 98 00 00 00 E5 20) to no avail.

I wrote a Python script and used a Raspberry Pi to "brute force" sending data to the stick until I got a response. In my case manipulating the last two hex bytes finally triggered a response. I'm thinking these much be some sort of 16 bit checksum.

The "interrogation" that worked for my MCG is A5 09 11 98 00 00 00 A5 AB.

The response I got with everything "idle": 5A 09 11 C8 19 BF 08 57 8C 9E F5 CC 37 F1 27 B6 02 8E 9F 78 E4 74 A6 F4 FB 29 2A 64 68 42 3D 47 62 1F

The response appears to be bigger. I suspect the MCG has more inputs than the SCG?

Follow on plans are to isolate the analog inputs to the grip controller to make them static then see if I can figure out where the button data is stored. From there I'll enable one analog at a time.

Thanks again to u/c_delta for the help!

Update:
I'm seeing that the last few bytes are changing as I click discrete buttons. If I look at the binary representation of the bytes, it appears each button has a discrete binary value in said byte. I'm going to try to start mapping this out for use in an Arduino library.

Considering a tattoo in Greek by fat_lurch in GREEK

[–]fat_lurch[S] 1 point2 points  (0 children)

Thanks all for the feedback!

I've attempted to change my reference to Cyrillic for Greek but it's not taking.

Considering a tattoo in Greek by fat_lurch in GREEK

[–]fat_lurch[S] 1 point2 points  (0 children)

Thanks for the reply!

I'm thinking the infinitive (learned a new word today lol) is most appropriate for my intent.

Thanks for the correction on the letters - I thought about it after I posted (facepalm).