I've been reading about how to use the GPIO to toggle a button on a thing I've taken apart.
It's like this: Amazon
I watched a video of a guy using an opto-coupler, what are the basics here? I'm kind of new to circuitry.
How can Rpi GPIO toggle the HMDI selection button?
Yes, if your HDMI selector button is connected to a pull down resistor, and pressing the button pulls input signal at resistor to ground, releasing button pulls resistor to 5V.
What you need to do is to extract two wires from the button contacts, one is 5V logic input signal, the other wire is ground.
Since Rpi GPIO logic level is 3V3, so you need to use a level converter, such as the 2N2222 transistor pull up circuit, to pull Rpi GPIO 3V3 signal to 5V, then input to the HDMI button selector input. You can read more details of the wiring in the long answer below.
Suppose you have 3 Rpi's and you wish to select which Rpi to display on the one and only one HDMI monitor, using Rpi GPIO pin to "press" the button, instead of using the human hand to press the button. To do this you need to:
open the box,
find the two contact points of the button,
check the nature of the switch,
if it is a mechanical switch, you can use a cheap Rpi GPIO controlled 5V relay to do the switching. So you can now do both manual and Rpi software select.
I have such a switch, with 5V power input. That means the button controls a 5V high low signal. This is a bit complicated. If the button is a "pull up" type, then you can use one GPIO pin, step up 3V3 logical signal to 5V, and connect to the button pull up resistor contact point, and that is it.
WARNING: mess around things at your own risk: I don't guarantee your HDMI mon will not explode! :)
My cheapy US$7 HDMI splitter actually IR remote control
So I think it is much safer and easier to DIY a Rpi GPIO IR remote controller, than to mess around with the electronic button circuit.
Appendix A - Rpi GPIO controlled IR Universal Remote
Appendix B - HDMI selector button connection
Appendix C - IR Modules
1) substitute a relay for the button press - that way you don't need to worry about voltages, common grounds, pull ups, or pull downs. Eg https://www.instructables.com/id/Control-Any-Remote-From-a-Raspberry-Pi-and-Amazon-/ 2) Or find an HDMI switcher with a computer input, for example the ATEN HDMI switcher has an RS232 input.
The button on the HDMI switcher you're using is a toggle which cycles round the inputs. unless you also read back the LED to know which one is selected, you're likely to miss a keypress, get out of synch, and not know which input you have switched to.