Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: mimregi on May 14, 2022, 10:34:45 am

Title: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 10:34:45 am
I have what I believe is a relatively simple question.

TL;DR: I am trying to figure out which 3 pins on this usb encoder can be wired to a potentiometer for analog input (and if I need to jump any resistors… or something, I’m fairly novice at this part).

I am working with a reyann usb encoder (links below, sold as “Reyann Zero Delay Arcade USB Encoder Pc to Joystick for Mame Jamma & Other Pc Fighting Games”). It is advertised as supporting analog input and even has a “mode” switch (which windows recognizes- changes input detection from the analog stick to the top hat). Using 2 pins on the directional input is detect but only as binary.

I would like to add a potentiometer to a single axis on the encoder (context: building a guitar controller and need whammy- I could go arduino but I’m having fun trying to get this to work).

There’s an instructible that talks about doing this on a similar board, but it involves clipping resistors and I don’t have the same board (I believe I have soldered on resistors, if that’s even the correct terminology). 

Anyone done something like this?  Happy to provide more pics or experiment, will add some links in a reply. Thanks in advance!
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 10:51:07 am
Image of my encoder:
https://imgur.com/a/9nA1XLK (https://imgur.com/a/9nA1XLK)

Instructible I referenced:
https://www.instructables.com/Zero-Delay-USB-Encoder-True-Analog-Joystick-Modifi/ (https://www.instructables.com/Zero-Delay-USB-Encoder-True-Analog-Joystick-Modifi/)

Title: Re: Analog signal to a USB encoder?
Post by: PL1 on May 14, 2022, 12:27:01 pm
Q: Can I cut a board using a screwdriver?
A: Maaaaaybe, but it'll be a whole lot easier if I use a saw. (a.k.a. the right tool for the job)   ;)

An Arduino Pro Micro is inexpensive and has analog inputs.

Anything (and more) that you can do with a modded ZD encoder, you can do easier with a Pro Micro.

Wiring a potentiometer to a Pro Micro:
- Connect ground from one of the "Gnd" pins to tab 1 (or 3) of the pot.
- Connect 5v from the Vcc pin to tab 3 (or 1) of the pot.
- Connect input A0, A1, A2, or A3 (right, center, purple inputs) to tab 2 of the pot.
- If the axis is backward, swap the wires on tabs 1 and 3.

(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=149895.0;attach=360710;image)

For the Arduino sketch, you can use Baritonomarchetto's ArcadeHID-potentiometers.ino (https://github.com/baritonomarchetto/ArcadeHID/blob/main/ArcadeHID-potentiometers.ino) sketch that uses input A0 (see line 16 of the sketch) for the analog X-axis. (see line 11 of the sketch)
- Vee21 used the sketches on Baritonomarchetto's Github as the starting point for his custom driving cab encoder here (http://forum.arcadecontrols.com/index.php/topic,165806.msg1748386.html#msg1748386).


Scott
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 05:01:03 pm
lol excellent q&a. 10/10

Without question, that’s where I’ll likely end up for anything serious- this particular project is as much about the journey as the end state, so no argument with your logic.

That having been said… the board SAYS it is analog and is recognized by windows as the analog stick, it’s just binary in the input and I’m super curious if I can work around it.

For science.
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 06:18:43 pm
An Arduino Pro Micro is inexpensive and has analog inputs.

I happened to have two of these in the house, they wouldn’t work would they?

https://inventr.io/product/arduino-uno/ (https://inventr.io/product/arduino-uno/)
Title: Re: Analog signal to a USB encoder?
Post by: PL1 on May 14, 2022, 07:09:00 pm
An Arduino Pro Micro is inexpensive and has analog inputs.
I happened to have two of these in the house, they wouldn’t work would they?

https://inventr.io/product/arduino-uno/ (https://inventr.io/product/arduino-uno/)
Yes, they should work just fine.   ;D

There are six analog inputs (A0-A5) in the lower right side of the board.

(https://inventr.io/wp-content/uploads/2022/03/A000066_front-600x450-1.jpg)

The sketch I linked to earlier should work fine with this board.   :cheers:
- Wiring is the same, other than getting 5v from the "5v" pin on the Uno instead of "Vcc" on the Pro Micro.


Scott
EDIT: At best, the Uno board is difficult to turn into a USB HID device.  In many cases it is impossible.   :banghead:
Use a 32u4 board like the Pro Micro, Micro, or Leonardo instead.
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 07:35:59 pm
You’re awesome, thanks for the help!
Title: Re: Analog signal to a USB encoder?
Post by: PL1 on May 14, 2022, 07:39:20 pm
Glad to assist.   :cheers:


Scott
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 14, 2022, 09:50:46 pm
Sorry- no concerns about delay or anything?  Should be as responsive as this ZD hype I’ve bought into?
Title: Re: Analog signal to a USB encoder?
Post by: PL1 on May 14, 2022, 10:46:28 pm
ZD hype
The guys who pushed that hype may have also mentioned that Brawndo (The Thirst Mutilator) has what plants crave.  It's got electrolytes.   :duckhunt

If you discover lag with Baritonomarchetto's sketch on your Arduino, you'll be the first one I've heard mention it.


Scott
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 15, 2022, 12:34:25 am
You are officially my favorite person today. Thanks again!
Title: Re: Analog signal to a USB encoder?
Post by: StefanBurger on May 16, 2022, 05:56:52 am
additional thoughts on Arduinos:

not all Arduinos have the same mcu and therefore the same capabilites.

Arduino Uno for example uses an ATMEGA328p while the Arduino Pro Micro or Arduino Leonardo using ATMEGA32U4
One of the differences is, that the ATMEGA32U4 can be programmed to act like USB HID devices (keyboards, mouses, gamepads etc.)
With an ATMEGA32U4 you can provide your potentiometer value as mouse x-/y- axis or z-axis (scroll wheel). Also x-/y-axis of an anlog stick would be possible.
Thats not possible with ATMEGA328p devices.
Title: Re: Analog signal to a USB encoder?
Post by: PL1 on May 16, 2022, 05:28:37 pm
Thanks for the info, StefanBurger.   :cheers:

Looking into this further, it appears that some expert users have turned specific UNO boards with the 328P processor into a USB HID device, but the Uno has to have a 32u2 in the chipset and the program you use to do it is very unstable and hard to use.   :banghead:

It's much easier and way more reliable to stick with the Leonardo family of boards that use the 32u4 processor for this application.


Scott
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 16, 2022, 07:49:34 pm
additional thoughts on Arduinos:
...Thats not possible with ATMEGA328p devices.

OK, that makes some sense, I appreciate the extra info from you both- very helpful.

Leaving my current options:
[/list][/list]
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 16, 2022, 07:51:24 pm
Thanks for the info, StefanBurger.   :cheers:

Looking into this further, it appears that some expert users have turned specific UNO boards with the 328P processor into a USB HID device, but the Uno has to have a 32u2 in the chipset and the program you use to do it is very unstable and hard to use.   :banghead:

It's much easier and way more reliable to stick with the Leonardo family of boards that use the 32u4 processor for this application.


Scott

I'm going to try this:
https://sanjay900.github.io/guitar-configurator/guides/direct.html (https://sanjay900.github.io/guitar-configurator/guides/direct.html)

Wish me luck...
Title: Re: Analog signal to a USB encoder?
Post by: mimregi on May 16, 2022, 08:37:41 pm
An emotional roller coaster!  Having done a bit of research, Sanjay's guitar configurator handles a lot of what (I believe) you were identifying as challenges for UNO- hooray!

However, what I have is a custom version of the uno that has a different USB-to-Serial chip whose firmware cannot be updated (or at least not in the standard way, and maybe not at all...) and therefore can't tell windows to recognize it as a game controller.  Un-hooray =(

Which brings me back to my post above.  My preference is still to get the encoder I have to recognize an analog signal input, but I am back to the drawing board on that (possibly futile) task.

In any case, thanks again- if I do an arduino version of this project (which I likely will), I just learned a lot.
Title: Re: Analog signal to a USB encoder?
Post by: StefanBurger on May 17, 2022, 05:50:21 am
Thanks for the info, StefanBurger.   :cheers:

Looking into this further, it appears that some expert users have turned specific UNO boards with the 328P processor into a USB HID device, but the Uno has to have a 32u2 in the chipset and the program you use to do it is very unstable and hard to use.   :banghead:

It's much easier and way more reliable to stick with the Leonardo family of boards that use the 32u4 processor for this application.


Scott

hmmm, didn't know that the Uno has a 32u2 already on board. but I guess its still a pain in the back.
BR Sefan