Cheap HDMI Switcher with ESPHome

Cheap HDMI switcher just arrived in mailbag… time to make it smarter and wi-fi enabled? #esphome #esp8266

First demo video here… let’s try to disassemble!

1 Like

Where in the video do you disassemble it?

Here it is… i noticed a not mounted power jack (now it powers from input hdmi) and also a CR1 component, which looks like a infrared.

Maybe the easiest way to control is to use IR but the code is unknown to me… some suggestions?

A more detailed image of the board:

I have an HDMI switch/extractor with EDID setting to get surround sounds to the sound bar. Just wanted to let you know, that if you go with the IR solution, be prepared that those signals might be also common among other IR devices. In my case, my cheap LED strips are reacting to the IR signals used by my switch and my mobile AC unit… :crazy_face:

1 Like

Emulating the switch with an esp (probably plus relay) should be easy [1], and detecting state should be easy by using an optocoupler across each LED.

[1] depending how easy it is to unsolder the current switch and solder wires in its place.

as you can see there is already the place for a IR receiver on the board, but it’s not mounted.
If i know the frequency or code the uC is waiting it would be a piece of cake, but googling the uC model get me no results.

So i was thinking about adding custom IR and an arduino board or ESP

yes all pins seem exposed over the silkscreen!
I was thinking about adding custom IR and an arduino board or ESP and control button with a CD4066 digital switch and optocoupers for LEDs… i don’t know if it’s necessary due to they don’t change automatically… but maybe to be in sync with manual control yes…

With an ESP i’ll need an external power supply for sure… which i don’t like… but arduino will give me only IR control mode… today dilemma :rofl:

old topic, but I did something like that for a “KVM” USB switcher. Just used a D1 Mini on ESPHome. One of the pins detects with of the 2 outputs is selected (found a pin that outputs LOW or HIGH depending on the selected output) and an output pin is connected to a transistor which closes the switcher’s button contacts, emulating a button press.

I don’t have any pictures of it here, but here’s the ESPHome code:

esphome:
  name: usb-switcher

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Usb-Switcher Fallback Hotspot"
    password: !secret wifi_password

captive_portal:

# Connected to the hardware button
output:
  - platform: gpio
    pin: D6
    inverted: false
    id: output1
        
switch:
  - platform: output
    name: "USB Hub Button"
    output: 'output1'
    restore_mode: ALWAYS_OFF

# Input select A/B
binary_sensor:
  - platform: gpio
    id: input1
    filters:
      - delayed_on: 10ms
    pin:
      number: D2
      mode:
        input: true
        pullup: false
        
# 0 - PC
# 1 - Mac

select:
  - platform: template
    name: "USB Hub Mode"
    update_interval: 2s
    options:
      - PC
      - Mac
    set_action:
      lambda: !lambda |-
        if (id(input1).state) {
          // output is on Mac
          if (x == "PC") {
            id(output1).turn_on();
            delay(300);
            id(output1).turn_off();
          }
        } else {
          if (x == "Mac") {
            id(output1).turn_on();
            delay(300);
            id(output1).turn_off();
          }
        }
    lambda: !lambda |-
      if (id(input1).state) {
        std::string mode = "Mac";
        return mode;
      } else {
        std::string mode = "PC";
        return mode;
      }
1 Like

Amazing idea!

PS: it’s not old… i have still the pcb in a corner of my desk :slight_smile:

1 Like

Did you get anywhere with this?
I’m looking for a similar solution.

My LG 4K TV has 2x HDMI inputs and the 2nd is CEC which runs my Sonos System. Would love a smart HDMI switcher for my 1st input.

Could you tell me which octocoupler to take? I’ve tried searching on aliexpress but there are so many and I don’t know which one is the right one.

omg this is what i need, but never ends the post :frowning:

Would love to see this happen. Currently I am using a switchbot bot to press the button. Not very fancy looking and the wait time to press the button is between 1-4 seconds.