Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: kgold0 on January 25, 2024, 12:18:35 pm

Title: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: kgold0 on January 25, 2024, 12:18:35 pm
Hello, I have an sj@jx switch/xbox/pc encoder with two 3D analog thumb sticks and also ordered an sj@jx analog joystick. I’ve already installed the thumb stick and want to install the analog joystick. I want to have the option of using either thumb stick or joystick. Either with a toggle to switch between the two inputs or ideally using either one at whim without toggle. The latter being much more complicated I think.

The 4-pin connection has 5v vcc, x, y, and gnd (I think). The x and y rest at 2.5V but on either extreme direction will register at 0V or 5V.  Just connecting the two together might cause unexpected results. Like if the thumb stick is at rest at 2.5V and the joystick is tilted to the right at 5V then the resulting voltage might be somewhere in between 2.5 and 5V.

Any suggestions please?  Thanks!
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: PL1 on January 25, 2024, 01:53:51 pm
I want to have the option of using either thumb stick or joystick. Either with a toggle to switch between the two inputs or ideally using either one at whim without toggle. The latter being much more complicated I think.
Do yourself a favor.  Don't waste your time trying to design an autoswitching circuit.   :banghead:   :banghead:   :banghead:

What you need is a DPDT (Double Pole, Double Throw) switch -- rocker or toggle.

Leave the 5v and ground (outer pins) on all four pots all of the time.
- This will draw twice as much current as a single stick, assuming the pots are the same resistance.  The analog encoder should be able to handle that, no problem.
- If you wanted to switch X, Y, 5v and ground, you'd need a 4PDT switch.

The part to connect to the DPDT switch is the wiper (center pin) of each pot.


Scott
EDIT: Don't forget to make sure you have the analog joystick oriented the same way as the thumbstick.
- You need to check both the X-axis and the Y-axis.
- If left on the thumbstick causes the X voltage to decrease, left on the larger stick should do the same.
- If down on the thumbstick causes the X voltage to decrease, down on the larger stick should do the same.
- If you've got the larger stick turned 90 degrees and you swapped the X- and Y-axis wires, one of the axes will move the opposite direction of the thumbstick. i.e. Up/down might be the same on both, but left/right is backward on one.
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: kgold0 on January 25, 2024, 10:39:57 pm
Thank you very much. That’s exactly what I was looking for.

So I was thinking of taking the four wires from each stick, taking the yellow and white wires (x,y) and connecting them to the dpdt switch, then connect the output to a 4-pin. Then take the remaining red and black from one joystick and also connecting them to the 4-pin.

Then I will take the other joy’s red and black and create a new 2-pin to plug into a separate 5V.

That sound right to you?

Hope I don’t blow something up!
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: PL1 on January 26, 2024, 02:38:06 am
So I was thinking of taking the four wires from each stick, taking the yellow and white wires (x,y) and connecting them to the dpdt switch, then connect the output to a 4-pin. Then take the remaining red and black from one joystick and also connecting them to the 4-pin.

Then I will take the other joy’s red and black and create a new 2-pin to plug into a separate 5V.

That sound right to you?
I'd recommend getting 5v and ground for both sticks from the encoder's analog connection pins.
- The 5v/ground from the analog connection pins is the same 5v/ground that goes to the A/D comparator so any variation at the sticks is also at the A/D comparator.

If you get 5v and ground for a stick from a different source, you may run into slight ripple or differences in voltage that can add jitter or throw off the alignment.

The second stick should only draw a few mA -- not enough to cause a problem.


Scott
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: kgold0 on January 26, 2024, 05:42:22 am
Wow I didn’t think of that. Is there an easy way to hook two wires into one jst pin other than soldering? I have been searching jst 1 to 2 or jst splitter but not sure I’m finding the right solutions. Is the jitter going to be really bad if the 5V port is from the same encoder, just not in the same 4-pin connection?

I actually ordered two dpdt switches so I guess I can just connect two vccs to one input and two grounds to the other input and just leave it on, at least temporarily.
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: PL1 on January 26, 2024, 07:43:07 am
Is there an easy way to hook two wires into one jst pin other than soldering?
One option is to cut/strip the middle of the wire and use euro-style terminals.  Try this if the approach below doesn't work.

Is the jitter going to be really bad if the 5V port is from the same encoder, just not in the same 4-pin connection?
Jitter isn't guaranteed, it's just something to watch for.

The further apart the power sources are and the longer the wires are, the more likely it will be that the wires will pass close enough to an electromagnetic source to pick up some RFI (Radio Frequency Interference) on the unshielded wires.

If your encoder has a 5v LED connector or is an active high device (the common outer input pins are tied to 5v instead of ground), that might be good enough.  You shouldn't have to cut/strip the analog stick harness to test this setup.  Try this first with some JST or Dupont jumpers if you have them.   ;D


Scott
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: kgold0 on January 26, 2024, 08:17:52 am
Thank you, will try a second 5V port which is close by on the same encoder first— this thumb stick has a huge dead zone (almost acts like a dpad— on my virtual pinball device the plunger is basically fully pulled down and then fully released— but with the analog joystick I can fully control the plunger- partially pull, partially release, etc).

By the way, sorry it takes so long for me to reply. I turn notifications on but I never seem to get them!
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: PL1 on January 30, 2024, 12:36:49 am
Here's my reply to the question you asked in a PM about whether these (https://www.amazon.com/BOJACK-RT1321-Toggle-Switch-125V/dp/B07ZX9JWBJ/) switches are good for this application.

(https://m.media-amazon.com/images/I/71kZM7pjPiL._AC_UY218_.jpg)

They would not be my first choice for this application because:

1. They are big heavy power switches rated for 15-20A.  A switch rated for less Amps like these (https://www.amazon.com/HiLetgo-Terminals-Position-Toggle-Switch/dp/B079JLZKLL/) or these (https://www.amazon.com/mxuteuk-Terminal-Position-Miniature-Dashboard/dp/B07QGBW6XZ/?th=1) might be a better choice since the analog encoder is only drawing a few mA.

BONUS ROUND: There are small 4PDT toggle switches here (https://www.amazon.com/mxuteuk-Terminal-Position-Miniature-Dashboard/dp/B07XMH174C/) if you want to switch X, Y, 5v, and ground.

2. They are high profile switches.  I prefer lower profile rocker switches like the one on the back of my KADESTICK (http://forum.arcadecontrols.com/index.php/topic,134781.0.html) build.  YMMV.

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

3. They might be hard to directly mount in a wood panel, if that's what you're trying to do.

There are several workarounds like drilling a hole in an arcade button plug like these (https://www.amazon.com/dp/B075ZPF6PT/) for a smaller toggle switch/rocker switch or do a custom 3d printed mount remixed from the mount here (http://forum.arcadecontrols.com/index.php/topic,165028.msg1740098.html#msg1740098) (Thingiverse post here (https://www.thingiverse.com/thing:4879472)) or one of the mount panels here (https://www.amazon.com/BACAUTOPARTS-Housing-Aluminum-Mounting-Waterproof/dp/B0B1CVKRDB/), here (https://www.amazon.com/Twidec-Housing-Aluminum-Universal-N-K-050-1K/dp/B0B8CQ8DFC/?th=1), or here (https://www.amazon.com/weideer-Housing-Anodized-Aluminium-K-M075-1K-LS/dp/B09FG9XCPB/?th=1) for some of the rectangular-body rocker switches or you could use something like this (https://www.amazon.com/Rocker-Switch-Sealed-Toggle-swblk61/dp/B07PJD9VV4/) DPDT switch/mount combo.

(https://m.media-amazon.com/images/I/51w3woDJ81L._AC_UY218_.jpg)

One other thing to look for is if the switch is ON-ON (2 positions) or ON-OFF-ON. (3 positions)  Either one will work, but the OFF position might make it confusing.


Scott
Title: Re: Combining two analog joystick4-pin outputs to one 4-pin input
Post by: kgold0 on January 30, 2024, 04:09:37 pm
Hey, thanks so much!

My puppy seems to be in agreement because he destroyed those switches I showed you last night- took them straight from the unopened mailer and chewed them up real good.