USB KVM Switch modify project

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

USB KVM Switch modify project

#1 Post by asuz » 05 May 2020, 23:55

1.jpeg
1.jpeg (2.85 MiB) Viewed 4447 times
Hi to all,
Recently I bought a USB KVM switch. That switch share my mouse and keyboard to the 4 PC. So I can use same keyboard and mouse with my windows pc, linux box, smart tv, etc.
You can see the circuit at the picture-3, KVM has only one selector button to choose PC's. KVM working principle is for example, if you press 3 times it brings the mouse and keyboard to the third PC port, if you press selector one more time it carries the mouse and keyboard to the fourth PC port. Whichever computer is active, it turns on its LED indicator.

I solder a remote relay to the PC selector button so I can change the PC's order by remotely. Here I need help or suggestions,
Is it possible to connect the pins of the 8266 to the LED's or some where else at the circuit to determine which PC is active?
I want to change the TV's inputs (HDMI1, HDMI2,HDMI3,HDMI4 )with the order of PC's.

For example, if I press 2 times to the selector (or by remote press) I want 8266 send IRSEND commands to the TV choose the HDMI2 (I can handle it with the IRSEND commands.).

I hope I could clearly explain what I wanted to do. Is there and suggestion?
Attachments
2.jpg
2.jpg (2.26 MiB) Viewed 4447 times
3.jpg
3.jpg (3.99 MiB) Viewed 4447 times

User avatar
grovkillen
Core team member
Posts: 3613
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: USB KVM Switch modify project

#2 Post by grovkillen » 06 May 2020, 04:23

Measure the voltage over the LED. You may need to have a voltage divider if the voltage is to high. Then use GPIO monitor to get which one is currently on.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#3 Post by asuz » 06 May 2020, 20:17

grovkillen wrote: 06 May 2020, 04:23 Measure the voltage over the LED. You may need to have a voltage divider if the voltage is to high. Then use GPIO monitor to get which one is currently on.
Can you give me a bit more detail please?

User avatar
grovkillen
Core team member
Posts: 3613
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: USB KVM Switch modify project

#4 Post by grovkillen » 06 May 2020, 21:03

We start with:

What voltage do you get when measuring between the two pins/legs of a lit LED?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#5 Post by asuz » 06 May 2020, 22:48

grovkillen wrote: 06 May 2020, 21:03 We start with:

What voltage do you get when measuring between the two pins/legs of a lit LED?
First led 1.34 V and the others are 2.42 V

TD-er
Core team member
Posts: 3166
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: USB KVM Switch modify project

#6 Post by TD-er » 07 May 2020, 00:25

You could add an optocoupler parallel to the existing LEDs (or replace them but then you don't have any visual feedback yourself)
The output of the optocoupler is a transistor, so you only need a pull-up resistor and then can connect one of the legs of the optocoupler to a GPIO pin and the other to GND.
Depends on what type of optocoupler you have, which pin to connect where.
For example one with a NPN transistor part:
Image

N.B. if you solder the optocoupler LED parallel to the existing LED (or replacing a LED) then you don't need the 1k resistor from the image.

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#7 Post by asuz » 07 May 2020, 15:09

TD-er wrote: 07 May 2020, 00:25 You could add an optocoupler parallel to the existing LEDs (or replace them but then you don't have any visual feedback yourself)
The output of the optocoupler is a transistor, so you only need a pull-up resistor and then can connect one of the legs of the optocoupler to a GPIO pin and the other to GND.
Depends on what type of optocoupler you have, which pin to connect where.
For example one with a NPN transistor part:
Image

N.B. if you solder the optocoupler LED parallel to the existing LED (or replacing a LED) then you don't need the 1k resistor from the image.



you mean like the primitive scheme I drew?
Attachments
yolla.jpg
yolla.jpg (89.89 KiB) Viewed 4320 times

TD-er
Core team member
Posts: 3166
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: USB KVM Switch modify project

#8 Post by TD-er » 07 May 2020, 20:33

Nope, as you can see, you connected the GPIO-5 to the 3v3 line.
If you connect the GPIO pin to the other side of the resistor then it is fine.
Just like this:

Code: Select all

3V3 ---^^^^----GPIO----transistor---GND
And check to see if you take the correct GPIO pin for this.
Better not take GPIO-0, GPIO-2 or GPIO-15 for this.
GPIO-4 & GPIO-5 are also used for I2C in most setups. but these are fine if you don't use I2C on this board.

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#9 Post by asuz » 07 May 2020, 20:50

TD-er wrote: 07 May 2020, 20:33 Nope, as you can see, you connected the GPIO-5 to the 3v3 line.
If you connect the GPIO pin to the other side of the resistor then it is fine.
Just like this:

Code: Select all

3V3 ---^^^^----GPIO----transistor---GND
And check to see if you take the correct GPIO pin for this.
Better not take GPIO-0, GPIO-2 or GPIO-15 for this.
GPIO-4 & GPIO-5 are also used for I2C in most setups. but these are fine if you don't use I2C on this board.

I just want to sure what you exact describe, is that schema OK? (later I will choose the suitable GPIO when building circuit)
By the way, is PC 817 opto suitable for this circuit?
Attachments
yolla1.jpg
yolla1.jpg (90.33 KiB) Viewed 4267 times

TD-er
Core team member
Posts: 3166
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: USB KVM Switch modify project

#10 Post by TD-er » 07 May 2020, 23:09

asuz wrote: 07 May 2020, 20:50 [..]
I just want to sure what you exact describe, is that schema OK? (later I will choose the suitable GPIO when building circuit)
By the way, is PC 817 opto suitable for this circuit?
Yep that optocoupler does seem suitable.
It is a NPN transistor, similar to the one in your circuit.

The only thing you need to look into is the color of the LED in the optocoupler and the one used on the unit you're adding it to.
Each LED color determines the voltage drop over that LED.
For example, a red LED has a voltage drop of roughly 1.8V (a bit depending on the brand/model and the amount of current flowing through it)
All other LED colors have a higher voltage drop.

So if you place a red LED parallel to a blue one, then the blue LED will not light anymore because the red LED will limit the voltage over it to 1.8V

The LED in the optocoupler you mentioned has a rather low forward voltage of 1.2V.
So first try to measure the voltage over the existing LED when it is lit.
This determines the value of the extra resistor you may need to place in series with the LED in the optocoupler before placing them (resistor + LED optocoupler) parallel to the existing LED.

By the way, I do see extra solder pads between the USB connectors for extra LEDs. Can you measure if those are extra LEDs or maybe the same signal of the existing LEDs?

If it is near impossible to get the original LEDs to light up along with the LEDs in the optocoupler, then you can also add LEDs at the transistor end of the optocoupler so you have feedback your optocoupler is also working well. (don't forget to adjust the resistor for the LEDs)

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#11 Post by asuz » 16 May 2020, 19:01

Thanks for that magnificent idea, I will built a circuit soon and type the result here.

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#12 Post by asuz » 16 Sep 2020, 15:49

TD-er wrote: 07 May 2020, 23:09
asuz wrote: 07 May 2020, 20:50 [..]
I just want to sure what you exact describe, is that schema OK? (later I will choose the suitable GPIO when building circuit)
By the way, is PC 817 opto suitable for this circuit?
Yep that optocoupler does seem suitable.
It is a NPN transistor, similar to the one in your circuit.
..............................

If it is near impossible to get the original LEDs to light up along with the LEDs in the optocoupler, then you can also add LEDs at the transistor end of the optocoupler so you have feedback your optocoupler is also working well. (don't forget to adjust the resistor for the LEDs)
After a long time, I had time to revive my old project. I already have an esp 8266 lolin with ESP_Easy_mega_20200913_minimal_IRext_ESP8266_4M1M. An ir receiver and ir transmitter connected it. I decided to change my project as like as at the diagram. I want to control the PC Selector Push button with ESP. Here is scenery, if the selector is at the PC 4 section and if i press second key of the remote controller, ESP ir receiver detect the command and activate the PC Selector Push GPIO's opto 2 times and choose PC 2 section. The scenery is continue similiar with other PC options too.
I hope I could clearly explain what I wanted to do. Can you check the GPIO connections and my logic of the scenery?
Attachments
kwm.jpg
kwm.jpg (142.97 KiB) Viewed 602 times

TD-er
Core team member
Posts: 3166
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: USB KVM Switch modify project

#13 Post by TD-er » 16 Sep 2020, 17:00

The logic is flawed as it connects all transistors on the optocouplers together and their GPIO pins too.
You should use a pull-up resistor per transistor.
Also I guess it is wise to add a resistor in series with the transistor too, to make sure the GPIO pin is not drawing too much current if it by accident is set to high output and the transistor tries to short it to GND.

Also the pins GPIO-2 and -0 must be high at boot, or else the node will not boot if one of those 2 pins will be high during boot of the ESP.

GPIO-0 is connected to the IR receiver, so you don't have any influence on its state at boot (also the pin is pulled high, make sure that will work on your receiver)

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#14 Post by asuz » 16 Sep 2020, 17:37

TD-er wrote: 16 Sep 2020, 17:00 The logic is flawed as it connects all transistors on the optocouplers together and their GPIO pins too.
You should use a pull-up resistor per transistor.
Also I guess it is wise to add a resistor in series with the transistor too, to make sure the GPIO pin is not drawing too much current if it by accident is set to high output and the transistor tries to short it to GND.

Also the pins GPIO-2 and -0 must be high at boot, or else the node will not boot if one of those 2 pins will be high during boot of the ESP.

GPIO-0 is connected to the IR receiver, so you don't have any influence on its state at boot (also the pin is pulled high, make sure that will work on your receiver)
What about that schema? Is it OK or need to edit? By the way, i cannot activate the opto's input site with or without resistor. I measure first LED 2V,second 2.5V,third 2.5V,fourth 2.5V but i think current is not enough both activate KVM led and opto's input side together. I am about to give up that project :(
Attachments
kwm1.jpg
kwm1.jpg (145.93 KiB) Viewed 534 times

TD-er
Core team member
Posts: 3166
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: USB KVM Switch modify project

#15 Post by TD-er » 18 Sep 2020, 10:27

If you replace the current LEDs on the unit with the LEDs of the optocoupler, you don't need extra resistors.
N.B. the same applies when you set the optocoupler LEDs parallel.

There is however a big BUT here...
Can you measure the voltage drop over the LED in the optocoupler?
If this is a higher voltage drop compared to the LEDs in the original circuit, then you have to replace the original LEDs with the optocoupler.
Simpley said, with 2 LEDs parallel, only the one with the lowest voltage drop will light up.
Only if their voltage drop is very similar, one LED will light up more bright than the other, but they will light up either way.

But then you need to take into account the optocoupler is not as "digital" as you may expect.
When the LED in an optocoupler is lit too dim, it will not open the transistor completely and thus it may hardly change the output voltage, depending on the used pull-up resistor.

Also make sure the LED in your optocoupler is in the correct orientation.
After all it is a diode, so it will conduct current only in 1 direction.

asuz
Normal user
Posts: 76
Joined: 31 Oct 2018, 18:22

Re: USB KVM Switch modify project

#16 Post by asuz » 18 Sep 2020, 12:22

TD-er wrote: 18 Sep 2020, 10:27 If you replace the current LEDs on the unit with the LEDs of the optocoupler, you don't need extra resistors.
N.B. the same applies when you set the optocoupler LEDs parallel.

There is however a big BUT here...
Can you measure the voltage drop over the LED in the optocoupler?
If this is a higher voltage drop compared to the LEDs in the original circuit, then you have to replace the original LEDs with the optocoupler.
Simpley said, with 2 LEDs parallel, only the one with the lowest voltage drop will light up.
Only if their voltage drop is very similar, one LED will light up more bright than the other, but they will light up either way.

But then you need to take into account the optocoupler is not as "digital" as you may expect.
When the LED in an optocoupler is lit too dim, it will not open the transistor completely and thus it may hardly change the output voltage, depending on the used pull-up resistor.

Also make sure the LED in your optocoupler is in the correct orientation.
After all it is a diode, so it will conduct current only in 1 direction.
Thank you for all suggestions, when I replace one of led with opto, KVM didnot activate the output of the opto, it is very strange. I work too much about it and take lots of time but no succeed. I give up, better to buy new one with 4 real button. That will be easy to hack.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests