Jump to content
Due to a large amount of spamers, accounts will now have to be approved by the Admins so please be patient. ×
IGNORED

Cheapest, fastest DIY joystick encoder for Windows, PS & XBox (Rpi Pico GP2040)


Recommended Posts

EDIT: My pick is now the GP2040 encoder by FeralAI. Releases are on the RHS of that page. All you need is a Raspberry Pi Pico ($6-$10) and a micro USB cable. (KF128 Terminal blocks are handy too). Probably the fastest joystick encoder out there, works on PS3/PC/Switch (and probably 360, but not sure). Has lots of options including a web interface through which you can configure buttons as you want them. I've switched to this one myself and i'm loving it.

 

There;s also the Daemonbite encoder too, a 1ms encoder based on the Arduino pro micro. Using the test method below shows it to be about as fast as the 1ms mod to Bootsectors firmware. It programs using Arduino Suite directly, which is easier, though i haven't tried modding it. It is missing the POV input on windows, and probably won't work on consoles at all. But otherwise highly recommended. His other projects include pro-micro-based USB adapters for S/NES and megadrive controllers to PC and MiSTer, which are definitely worth checking out. (note that you may need to change #define DEBOUNCE 0 to #define DEBOUNCE 1 in the code if you're getting multiple-button-press issues)

 

I've added a mod of the 1ms XInputmicro firmware that matches the Daemonbite button layout to the downloads in post #20 - that way you can simply program your stick with the Daemonbite firmware using the official Arduino suite, and then program it back using the method described below - you can switch back and forth without needing to alter any wiring (noting that you do need to follow Daemonbite's button numbering, not the ones in the pic below)

 

EDIT: I've noticed an issue with the 1ms PS3 firmware when also using Boomslang's FFB plugin for driving games on the same PC. Some FFB driving games will crash randomly. And i think the encoder was also blocking some video codecs. Use the Daemonbite firmware instead and you should be fine.

 

 

 

With Bootsector's help i have modified his awesome PS3PadMicro firmware and XInputPadMicro (Xbox360) firmware to use 1ms polling rates, making them faster. You can program these from Windows onto an A$4.20 Arduino Pro Micro, or anything Arduino-like as long as it has that same ATMega32U4 5V 16MHz chip. Programming them is easy via a USB cable as per instructions below. Either pad can be used in Windows, or on relevant consoles. Interestingly enough this encoder, which was written by Bootsector in C, is also faster than a four-key keyboard firmware programmed in Arduino Suite - so, only a four pin-check loop for minimal overhead, and the 1ms pad firmware is still faster.

 

Programming the encoder - the Hexfiles

The PS3 1ms hexfile and Xbox 1ms hexfile are in the one archive, attached to this post. These are compiled C code, so you cannot use Arduino Suite to program them. You need a program like ArduinoSketchUploader by the helpful TwinEarth .

 

To program your Arduino pro micro or other ATMega32U4 device:

  • Download the above files, and unzip into a directory - let's call it “E:\games\mydirâ€� for our example.
  • Hit windows start button and type "cmd" (without the quotes, of course!) then hit enter
  • Type "E:" and hit enter, type "CD games\mydir" and hit enter.
  • Connect your Arduino via USB, then type, but do not hit enter! "ArduinoSketchUploader.exe --file=PS3PadMicro_1ms.hex --model=leonardo" (the leonardo is another, more expensive ATMega32U4 board, but its bootloader is the same)
  • Connect the RST pin to GND for a moment (it's near the top of the picture below, on the right side) then hit enter on the commandline you typed in.
  • Once it says completed, unplug your device, plug back in and give it ten seconds, go to Windows control panel > devices and printers and you should find the KADE - Kick Ass Dynamic Encoder is shown.
  • To program for Xbox, simply change the filename. Your encoder should show up as a regular Xbox360 controller.

 

Pinouts

The pinout below shows the pro micro programmed for PS3/Windows. Another ATMega32U4 board will use the same pin designations (D0, E6, C6, etc, not the 1, 2, 3, 4, you can sometimes find. PS Home button is Start+Select

pad-PS3PadMicro_1ms_ProMicro.jpg.c3aa801ee07535ab3d7535b382999497.jpg

 

 

Next is the Xbox360 pinout, and this one also works on Windows. As before, a different ATMega32U4 board will use the same pin designations.

pad-XBOXPadMicro_1ms_ProMicro.jpg.ea167642404ed8ce821082507712261e.jpg

 

Troubleshooting:

If the board isn't showing up in windows, you probably haven't programmed it right. And if you're having trouble programming, try connecting the reset pin to ground multiple times, including while you're trying to program, especially if ArduinoSketchUploader keeps saying it's looking for a particular rate or particular port. If you’re desperate, google the Sparkfun Pro Micro and find out how to program an example file through the regular Arduino suite. Then try programming the pad firmware once more, in the method originally described above.

 

Windows will see the PS3 analog inputs as the controller D-pad, and vice versa, but sees the X-box D-pad inputs as the D-pad and analog as analog. Try things out before committing to a build, because some games are going to be picky about using one or the other.

 

Testing:

I use the Zero Delay Encoders everywhere, and I wanted to see how bad they really were. Interestingly, Bootsector's unmodified PS3PadMicro firmware is about the same speed as them - it uses a 10ms polling rate (100Hz). The default XinputPadMicro firmware runs at 4ms (250Hz) and was instantly much faster. But changing the polling rate of either firmware to 1ms (1000Hz) makes things faster still. I admit I'm not actually sure what rate either one is now polling at, but both are as fast as each other, and either one will win out vs the default micro firmwares by about the expected margin using the methods shown in the video below. The video itself shows the default 4ms XinputPadMicro firmware vs a stock Zero Delay Encoder.

 

 

So, would anyone want to send me some other encoders to test? I don't really have anything else to test, but i'd love to try a USB Ipac or Akishop PS360+ and see if they really are faster 🙂

 

Caveats

  • I make no claim this updated firmware is actually polling at 1ms, let alone responding that fast. It is requesting that it be polled that fast, however. Further testing would be needed to rank it against any encoder not mentioned here. And that’s before you get to the windows USB stack and other potential sources of input lag.
  • I don’t own a PS4, or an Xbox of any stripe. For the love of all that’s holy, buy the right Arduino device and test it first, before you commit to an entire cabinet or stick build.
  • The pro micro uses a micro USB connector, and lets face it those are a bit shit. They tear off the pro micro if you're rough with them. You could always add a dab of solder to hold your cable in place. Or go for something like a Teensy 2.0, which has a mini USB instead, although it costs A$10 and you’ll need the software to program it.
  • I make no claim to be good at Tekken 7 😄

 

Human reaction time is about 100ms at best, aren't you kidding yourself here?

No, i'm not, and you shouldn't either. Watch the video. Tekken 7 is capped and locked to 60FPS. This makes each frame duration 16.6667ms. It's about getting your input in one frame ahead. Let’s say your opponent whiffs unexpectedly, and his move has an 18-frame recovery. My jab punish has a 10-frame startup, so I have 7 frames + controller lag in which to press the input. The difference between 113ms and 123ms is rather large, in this instance. If your controller takes 10ms to respond, and mine takes 1ms, I'm going to have an advantage. You might not care, but most of the FGC does 🙂

Edited by buttersoft
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hey, this is pretty great. I've been playing around with a PS3PadMicro arduino, but this is even better.

Would you be able to share how you upped the polling rate, or show what you changed? Having a dedicated home button and custom pinouts is really great, and I'd love to be able to give that a try.

Link to comment
Share on other sites

I believe I installed the firmware correctly, but for some reason when I hooked up my arcade stick / buttons to it each input registers all the buttons at once. I’m using 1 daisy chained ground but I will recheck my wiring and try to reinstall the ps3padmicro firmware to see if that fixes it.
Link to comment
Share on other sites

I redid all my wiring and got it working! Wow I can honestly say I feel a difference from the zero delay pcb, my combos on mvc2 can be executed with more precision. I tried it on PS3 and on Dreamcast via a Brook PS3 -> Dreamcast Adapter and it works great, I just needed to use the left analog for wiring it up as the d-pad inputs didn’t work.

 

Thank you buttersoft!

Imgur: The magic of the Internet

Link to comment
Share on other sites

It's great to hear someone's getting some use out of this, cheers for posting :)

 

I tried it on PS3 and on Dreamcast via a Brook PS3 -> Dreamcast Adapter and it works great, I just needed to use the left analog for wiring it up as the d-pad inputs didn’t work.

 

Yes, it's a pain but you have to check which input works on every device, the pad or the left-stick. Glad to hear you got it working though.

 

@zooper

https://github.com/bootsector/XInput...riptors.c#L116

https://github.com/bootsector/PS3Pad...riptors.c#L196

 

Those links will take you directly to the original descriptors.c file on github for each of the relevant firmwares. The line for polling rate will be highlighted - it's the last part of each link, if you look. The values are in ms. Bruno the project creator sent me the info when i asked about polling rates. If you go back a level and open the main.c file for each, you can see the button assignments. For PS a pin assignment might look something like "pad_square = !bit_check(PIND, 3);" which is obviously pointing pin D3 from the picture above to the square button. These can be changed around if desired. You could also do things like target a different type of processor rather than the ATmega32U4. Once you change the C files though, you will need tom compile the firmware. To do this you dump that whole directory from Github, the one with main.c and descriptors.c and all the other files at that level. After that you install the AVR toolchain, which is a bit of a process by itself, then you simply open a gitbash in the directory and type "make" at the prompt. If you've done everything right you end up with about six compiled files, one of which is the hexfile you want in this case.

Edited by buttersoft
Link to comment
Share on other sites

Thanks a bunch for the tips, I'd been using a modified arduino software before but the added pins using the AVR toolchain really get some mileage. If it's any use I also found out you can reclaim a couple more pins by removing the leds and using their pads from here. I hope it's useful, I'd like to contribute back anyway.

I've yet to test it but I've got a version with a dedicated home and turbo button, I'll upload the source and compiled files when I finish/get to testing it. I've optimized it by removing the analog stick polling because I'm only using the d-pad, so I think it should run just as fast.

As a side note I did a short test to see if I can use this on a PS2, because using homebrew on it you can use a ds3/ds4 for control, but it doesn't seem compatible. It was a long shot seeing as it only generally seems to support official controllers but it's worth knowing that for reference.

  • Like 1
Link to comment
Share on other sites

Zooper thank you for that information!

 

I think I am going to try to do the KADE miniArcade 2.0 beta with the Arduino Pro Micro.

I'll have it go to an RJ45 port to be able to have a stick that is compatible with Dreamcast, PS3, PC, OG Xbox, PSX/PS2, GC, and N64 via RJ45 / USB depending on the console!

 

All I would need to do is remove those 2 resistors to be able to use the RJ45 capability and free up enough inputs to map a 6 button arcade stick + start, select, and home.

 

 

 

 

 

2124985851_pro-microkade2.png.49151a179c8c00863b93ecb8d8a623ec.png

Link to comment
Share on other sites

  • 2 months later...

So I had trouble getting the modification to work on the pro micro, but I am awaiting to test it out on a teensy 2.0

 

In other news, the buttersoft 1ms arduino mod is about as fast as the 1ms MC Cthulhu, but slower than a ps360+. I wonder what can be done to make it as fast as a ps360+ as that Encoder uses the same 32u4 chip.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
Just a bump noting that the prices of the Pro Micro are going up. I can't get anything for less than $7AUD now, and the Teensy 2.0 is only ~$10, though you'd have to make sure you had the right bootloader and pinouts for it :)
Link to comment
Share on other sites

Do you know if either the Xbox or Playstation firmwares would be compatible with an Android device? Currently building a joystick for my nephew that has an android based arcade machine that has some USB ports which I'm hoping will take a joypad...
  • Like 1
Link to comment
Share on other sites

@buttersoft - just tried to download the .hex files and the link doesn't seem to work, it loops back to the AussieArcade homepage. Any chance you can try re-uploading? Thanks :)

 

Hi. Same here. Would be very grateful if you can dig the files out for us :)

Link to comment
Share on other sites

It's been a while, but I think there are three likely reasons:

  • I don't know the xbox controller at all well.
  • PL1's graphic had them there and i thought it must have been for a reason.
  • The order in which Windows sees the buttons. As in i wanted button 1-10 not 1-6, 9,10, 13, 14 or something.

I'm hoping it's the last, but TBH i'm not sure.

 

Loving the '21 avatar, btw :) Welcome to the forums and don't be a stranger!

Link to comment
Share on other sites

OK so I think I found what I'm looking for here - http://forum.arcadecontrols.com/index.php/topic,152687.msg1674092.html#msg1674092

Seems like the ideal config button-wise, haven't looked into pin layout but seems at first glance to be a better config by removing the analogue thumbsticks and using those available pins for triggers. Is there any chance you might be able to do your polling rate mod to that version please?

Link to comment
Share on other sites

That's a compiled hex, so no, it can't be easily modified :(

 

Also, if you are going to use the pad on windows, I would recommend keeping both the D-pad and the left analog stick available as you never know what a game will want to use. This is not always a huge problem tho, and you could always reprogram the pro-micro later. Just make sure to connect to the pins via a header you can swap around.

 

Now, on to the next problem. The main.c file describes the following inputs for the Xbox pad firmware:

pad_up, pad_down, pad_left, pad_right, pad_y, pad_b, pad_x, pad_a, pad_black,

pad_white, pad_start, pad_select, pad_l3, pad_r3, pad_l, pad_r, pad_left_analog_x,

pad_left_analog_y, pad_right_analog_x, pad_right_analog_y;

 

So which ones do you want to use? I'm not familiar with the xbox pad save from this project, and I have no idea what is what when it comes to bumpers/shoulders/triggers.I don't really have the ability to jump in and modify those or add to those, either.

 

If you grab the files off github and edit the main.c file in wordpad to reflect the button config you want, you can then adjust the polling rate in the descriptors.c file and compile it yourself :) All the info is on, or linked-to on, the first page of this thread.

 

If that falls into the too-hard-for-now basket, unpack the attached main.rar file and open main.c with wordpad. Go to the line "// Pins polling and gamepad status updates" and look just below that for the button assignments. Make a post on here clearly stating the button assignments you want, using the input names in the file and above, in that same format so i can cut-and-paste the changes, and I will compile the code for you.

main.rar

Edited by buttersoft
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...