Announcement

Collapse
No announcement yet.

Cheapest, fastest DIY encoder for Windows, PS & XBox (Arduino pro micro ATMega32U4)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cheapest, fastest DIY encoder for Windows, PS & XBox (Arduino pro micro ATMega32U4)

    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 PS3 hexfile is here - PS3PadMicro_1ms.hex.zip
    The Xbox hexfile is here - XInputPadMicro_1ms.hex.zip

    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 (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
    Click image for larger version

Name:	pad-PS3PadMicro_1ms_ProMicro.jpg
Views:	1
Size:	215.7 KB
ID:	1914350


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

Name:	pad-XBOXPadMicro_1ms_ProMicro.jpg
Views:	1
Size:	217.2 KB
ID:	1914349

    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 D-pad, but the X-box D-pad inputs as the D-pad.

    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. You could always add a dab of solder to hold you 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
    Last edited by buttersoft; 11th November 2019, 03:56 PM.

  • #2
    This is awesome. I have a few lying around. When I get home I'll take a look.

    Sent from my HTC 2PZF1 using Aussie Arcade mobile app

    Comment


    • #3
      Having any luck [MENTION=17156]redferatu[/MENTION]?

      Comment


      • #4
        Out of the country, home soon

        Sent from my HTC 2PZF1 using Tapatalk

        Comment


        • #5
          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.

          Comment


          • #6

            Comment


            • #7
              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!

              Comment


              • #8
                It's great to hear someone's getting some use out of this, cheers for posting

                Originally posted by vibevibe View Post
                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.
                Last edited by buttersoft; 23rd December 2019, 09:59 AM.

                Comment


                • #9
                  I forgot about this sorry. I have a jpac and one of those tiny xin Chinese ones

                  Comment


                  • #10
                    I'd love to hear how you get on! As I noted in the video in the OP, you might need a DP button if you can't or don't want to link the ground planes. But i'd imagine that otherwise it wouldn't hurt.

                    Comment


                    • #11
                      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.

                      Comment


                      • #12
                        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.





                        Click image for larger version

Name:	pro-micro kade2.png
Views:	159
Size:	302.3 KB
ID:	2098161

                        Comment


                        • #13
                          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.

                          Comment

                          Users Viewing Topic: 0 members and 1 (guests)
                          Working...
                          X