Arduino-controlled HDMI Switch

30,548

34

34

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.

Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Beauty Tips Contest

      Beauty Tips Contest

    34 Discussions

    0
    None
    jasond297

    2 months 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?

    6 replies
    0
    None
    dr_philjasond297

    Reply 2 months 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

    0
    None
    jasond297dr_phil

    Reply 2 months 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!

    0
    None
    dr_philjasond297

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

    0
    None
    jasond297dr_phil

    Reply 5 weeks ago

    OK I worked it out. I didnt do too much hacking. I cheated a bit and ordered another hdmi switch. So let me describe what I did because i didnt take pics. I removed the power diode from the far right input like you did on my 3 input hdmi switch. I soldered 2 wires from those tabs and added the diode back inline with one of those wires. That controls whether or not the hdmi signal from my game consoles flows through when it is connected. But i didnt want the TV just on with a game or no signal input, so i got another automatic 2 input hdmi switch. So when money is dropped into the timer circuit, it closes a relay which allows power to flow into the 3 port hdmi switch which passes the game signal into the 2 port autoswitch. This causes the 2 port autoswitch to detect the game signal and switch from the "INSERT MONEY" screen coming from my tablet hdmi signal to the video game signal. When the time runs out, the relay opens cutting power to the game signal and causes the 2 port hdmi signal to revert back to the "INSERT MONEY" video signal. This gives me the ability to have a coin operated hdmi with 2 inputs.
    If i get around to it, ill take pics for reference.
    0
    None
    dr_philjasond297

    Reply 27 days 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...

    0
    None
    jasond297dr_phil

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

    0
    None
    dr_philChrisSim23

    Answer 8 months 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

    0
    None
    EdwardF2005

    1 year ago

    Hi, for someone who is new to electronics could this be done with a Relay, as I am used to those?

    1 reply
    0
    None
    dr_philEdwardF2005

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

    0
    None
    sistemas_tgz

    2 years ago

    Excellent work, thank you for sharing.

    0
    None
    ece_jm

    3 years ago

    Hello,

    Thanks for sharing. May I ask how fast does switching goes? Can it do seamless switching?

    1 reply
    0
    None
    dr_philece_jm

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

    0
    None
    HugoW9

    3 years ago

    Hi thanks for sharing. Will you give some advice to switch between 2 hdmi signals repeatedly for 24 hrs using arduino to controll on same switcher

    1 reply
    0
    None
    dr_philHugoW9

    Reply 3 years ago

    Hi

    I reckon you could do this, with a little bit of detective work. These switches often have a little button on them which cycles through the input channels. I would guess that it pulls a line on the main switcher IC low (or high) on each press, and that tells the IC to change channels. I would speculate that it would be an easy matter to get your Arduino to supply the control signal in place of the button, but you'll need to do a bit of investigation yourself on an active switcher (and at your own risk, of course). I intended to do this on my TV timer via the Arduino, but it's not a pressing problem at the moment so has gone to the bottom of the in-tray. Please let me know if you had any success and if so, how you did it. Good luck...

    0
    None
    DavidG492

    3 years ago

    Hello thanks for sharing all this; i have question can u point me in the right direction; i want yo make and hdmi switcher but 12x1. 12 In 1 out. Its posible ? . Thanks for any help

    1 reply
    0
    None
    dr_philDavidG492

    Reply 3 years ago

    Dave

    Thanks for your interest. In principle I suppose you could buy several switchers and cascade them, but in practice I think you would have serious problems with signal degradation and auto-selection if passing through more than one switch.

    Rather than accepting what I say, you could always try it with two cascaded switches, which won't break the bank. If the signal is okay, it suggests that you could build a 9:1 from four 3:1 switches and a 12:1 from four 4:1 switches. If it works, please post, as it's not the first time I've been asked this.

    Cheers

    0
    None
    MandarH

    3 years ago

    Hi, i want to make a similar project in which i want to switch the HDMI input based on PIR Sensor output.

    Like I have an outdoor CCTV Camera which is first HDMI (actually converted from AV to HDMI) and Cable DTH which is second HDMI. So when as long as the PIR sensor senses human-motion, the first HDMI should be switched other wise the second. Earlier when I had an old TV & DTH, i used a DPTD relay to switch the 2 AV input cables from CCTV and DTH which was very easy. But now its HDMI, so cant use a relay. Any idea, how do i interface the PIR sensor output to the button on HDMI switcher. I mean I could use a relay for that micro-switch but is there a particular sequence in which the button should be pressed in your switcher?

    1 reply
    0
    None
    dr_philMandarH

    Reply 3 years ago

    Hi and thanks for looking.

    On both the switchers I have tried, the button just jumps through the active inputs (i.e. those which are connected to powered-up AV sources) in sequence. So in your case, each press of the button would toggle between the CCTV & DTH.

    I suggest you look at the board when it's powered up and see if one side of the switch is either permanently grounded or at 5 V. If the other side is floating until the switch is pushed, then you can probably connect this floating side to an arduino pin to simulate the pushing of the switch (by either setting LOW or HIGH temporarily). This is something I plan to do on my TV timer instructable at some stage (yet to be published but not far off), but I haven't needed it yet as I can still access the switch.

    The other problem you will have is to determine which channel is active. You might be able to connect an arduino pin to one of the switch channel indicator LEDs, then have a few lines of code which keep 'pressing' the switcher channel-change button until the LED lights (or goes out). In a two-channel system, this would be a means of knowing which channel is active.

    Sounds like an interesting project, anyway. Good luck with it...