The low end KVM are similar to the old one I have. It has a pair of PS/2 connectors for Mouse and Keyboard and a VGA input for each port. VGA is pretty much absent on main stream PC.
Sadly the ones with more modern day interfaces cost a bit too much for me. I think can build one cheaper leveraging consumer grade HDMI switch.
I have previously opened up a $5 3-to-1 HDMI switch. The HDMI switch is implemented with AZHW37 HDMI mux that is controlled by logic level signals controlled with a 8-pin microcontroller to handle the buttons and selection LED. This has just enough smarts inside for the video switching in a basic KVM.
Details: HDMI Switch Reverse Engineering.
HDMI switch datasheet: http://www.amazingic.com/english/01_products/AZHW37
The physically mapping on PCB is in blue.
PS/2 devices are not hot pluggable, so a KVM emulates a pair of PS/2 mouse/keyboards for each of the computers. It pass through key strokes, mouse events and commands. It also has to remember the LED states of the keyboard/mouse so that it can restore the states switching between different computers.
Unlike PS/2, USB is designed to be hot pluggable. i.e. The KVM (Hub Based) connects/disconnects the USB port for each time it switches. The OS level support simplifies the design a lot. Windows even saves the LED states of keyboard and restores it upon reconnecting.
USB 1.X Switching - The easy way
If you want to switch USB 1.X signals, you can probably get by with a 74HC4052 (Dual 4:1 Analog MUX). The 74HC4052 covers all the logical combinations, so it is a matter of taking advantage of that to match up with the HDMI switch and discarding the combination not covered by the HDMI.
The connections on the 74HC4052 would probably look like this. S1, S2 are fed from the HDMI switch.
Most of the commodity keyboard/mouse are USB 1.X devices, so this is probably good enough.
You do have to make sure that the USB HUB you are using is only USB 1.x (i.e. 1.5 or 12Mbps) as the MUX is not rated for USB 2.0. USB unlikely Ethernet doesn't falls back gracefully if the signal quality is bad. You just have to shop for the cheapest $2 hubs from China which are still USB 1.1.
When not to switch
You have to be careful not to switch while inside BIOS/UEFI/OS Installation as the software side may have small primitive USB stacks that cannot handle the hot plugging. Switching mass storage devices without letting the OS knowing will likely results in files or file system level corruption.
I have decided to try to make a USB 2.0 switch. If used carefully I can attach a USB memory stick or other devices to the hub.
There are proper USB 2.0 MUX out there e.g. On Semi NCN9252. It is a fine pitched (0.4mm) DFN parts targeted for skinny consumer electronic devices. Their pin placements doesn't exactly make sense without a multilayer PCB, but I have to work with what is available.
As an alternative, one could possibly make a USB 2.0 MUX out of 3 DTDP relays. Short pieces of twist pair from CAT5/6 could be used to wire things together. CAT5/6 have 100 ohms impedance which is within the USB specs.
They have decided to use a different combination for selecting the channels than the HDMI switch. There are a couple of ways to connect the control pins to the USB MUX.
- Invert one of the logic signals e.g. S1 from HDMI and relabel the ports
- A Dual 4 to 1 MUX (e.g. 74HC153) can be used as a pair of 4 entries lookup table.
- Use a $0.24 microcontroller to remap the ports. This is what this project is using along with hotkey support.
I have thrown together a breakout PCB that I am going to order because of the tight tolerances and the high speed signals. There are some additional requirements that I haven't sorted out yet, so those are going to be on a separate PCB with a modular approach.
I use 3 schottky diodes as Or'ing diodes to provide power for the USB hub. The diodes prevent power from leaking...Read more »