Jump to content

planning an arduino game controller

tsmspace
Go to solution Solved by JoeSixPack,
3 hours ago, tsmspace said:

oof. 

 

I can make a nice serial monitor showing my sticks and buttons,,, but I CANT figure out how to make the ibus protocol... 

 

also, it looks like the dev for the vjoyfeeder is basically the whole source of knowledge, so my project might hinge on him personally.... 

 

well, my game controller doesn't work. that's because it is a standard x-box type and only has two sticks, while I want four. 

 

Luckily, I used to have a bunch of arduino stuff, and already have all the parts I need to put together an arduino controller with four sticks, one for each thumb, and one for each pointer finger., then I'll try and put a bunch of buttons around. I will put some as triggers on the back with the pointer sticks, and some for the thumbs like xbox. Thinking out loud I'm not sure if an uno has enough pins to run the operation, I might need to use a register or io shield, I have some stuff that might do it. 

 

What I don't know , is what's a good way to take all the parts and wires, but then PROGRAM them to work like any other game controller, so that I can play my favorite games. Normally in controller configurations there are PLENTY of axis options, so that it LOOKS like if i set up a stick, I should be able to assign it to an axis in the game, , but I really have never tried such a thing, when I built a controller for my arduino it was only to control other arduino parts, and I could just use the pwm readings to control x,y,z coordinates or something in a simple code. 

 

I know there are nothing but tutorials, which I will use, but I'm going to buy a drill, and wanted to see if there are any other enthusiasts with recommendations on what is the better plan , or the more popular well supported "driver" options. I haven't played with my arduinos in over 2 years, I might as well have no idea what I'm doing. 

 

Thanks!! I also would love to talk theory about my plans for the controller in space sims!! any fans of Starmade?? 

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, tsmspace said:

<snip>

Hello, off the bat, I think your idea is.... well, not good. BUT! I'm going to help anyway.

 

I assume this controller is for a pc? yes? well, I'm not really sure generic drivers support more than 2 joysticks. How would you even use 4? like that seems counter productive.

 

*shrugs* anyway, what I would do (since your joystick crazy) is build not a game controller, but a midi controller! here's why.

 

Midi has a bunch of turny twisty analog things, some folks even use this for full blown flight control.

Here's a link to get you started

 

Good *jumps forward in time* Now what do you do with your midi controller? great question, I don't know....

But, I'm sure you could find a midi to virtual joystick program.

Here's a link to get you started

 

Quote

I'm going to buy a drill

sweet!

 

As far as assembly and coding? you have a long arduous journey ahead of you. Start small and get it working, then scale up. Remember, asking specific questions will get you specific answers.

 

aloha

Link to comment
Share on other sites

Link to post
Share on other sites

I will get back to you later. but thanks! 

 

I have some arduino experience, and I'm not a programmer or anything. I culminated in using two joysticks to control a 3dof leg for a quadruped robot. I QUIT the project when I would have had to use the atan2 function to have smooth transitions across 0 degrees for the x,y,z of the other feet (I used a simply xyz for the foot, which had 3 axis of the joysticks control them, which calculated the servo positions, just like the popular "tote" project). ,,, since I didn't use atan2, and upon studying it a bit I didn't really get it and needed to go do more math or something first,,, I just switched to FPV drones as a hobby and dropped everything. later, I would be unable to afford the continuous flow of batteries it takes to fly FPV, and switch (very recently actually) to trying to buy a gaming computer and playing some games I always dreamed about.. but now the dang games dont' even exist, and neither does the required controller. 

 

what the heck is wrong with people!!! 

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

Basically heres my plan

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

I'll just leave this arduino HID library with gamepad support here https://github.com/NicoHood/HID... 

 

4 Joysticks sounds like a lot to keep track of in your brain. I'm drawing a blank on what kinds of games need 8 axes of analog control but okay. 

 

You'll need an arduino with a built in USB tranceiver on the chip, which limits your options a bit, but it makes the device act as a native USB gamepad. You'll need a board with either an ATMEGA 32u4, or a SAMD21. The latter is my favorite, but the 32u4 is more common and typically a bit cheaper. If this was my project, I think I would get an arduino pro-micro off ebay for $3. However, I just realized each of your 8 axes is going to need an analog input pin. Most arduino boards have around 5. There are two ways I know of to get around this: 1. i2c IO expander. The name says it all, you get more IO to your microcontroller using the i2c protocol to communicate the data between the chips. However, idk about analog support. The ones I saw on Adafruit appeared to be digital only, but you might be able to find an IC on Digikey or Mouser. 2. A larger board/chip that has the enough analog inputs broken out.

ASU

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Hackentosher said:

I'll just leave this arduino HID library with gamepad support here https://github.com/NicoHood/HID... 

 

4 Joysticks sounds like a lot to keep track of in your brain. I'm drawing a blank on what kinds of games need 8 axes of analog control but okay. 

 

You'll need an arduino with a built in USB tranceiver on the chip, which limits your options a bit, but it makes the device act as a native USB gamepad. You'll need a board with either an ATMEGA 32u4, or a SAMD21. The latter is my favorite, but the 32u4 is more common and typically a bit cheaper. If this was my project, I think I would get an arduino pro-micro off ebay for $3. However, I just realized each of your 8 axes is going to need an analog input pin. Most arduino boards have around 5. There are two ways I know of to get around this: 1. i2c IO expander. The name says it all, you get more IO to your microcontroller using the i2c protocol to communicate the data between the chips. However, idk about analog support. The ones I saw on Adafruit appeared to be digital only, but you might be able to find an IC on Digikey or Mouser. 2. A larger board/chip that has the enough analog inputs broken out.

 

I actually only need six, but two things, you're right, 8 is a lot to keep track of, therefore so is TWO per new finger. (so maybe I will only use one per finger at first),,, and secondly, well, if I'm going to put one stick for a pointer finger, I might as well put two, one for each finger, besides, I don't know how I will prefer to use them. 

 

as for the games, I am playing a few games that (either by default or with "flight assist off") allow for inertial "newtonian" thrust physics, and have 6 axis control. so, up-down left-right forward-reverse pitch yaw roll. 

 

I have a configuration where roll is on the triggers (which share the "z axis") and where forward reverse is on stick presses, with the remaining axis on the joysticks, but want all six on joysticks. 

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, Hackentosher said:

I'll just leave this arduino HID library with gamepad support here https://github.com/NicoHood/HID... 

 

<Snip>

I don't think the gamepad support for this would work for the op, unless he scales down to a 6 axis prototype.

 

"Gamepad (32 buttons, 4 16bit axis, 2 8bit axis, 2 D-Pads)"

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, KeyboardCowboy said:

I don't think the gamepad support for this would work for the op, unless he scales down to a 6 axis prototype.

 

"Gamepad (32 buttons, 4 16bit axis, 2 8bit axis, 2 D-Pads)"

Just above you, OP mentioned scaling back to 6 axes, so the hid library might work! Otherwise you'd have to do digital control instead of analog. 

ASU

Link to comment
Share on other sites

Link to post
Share on other sites

Here's another potential solution, vJoySerialFeeder.

All the data gets dumped over serial at whatever baud you want, then it gets interpreted by the pc. I highly recommend checking out the documentation for it. It uses vjoy for all the controly bits on the pc's end (virtual joystick), and its Arduino 'friendly?'.

 

I went ahead and ran a test just to see if it would work, and it totally dose, really well too.

Spoiler

image.png.0d24ef5a977f3bcaea9bf836342f2253.png

joy2key recognizes the virtual stick and allows for further control, I'm sure its supported by other mapping software too.

 

@Hackentosher is right, your going to be limited by your controllers analog inputs. Something like this should help.

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks all so far. Vjoy runs my fpv transmitter , so its not completely alien to me. 

 

I have a pro nano v3, with 8 analog inputs, and 14 digital inputs. I definately need two triggers per side, and a 4 button xyab on right thumb, but have to then choose between the remaining 4 buttons left, and stick presses. Basically, I think that the thumb presses are the easier ones, meaning i will axe trigger stick press first, thumb press second. ... but i can probably keep the thumb presses to make 14 digital buttons since thats all i will need to connect to. 

 

Heres more pics of the layout. Wiring is be careful, but programming might take forever..... 

20190819_182059.jpg

20190819_182029.jpg

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

I finally wired it up. Its using a nano v3, which has 8 analog reads, and i will need ALL digital pins, but wont be able to hook up the stick presses for the trigger finger sticks. This is my choice for buttons to ignore simply because those stick presses are the hardest to use,, with the thumb presses i already have some hand contact with the bottom of the controller, while the top of the controller I only touch on the sticks and buttons, so its hard to press the trigger stick press without ALSO accidentally pressing the thumb sticks. Luckily, i doubt I will ever miss the buttons, there still are two trigger buttons. 

20190825_131902.jpg

20190825_131908.jpg

15667754150578052383121049832032.jpg

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

oof. 

 

I can make a nice serial monitor showing my sticks and buttons,,, but I CANT figure out how to make the ibus protocol... 

 

also, it looks like the dev for the vjoyfeeder is basically the whole source of knowledge, so my project might hinge on him personally.... 

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, tsmspace said:

oof. 

 

I can make a nice serial monitor showing my sticks and buttons,,, but I CANT figure out how to make the ibus protocol... 

 

also, it looks like the dev for the vjoyfeeder is basically the whole source of knowledge, so my project might hinge on him personally.... 

 

Link to comment
Share on other sites

Link to post
Share on other sites

well,, i figured it out, and it works in starmade,,, instead of trying to write my own sketch, I just followed the instructions and modified his. I don't know how to use his dang library, and my sketch just wouldn't work,,, so I used his and debugged where I had zeros instead of any particular amount of buttons, and I'm up and running. I will post a video once it uploads,, 

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

well,, i figured it out, and it works in starmade,,, instead of trying to write my own sketch, I just followed the instructions and modified his. I don't know how to use his dang library, and my sketch just wouldn't work,,, so I used his and debugged where I had zeros instead of any particular amount of buttons, and I'm up and running. I will post a video once it uploads,, 

 

https://www.youtube.com/watch?v=1f3HPvzStDg

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, tsmspace said:

well,, i figured it out, and it works in starmade,,, instead of trying to write my own sketch, I just followed the instructions and modified his. I don't know how to use his dang library, and my sketch just wouldn't work,,, so I used his and debugged where I had zeros instead of any particular amount of buttons, and I'm up and running. I will post a video once it uploads,, 

 

https://www.youtube.com/watch?v=1f3HPvzStDg

Dude, that's the shit! Awesome project! I'm glad you decided to show it off.

Link to comment
Share on other sites

Link to post
Share on other sites

On 8/25/2019 at 11:56 PM, JoeSixPack said:

Dude, that's the shit! Awesome project! I'm glad you decided to show it off.

thanks so much!

 

i5 12400 , MSI b660 pro-a, 32g 3200 , rtx 3060, 1tb wdblack sn270

 

I gave my dad: rogstrix b350-f gaming, r5 2600, corsair vengeance 16gb ddr4 2400, gtx 980 ti , he has minecraft, halo infinite, and collects his own photography. he had a "worst laptop in store special" that finishes loading your mouse movement, but not really much else. 

 

games: Starmade, Velocidrone, Minecraft, Astrokill, Liftoff, ThrustandShoot, , Infinity Battlescape, Flight of Nova, Orbital Racer

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×