HDMI 5 port switch detecting LED with Arduino

Thread Starter

StealthRT

Joined Mar 20, 2009
274
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):


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?

Example:
Code:
    (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?
 

OhmsOutlaw

Joined Sep 4, 2015
8
Also, you don'e need the current sensing module. If the resistors are of different value, all you need to do is add a shunt R to GND at the analog input of the arduino. This will create a voltage divider so every R will create a different potential at the Analog input and you'll know which HDMI port is on. You may also consider adding a diode after each R so that the current does not flow back into the HDMI switch and create internal problems there.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
274

OhmsOutlaw

Joined Sep 4, 2015
8
Would it be possible for you to draw a schematic of that?
Here you go:
upload_2015-9-4_14-7-51.png

Basic code logic:
Set control to 000
check input from MUX - if high HDMI 1 is on
else set control to 001 (check channel 2)
...
check all LED channels this way, if any are "high" the channel is on.
NOTE: make sure you use the same GND for all devices.
 

OhmsOutlaw

Joined Sep 4, 2015
8
Sure, you can use that one. There are plenty of options. I would just get the breakout board from SparkFun. It has more channels than you need but just GND them and you're done. The wiring will be pretty much the same either way.
 

crutschow

Joined Mar 14, 2008
30,102
You might also be able to use a CD4532 8-input priority encoder.
It generates a 3-bit binary word indicating which of its 8 inputs is at a logic high.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
274
Ok how about if I used 5 4N25 chips to detect the led being on or off?


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?
 

OhmsOutlaw

Joined Sep 4, 2015
8
Hi, you can also use an optocoupler if you wish. Your schematic is incorrect though. You should connect Arduino input to pin 5 and have a pull up resistor (~10k) connect between that same input and 3.3V. Pin 4 should connect to Arduino GND. Your signal will be active low, meaning that when the LED is activated your Arduino input will be pulled to GND. If you still plan to use the MUX you should connect the inputs to the positive pin of the LED.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
274
Hi, you can also use an optocoupler if you wish. Your schematic is incorrect though. You should connect Arduino input to pin 5 and have a pull up resistor (~10k) connect between that same input and 3.3V. Pin 4 should connect to Arduino GND. Your signal will be active low, meaning that when the LED is activated your Arduino input will be pulled to GND. If you still plan to use the MUX you should connect the inputs to the positive pin of the LED.
Do you think you can draw that out for me?
 

OhmsOutlaw

Joined Sep 4, 2015
8
Unfortunately I do not have time for this. Why don't you read through my comment again and draw what you think I meant and I will guide you from there.
 
Top