1

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.

4
  • 2
    Are you asking for advice on how to control the button, or on how to use an opto-coupler? Have you tried Google for the latter? What did you find and what did it leave unanswered?
    – Mark Smith
    Commented Jun 22, 2019 at 6:51
  • Ah, this is neat. 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 (1) open the box, (2) find the two contact points of the button, (3) check the nature of the switch, (4) if it is a mechanical switch, you can use a cheapy Rpi GPIO controlled 5V relay to do the switching. So you can now do both manual and Rpi software select. (5). /to continue, ...
    – tlfong01
    Commented Jun 22, 2019 at 8:45
  • (5) I have such a switch, with 5V power inputt. 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 things at your own risk: I don't guarantee your HDMI mon will not explode! :) PS1 - If the button circuit is not pull up type, but sort of push/pull type, then sorry I can't help, because my broken English can't do. PS2- I am only guessing. I have NOT tried it myself!
    – tlfong01
    Commented Jun 22, 2019 at 9:01
  • Thank you all for your answers and edits! Much appreciated. Will read through when I get the time. Commented Jun 22, 2019 at 18:07

3 Answers 3

2

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.

hdmi selector

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:

  1. open the box,

  2. find the two contact points of the button,

  3. check the nature of the switch,

  4. 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.

  5. 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.

hdmi switch

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

hdmi switch

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

HBS838 IR Receiver Module

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

rpi ir remote

Appendix B - HDMI selector button connection

button schematic

Update 2019jul08hkt2114

Appendix C - IR Modules

  1. 5V IR Encoder/Decoder NEC Code transceiver receiver

  2. IR Remote Control Kit HX1838 Remote

  3. Smart Robot B&W Line Tracing IR Blocking

  4. IR Anti Collision Module

  5. Two Channel IR Transmitter

  6. IR Remote Control Tool (NEC) 25th March 2015

  7. IR Remote Control Receiver 3rd April 2015

  8. NEC Protocol

  9. LIRC

  10. Rpi IR Receiver and RaspBMC Media Centre - Pi Hut

  11. Building Serial Port IR Receivers [Using 38kHz Vishay TSOP 1838 ] - lirc.org

  12. Building Serial Port IR Transmitters - lirc.org

  13. Infrared Shield for Raspberry Pi by LinkSprite

  14. Tutorial of Infrared Shield for Raspberry Pi by LinkSprite 2014apr29

3
  • Thank you for the detailed answer I will ask some questions when I get the time!! Commented Jun 22, 2019 at 18:08
  • Do you wire the GPIO to the IR remote controller, or would you use an IR reader to read what it is sending and replicate it? That solution sounds much better and would also allow actual control of 1 2 or 3 instead of toggling between. Commented Jun 22, 2019 at 21:04
  • @Quinn Finney, I have added a reference section with universal remote.stuff. You might like to skim through them to get a rough idea of how things work. The first reference uses RpiZero to DIY a remote is OK for newbies.
    – tlfong01
    Commented Jun 23, 2019 at 1:28
1

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.

0

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:

  1. 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.

  2. 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.

  3. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.