HDMI 5 port switch detecting LED with Arduino

Discussion in 'The Projects Forum' started by StealthRT, Sep 4, 2015.

  1. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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):
    [​IMG]

    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 (Text):
    1.  
    2.     (com Gnd)-------------|
    3.     (led1)---/\/\/----\   |   |----------------|
    4.     (led2)---/\/\/-----\  |---|[-]         [vcc]-->to Arduino 5v Pin
    5.     (led3)---/\/\/------|-----|[+]         [out]-->to Arduino Analog Pin
    6.     (led4)---/\/\/-----/      |            [gnd]-->to Arduino Gnd Pin
    7.     (led5)---/\/\/----/       |----------------|
    8.  
    Or would this be possible without even using the current sensing module?
     
  2. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
  3. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
    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.
     
  4. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
  5. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
    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.
     
  6. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
  7. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
    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.
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    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.
     
  9. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    So i do hook up the MUX to the positive side of the LED, right?
     
  10. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Ok how about if I used 5 4N25 chips to detect the led being on or off?
    [​IMG]

    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?
     
  11. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
    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.
     
  12. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    I could never get the MUX working so thats why I have gone this other route.
     
  13. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Do you think you can draw that out for me?
     
  14. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Please?
     
  15. OhmsOutlaw

    New Member

    Sep 4, 2015
    8
    1
    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.
     
  16. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    I got it working a few days ago thanks.
     
Loading...