Use an analogue switch with separate circuits

switches

I am planning on using 74HCT4066N analogue switch (datasheet) to trigger button presses on two separate gamepads at the same time. The circuit I plan looks something like this:

enter image description here

Can I use this analogue switch to control completely separate circuits? The problem, I suspect, is that these circuits each run off a separate ground, so I can't know what their voltage might end up being relative to the AA battery's ground. Is this a problem?

If I can't use this type of analogue switch for this purpose, then what should I be using to press both buttons at the same time?

Thanks,
Allen

EDIT:
Here is the circuit updated with DrFriedParts's suggestion of connecting the grounds… Please let me know if I got anything wrong here…

enter image description here

Best Answer

You need a common reference...

Your suspicion is correct, but you can fix it... just connect all the grounds together.

You may actually not need that complicated of a circuit. If you test the buttons in the controller(s), you will likely find that one side of the button-switch is already connected to ground. So all you have to do is short out the other side to ground and you are done.

Make sure that you are not driving the button when you do not intend to "press" it as this will create electrical contention and damage your output circuit.

In summary...

  1. Connect the three grounds.

  2. Determine if the controller buttons are grounded.

  3. Connect your analog switch (or microcontroller GPIO output through a big resistor) to the other side of the button.

  4. Ensure that you are switching from High-Z (GPIO in "input" mode) to Output Low (ground).