Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Analog signal to a USB encoder?  (Read 1932 times)

0 Members and 1 Guest are viewing this topic.

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Analog signal to a USB encoder?
« 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!
« Last Edit: May 14, 2022, 10:36:28 am by mimregi »

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9399
  • Last login:Today at 08:58:46 am
  • Designated spam hunter
Re: Analog signal to a USB encoder?
« Reply #2 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.



For the Arduino sketch, you can use Baritonomarchetto's 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.


Scott
« Last Edit: May 14, 2022, 12:43:00 pm by PL1 »

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #3 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.

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #4 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/
« Last Edit: May 14, 2022, 06:21:01 pm by mimregi »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9399
  • Last login:Today at 08:58:46 am
  • Designated spam hunter
Re: Analog signal to a USB encoder?
« Reply #5 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/
Yes, they should work just fine.   ;D

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



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.
« Last Edit: May 16, 2022, 05:18:04 pm by PL1 »

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #6 on: May 14, 2022, 07:35:59 pm »
You’re awesome, thanks for the help!

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9399
  • Last login:Today at 08:58:46 am
  • Designated spam hunter
Re: Analog signal to a USB encoder?
« Reply #7 on: May 14, 2022, 07:39:20 pm »
Glad to assist.   :cheers:


Scott

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #8 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?

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9399
  • Last login:Today at 08:58:46 am
  • Designated spam hunter
Re: Analog signal to a USB encoder?
« Reply #9 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

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #10 on: May 15, 2022, 12:34:25 am »
You are officially my favorite person today. Thanks again!

StefanBurger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 67
  • Last login:April 09, 2024, 11:02:50 am
  • I want to build my own arcade controls!
Re: Analog signal to a USB encoder?
« Reply #11 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.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9399
  • Last login:Today at 08:58:46 am
  • Designated spam hunter
Re: Analog signal to a USB encoder?
« Reply #12 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

mimregi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:May 28, 2022, 12:50:43 pm
Re: Analog signal to a USB encoder?
« Reply #13 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:
    • Fight a (probably losing) battle against the arduino uno I happen to have
    • Use the USB encoder I have and either
      • Fight a (probably losing) battle to get the encoder to recognize an analog input OR
      • Live a whammy-bar-free existence (for now)
    • Buy the actual right board for this project
    [/list][/list]

    mimregi

    • Trade Count: (0)
    • Full Member
    • ***
    • Offline Offline
    • Posts: 10
    • Last login:May 28, 2022, 12:50:43 pm
    Re: Analog signal to a USB encoder?
    « Reply #14 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

    Wish me luck...

    mimregi

    • Trade Count: (0)
    • Full Member
    • ***
    • Offline Offline
    • Posts: 10
    • Last login:May 28, 2022, 12:50:43 pm
    Re: Analog signal to a USB encoder?
    « Reply #15 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.

    StefanBurger

    • Trade Count: (0)
    • Full Member
    • ***
    • Offline Offline
    • Posts: 67
    • Last login:April 09, 2024, 11:02:50 am
    • I want to build my own arcade controls!
    Re: Analog signal to a USB encoder?
    « Reply #16 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