Hey all I am wanting to make a project for this HDMI 5 port switch I have. I want to be able, with an Arduino, to detect which of the 5 ports are being used (only 1 can be used at any given time).

Without buying 5 of something like this to detect current (which would be ~$30): enter image description here

Would it be possible for me to just purchase one of these and hook up different resistors values to each of the 5 LEDs and use the Arduino's Analog input to detect the voltage to determine which port LED was on?

I'm thinking that the standard red led voltage is around 2.0v? And the Android analog input is 5v. If this is possible then what type of values for the resisters for each of the 5 LEDs would be best to use in order to read the difference enough for each with the Arduino's analog input?


(com Gnd)-------------|
(led1)---/\/\/----\   |   |----------------|
(led2)---/\/\/-----\  |---|[-]         [vcc]-->to Arduino 5v Pin
(led3)---/\/\/------|-----|[+]         [out]-->to Arduino Analog Pin
(led4)---/\/\/-----/      |            [gnd]-->to Arduino Gnd Pin
(led5)---/\/\/----/       |----------------|

Or would this be possible without even using the current sensing module?


Ok how about if I used a 4N25 chip?

enter image description here

One of the LEDs would hook to Pin 1(+) and Pin 2(-). Pin 5 would house a voltage of ~3vdc from a power supply. Pin 4 would be hooked up to the arduino's Analog Pin 0.

So when the LED on the 5 port switch is powered on, it causes the ~3vdc power from the power supply to flow to the arduino where it's read as a voltage value.

Does this seem correct?

  • \$\begingroup\$ You'd probably do better finding an HDMI switch with machine interface like RS-232 (such as this one: warcom.com.au/…). \$\endgroup\$ – Calrion Sep 4 '15 at 6:23
  • \$\begingroup\$ Using an optocoupler to interface to an Arduino: yes, sure that can work but you need to add a resistor. The inputs of an Arduino (in this case A0) are very high-impedance, so if the LED in the 4n25 is OFF, A0 will not be zero, it will be floating (BAD!). You can solve this by adding a 10k ohm resistor between A0 and ground of the Arduino. \$\endgroup\$ – Bimpelrekkie Oct 1 '15 at 6:02

The problem with current sensing is that you have to "divert" the current through your current sensor. It should be possible to get working but I think there's a much easier solution ! If the 5-port HDMI switch is anything like the one I have, which is this one then there will be 5 LEDs in it connected like (please excuse me for only drawing 3 LEDs, you can imagine the other 2 ;-) :


simulate this circuit – Schematic created using CircuitLab

If you connect the ground connection of the HDMI switch and also the 5 V supply (there's a connector for this supply !) then you can detect the LEDs switching on and off by monitoring the voltage on D1, D2 and D3. Such a line will be pulled to ground (0V) when the LED needs to be on.

It is possible that the circuit is implemented "upside down" so that the LED's have the ground rail common instead of supply. But also then, you can just detect the output voltages the same way.

  • \$\begingroup\$ I was trying to simplify the circuitry and that's why i wanted to see if i could just use different value resistors on each LED line to determine which led was on depending on the voltage that was coming back from the switch's LEDs. \$\endgroup\$ – StealthRT Sep 4 '15 at 14:15
  • \$\begingroup\$ Please check my OP for an updated question. \$\endgroup\$ – StealthRT Oct 1 '15 at 1:00

Another thing that could work for you is to attach the the CEC bus on a free HDMI port somewhere. Switching the active source is announced on the bus, and it is always possible to ask the other devices which one is active.

  • \$\begingroup\$ Please check my OP for an updated question. \$\endgroup\$ – StealthRT Oct 1 '15 at 1:00
  • \$\begingroup\$ @StealthRT, I still think that politely asking on the CEC bus is by far the easiest approach, as it will not require changing the existing switch, it only requires a single pin on the Arduino, can be connected to any HDMI device, and can handle multiple switches in series (TVs typically also include a small switch). Extended my answer with a link. \$\endgroup\$ – Simon Richter Oct 1 '15 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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