Introduction: Arduino-controlled HDMI Switch
This instructable will show you how to control multiple HDMI feeds to your TV using a microcontroller such as an Arduino to enable and disable transmission with a single control line.
My ultimate goal is to have a robust but flexible means to limit the amount of time that kids can spend in front of the TV, without getting into arguments at turn-off time. Time-limiting applications exist for PCs, but at the time of writing there was virtually nothing out there for TVs in the UK. In the US it's possible to buy things intended for this very job, but as far as I know these only suit US plugs and voltages or they control only composite video etc.
I had it in mind to build an Arduino-based controller with a real-time clock module to provide the timer functionality. The hard bit was how to switch the TV on and off robustly but safely. So I set about considering the options:
1) control the mains power to the TV - very effective but I worry about adversely affecting the TV in the long term and it involves using mains relays etc.
2) control using IR remote protocols - nice idea but power is almost always a toggle I think, and there's no way for a remote device to know the state of the TV, so in practice I don't think this would work.
3) control by switching the HDMI feeds from the various input devices (we don't use direct RF input to the TV anymore) - this could work but HDMI is a fast signal which needs to be routed and switched carefully - you can't just use a few transistors on a protoboard!
I considered options 1 & 2 to be non-starters. Option 3 seemed like the best way to go, except for the problem of how to carry out the switching. Enter the automatic HDMI combiner and switch which can be bought for less than £5 from numerous traders (via Ebay, for example).
I rapidly determined how to modify this very simply so that a 0-5 V TTL signal would control whether it transmitted or blocked HDMI signals. The modification doesn't impair the manual or automatic channel selection within the device.
The modification is very simple provided you are comfortable with Arduino interfacing and basic soldering. It requires the following:
Cheap 3-to-1 automatic HDMI switcher of the type shown above (can easily be obtained via Ebay, for example). It may be possible to use others provided that they function in the same way. UPDATE - see my other instructable for an alternative HDMI switcher which works in the same way and which I found to perform better with some of my AV sources.
Basic electronics tools
Soldering iron
1K resistor
2N2907 PNP transistor
Hot-melt glue gun
Hook-up wire (e.g. 7/0.2)
I will describe only the HDMI switcher modification in the following pages. It's really simple. I have assumed that people undertaking this modification have 'normal skill in the art' and therefore haven't included circuit diagrams or photos of every single stage in the process. The Arduino controller part I leave to the reader for now as it's likely to be tailored to their individual needs. My plan is that the would-be viewers would have RFID passes to let them 'log in' to access their TV minutes, which are shown ticking down on a seven segment display. UPDATE - this work has now been published in another of my Instructables.
Disclaimer: this modification worked for me and didn't seem to harm any of the attached AV hardware, but I can't guarantee its suitability for the application so obviously if you carry it out then it is at your own risk.
Step 1: Remove the Power Supply Diodes From the Switcher PCB
Remove the four screws from the underside of the switcher enclosure.
Pry the two halves of the case apart and remove the circuit board.
Identify the three surface mount diodes D1 to D3, whose locations are marked in red on the figure. These diodes route a +5 VDC supply from incoming HDMI leads onto the board power supply section; the board derives its power from these leads.
Remove the diodes (one is shown marked in green) using a soldering iron to pry them from the board. This effectively disables the board as the switcher IC can't obtain external power. Note that the photo for this step was taken AFTER the diodes had been removed.
The modified circuit board can now be enabled externally by providing an external +5 VDC supply to the power supply section on the board. The +5 VDC should go to the cathode pad of D3 and the supply ground should go to the ground pad near the output HDMI lead (marked GND on the board if you look hard enough). These are marked in blue on the figure.
This is the essence of this hack - control the power to the board and you control whether HDMI is transmitted or not. The manual / automatic switching of individual inputs is retained following this modification.
Step 2: Install a Transistor Switch on the Switcher PCB
The Arduino can't source enough current from a single pin to drive the HDMI switcher board. Its 5 VDC supply rail can source approximately 400 mA however. So the next step is to install a high-side PNP transistor switch to allow the Arduino to control the board from its own power supply via a digital output.
I used a 2N2907 PNP transistor. This was mounted dead-bug style on the switcher circuit board using hot-melt glue. In the figure the rounded side of the transistor faces the outer edge of the board. It's important to keep all the additional components / wires low down on the board so that the enclosure cover will fit back on afterwards.
A black lead was used to connect the Arduino ground to the ground pad on the switcher board.
A red lead was used to connect the PNP's emitter to the Arduino's 5 VDC pin.
An orange lead was used to connect a digital output on the Arduino to the base of the PNP, via a 1 kOhm resistor. I used pin 13 as it's connected to the LED and blink makes a good test sketch. This orange lead is the control line for the high-side switch.
The PNP's collector was connected to the D3 cathode pad on the switcher board.
Hot-melt glue was used liberally to ensure that all the leads and components were secure and that no shorts could occur between the resistor, transistor and the switcher board.
I filed some small grooves in the side of the enclosure to allow the wires to pass through. Provided that the dead-bug installation has been done carefully, the enclosure cover should fit back on without any problems.
Step 3: Conclusion
Okay - that's pretty much it. As it's a PNP high-side switch, HDMI transmission is asserted by setting the control line LOW (0 V). Setting the control line HIGH (+5 V) disables the switcher and thus prevents display of any HDMI signals. Don't worry though - if your resourceful urchins unplug the power supply to the Arduino, they'll lose the all-important 400 mA 5 V rail which will completely inhibit HDMI transmission.
Obviously to use this switcher as a means to control access to a TV, you need to enclose it in a hard-to-open box which encloses the controller, switcher and the plugs of all the HDMI input leads, with holes for the input leads small enough to prevent them from being pulled out and plugged directly into the TV. I intend to mount everything (switcher, controller, display etc.) into a single attractive enclosure that can go next to the TV.
It goes without saying that this will be effective only if your TV is being used as an HDMI monitor. If you leave an RF lead plugged into the TV then that will still be available. In the UK it seems to be increasingly common to use a PVR to take the RF input and provide the TV signal over HDMI, so all you need to do is remove the RF input cable from the TV and hide it or alternatively remove all the channel tuning, to prevent your kids bypassing your controls.
I hope someone finds this information useful. Good luck with building the controller - when I've finished mine I shall update this post.
40 Comments
1 year ago
Please put the image. Where to connect on arduino
Reply 1 year ago
Hi. Step 2 describes how to connect the switch to the Arduino. There are lots of different types of Arduino, but I think the most common ones (e.g. Uno / Nano) all have one or more ground (GND) pins, one or more +5 VDC pins and a digital pin which is attached to the on-board LED. On the Unos this is pin 13. These should all be clearly labelled round the edges of the board. Alternatively there are numerous images available on line which will show you the position of these pins. Note that you don't have to use pin 13 - any digital pin will do.
Reply 1 year ago
OK. Thanks
4 years ago on Step 2
is it possible to choose the hdmi input signal by selecting which diode is connected which would allow power to pass through?
Reply 4 years ago
Hi. I don't think your suggestion would work. The diodes simply seem to take power from the input leads and use it to drive the switching circuitry. That's why you have to remove them so you can provide an external on/off control. They don't appear to play any role in which channel is active.
If you wanted to set to a given channel (and you are using a microcontroller to do the work), you could just pulse the button signal (it probably pulls some control line LOW) and monitor the indicator LED lines until the one you want is HIGH.
Cheers
Reply 4 years ago
I've been doing a lot of reading of other mods, datasheets, pictures of boards and whatever else I can find. I was able to find the pinout for some hdmi switcher ICs. There are selector pins that control which input is active. Although the cheap switch I ordered doesn't have a pinout I can find anywhere and I don't think they are all standard. I planned on cutting the trace to those pins and soldering in a connection to a coin operated timer relay that I have to control the logic going to them. If u go to weavefuture.com, they sell a model hdmi switch for that purpose. The guy told me I had to buy his timer because the firmware only works with his. I call BS, because I know how most coin op timers are connected and they don't share any logic/data connections. He's probably controlling it the same way I mentioned.
Reply 2 years ago
I am the same experience with the gentleman from weavefuture.com, I ended up building my own setup to control a game system at a buddy's shop. The problem I have is the HDMI switching. Could you provide a bit of information so that I can replicate the HDMI switching from an Arduino?
Reply 4 years ago
i ordered a c2g 3 port hdmi switch. I contacted them and got the chip controlling it so i could look up the datasheet. it shows that when you place one or both of the SEL pins High, you can control which port is on the output. I plan on using a time controlled relay to control which port I want active. Hopefully it works!
Reply 4 years ago
Hi again! That weavefurniture website is really interesting and particularly the HDMI switch. Nothing new under the sun eh? I notice they use four leads rather than three as in my scheme, which perhaps suggests a higher level of control. Your investigations so far have been very thorough and I guess the switch you finally bought was probably much more expensive given the tech support you've managed to obtain. The line of enquiry is really interesting though and it would be valuable to see whether it's applicable to the cheap switches (if someone has the time to look!) Good work and please publish your findings...
Reply 4 years ago
If i get around to it, ill take pics for reference.
Reply 4 years ago
Sounds really good! Nice idea to use two switches in order to get each one to deliver a specific function. Hopefully they are cheap enough!
I found that the HDMI switches from Ebay occasionally corrupted the HDMI signal slightly, so that PC video signals ended up being displayed incorrectly on my screen after passing through it. I suspect it comes down to the sort of display one uses and the quality of the HDMI switch. Something to watch out for anyway...
2 years ago
Very useful, thanks a lot !
I'm trying to build something similar, but I have no knowledge of electronics (I'm just a software developer). My need is a little simpler: to be able to change the HDMI switch channel from a raspberry or an arduino.
Wouldn't it be easier to control a switch with a wired infrared receiver? we could then replace the infrared receiver with a female / female TR or TRS jack cable, plugged into the switch and the development board? Could the development board then emit the signal equivalent to that of a button on the infrared remote control?
Reply 2 years ago
Hi ximulf - glad you found it interesting. Given that your requirement is slightly different, your approach should probably be different too. If you look at my other instructable (kids screen-timer with arduino) I describe a different HDMI switch. This actually came with an IR remote for changing channels I think, so you could make something work, although the last time I looked the LIRC package for the RPi was broken!
The hard-wired remote method you suggest seems rather ingenious and is probably simpler to implement (once you've found the right signal lines) as you would just command the channel you wanted and probably don't even need to check you've done it. It would be interesting to see if you can get it to work - getting the signal levels right at the receive end might be a challenge.
I hope this helps...
Question 4 years ago on Introduction
Hi, do you know if I can buy one of these such hdmi switches anywhere? Thanks
Answer 4 years ago
Hi - yes! A five-second search on ebay for "hdmi switch 3" reveals several hits on the first page. Whilst I can't guarantee that the internals are identical, these units are so cheap that it's worth a punt IMHO. Even if the circuit board is different, the approach outline in this instructable may well still be valid - you might just need to do a bit of tracing on the PCB.
Cheers
5 years ago
Hi, for someone who is new to electronics could this be done with a Relay, as I am used to those?
Reply 5 years ago
Hi Edward - you could probably substitute the high-side PNP transistor switch with a relay, if you wanted a conceptually simpler circuit (albeit with an extra wire). The transistor method really is easy though (even I could manage it...!). I don't know how the current draw would compare between a transistor and a relay coil, however, but suspect that the relay will be more power-hungry.
Good luck.
6 years ago
Excellent work, thank you for sharing.
7 years ago
Hello,
Thanks for sharing. May I ask how fast does switching goes? Can it do seamless switching?
Reply 7 years ago
Hi. When you say 'switching' do you mean on & off or flicking between input channels using the 'select' button? The latter is relatively quick I think, but the former is rather slow. I suppose this is because the hack actually powers up the switcher from cold. It takes the TV on the output a while (a second or two) to realise that an HDMI signal has arrived.
I can't imagine either would be regarded as 'seamless'. I expect you probably have to spend much more money on a switch to get that. The switcher described is very cheap so perhaps you should just see if it meets your needs.