Close
0%
0%

Low Cost KVM Switch

This is a KVM switch built from cheap HDMI switch + USB MUX

Similar projects worth following
KVM is a hardware device that allows you to control/manage several computers from one set of keyboard/mouse and monitor. It is a bit different than a software solution as you can use it at preboot.

There seems to be a void for affordable modern KVM switches even though all the pieces are out there. Cheap HDMI 1.4 switch has already most of the parts except for switching keyboard and mouse. It is a matter of adding a USB MUX for a minimal functioning KVM. I'll try to use as much off the shelf parts as possible to lower the complexity/cost.

HDMI Switching

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 some additional glue logic likely a 8-pin microcontroller to handle the buttons and selection LED.

HDMI Switch datasheet: http://www.amazingic.com/english/01_products/AZHW37

PS/2 KVM

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.

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 have small primitive USB stacks that might not handle the hot plugging. Switching mass storage devices without letting the OS knowing will likely results in file/file system corrpution.

Hardware Design

I have decided to try to make this KVM for USB 2.0.

There are proper USB 2.0 MUX out there e.g. On Semi NCN9252. On Semi NCN9252 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 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
  • 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.

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 back to unpowered PCs. Cheap hubs do away with the protection Schottky diode, so we only have 1 diode drop to worry about.

0.52x1.48 inch (13.08x37.46 mm) 2 layer board. 3 boards at $3.75 per batch of three.

PCB Signal Impedance

It is hard to get the right impedance on a 0.062" (1.6mm) doubled sided PCB on thin tracks and prototype design rules. (Online impedance calculator: here)

Due to the relative distances, edge coupling will have a significant effect. Normally you are supposed to maintain a few d clearance between differential pair to other signals and grounds. I tried to lower the impedance Z0 by having continuous ground fills right next to the traces. :P

The differential tracks highlighted in yellow has cross section and impedance like this:

USB...

Read more »

  • The long wait for UPS

    K.C. Lee5 days ago 0 comments

    Thus begins the long wait for UPS to drop it off to USPS. Record from last year was 1 month.

  • HDMI Switch Reverse Engineering

    K.C. Lee03/18/2017 at 20:47 0 comments

    I am trying to document some of the connections inside the HDMI switch.
    (Blue wire is my mod as my new GPU doesn't output +5V on the HDMI connector)

    Microcontroller

    U3 is an unmarked microcontroller in SOIC-8 that is controlling the HDMI switch. It is probably a good place to attach external cables to the USB MUX.

    Pin 1: Vcc
    Pin 2: HDMI Switch: S1
    Pin 3: HDMI Switch: S2
    Pin 4: Push button
    Pin 5: J1 +5V sense via 10K series resistor
    Pin 6: J3 +5V sense via 10K series resistor
    Pin 7: J4 +5V sense via 10K series resistor
    Pin 8: Gnd

    The +5V presence tells the microcontroller which port has active video. The microcontroller cycles through them each time the Push button get grounded. It'll also switch to the next available video source if the current one is no longer active. This is all we'll need for a minimalist KVM.

    The 3 Blue LEDs are buffered by transistors Q1- Q3 scattered on the PCB. They are controlled by the HDP[1..3] (Hot Plug Detect Status) signals which tells the video source that the monitor is present. That save them some extra I/O on the microcontroller.

    HDMI Switch:

    U2 Pin 9 PS: Power saving Selector - pull up by R2.
    U2 Pin 22 HDP_ctl: HPD output selector - pull up by R4.

    This means that the truth table on page 8 of the datasheet is being used.

    Regulator

    U1 is a switch mode power supply providing +3.3V for all the circuits. C10 is a bulk cap for the input after 3 Or'ing diodes. On my PCB, it is about 4.22V.

View all 2 project logs

  • 1

    Those cheap $0.50 DB-25 hood is an artifact from the 1980's that looks suitable for this hack. I bought a bunch from surplus places a long while ago. This looks to be similar to the USB2LPT project which as a part#: Kappe CG25G, Cinch 40-9725H on Digikey and possibly others.

    The PCB is installed with solder side facing up. Hopefully it would to line up with the two mounting holes. I made a rectangle hole with a box cutter, nibbler and a small file.

    The spacing is just right for the USB connector. I just have to prevent the connector from sliding out.

  • 2

    I clean up the area around the USB connector on an old motherboard. A single USB connector fits the footprint of double USB connector.

    Some rough cut with a cutting wheel using a Dremel tool. Remember eyes protection!

    After some cleanups, I eyeball the alignment and mark the cuts with a knife.

  • 3

    The "wings" on the sides fits in the cable retainer slot in opposite clam shell. Time for some elbow grease - cut, filing and finally cleanup.


View all 4 instructions

Enjoy this project?

Share      

Discussions

zakqwy wrote 03/16/2017 at 17:24 point

usb in a DB-25 hood is excellent!

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates