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.
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.
Question
How can Rpi GPIO toggle the HMDI selection button?
Short Answer
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.
Long Answer
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! :)
Update 2019jun22hkt2023
My cheapy US$7 HDMI splitter actually IR remote control
HDMI Switch 3 Port Video Splitter 3 In 1 Out IR Remote Control - US$7
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.
References
Raspberry Pi Zero Universal Remote Instructable – bbtinkerer, instructables 2018
AliExpress Universal TV Remote Control US$2.34
TSAL6200e IR LED Datasheet – Vishay
TSOP38238 IR Receiver – Vishay
HobbyElectronics HX1838 Infrared Remote Control Module and Receiver - £5.4
TaoBao HX1838 Infrared Remote Control Module and Receiver - ¥2
Appendices
Appendix A - Rpi GPIO controlled IR Universal Remote
Appendix B - HDMI selector button connection
Update 2019jul08hkt2114
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.
I am building v2 of an HDMI switcher controlled by a Pi. I work in manufacturing and I needed an emergency/assistance response system. So here we are, I have a pi wired to buttons placed at various locations around the plant. So for instance if someone needed assistance in a certain area of the warehouse they press the button and it displays out on TV's located in high traffic areas the building. I am currently using a Pi to do two things, 1)change the input on the HDMI switcher 2)display out an image based on the GPIO pin that received the signal.
I have found 3 ways to do this:
Wire the NC button to ground, when pressed it sends a momentary grounding signal to the HDMI switcher. That works great, but it does not accomplish the second goal, changing the image displayed by the Pi. So the button has to have a second NC input wired to +, this can be connected to the GPIO pin. So the button is doing both tasks.
Wire the NC button to +24, use the signal from the button to activate a NC relay to -, Attach the relay to the switcher button, this will change the input. But the button still has to be attached to a second +24 for the GPIO pin to change the image.
Wire the button to +24 and use a 3v optocoupler relay to reduce the 24v to 3v on the GPIO pin. Set an output on the pi to a second optocoupler relay to send the grounding signal to the switcher when it detects a signal on any GPIO pin. (this is my new method that I am currently building)
Let me know what you think or if you would like me to explain further on parts used for the build! Good luck and have fun!
** I am using an 8 port HDMI splitter to send the output of the switcher over multiple displays. There is also an "all-clear" button that will change the HDMI switcher to a channel that displays upcoming events and other company stuff. This is controlled using a PC attached to the HDMI switcher, so when the emergency button is selected it displays the emergency image, when the all clear is pressed it displays the company information channel.