How Feasible is a DIY KVM? - Page 1
Forum section: electronics / beginners

author: BananaPoop
author_rank: Newbie
timestamp: November 16, 2021, 07:43:45 am
content: Hi All,I was looking into purchasing a KVM (Keyboard, Video, Mouse) switcher. For those not familiar, you connect 2 or more computers to the KVM, and then you connect the KVM to your keyboard, USB, and monitors. And it provides a quick way to switch which computer is connected to the keyboard, video, mouse. E.g. for quickly switching between 2 computers.However all these devices looked quite expensive and depending on your setup, you may need a very particular (even non-existent) KVM to provide the correct I/O.But then I thought, these are simple devices, can't you just build one? Whilst I am not sure if I as a noob, will actually build one of these KVM's but I thought I could at least try to design one, and I just want to check some assumptions that I couldn't verify.My Current Understanding:Buy solderable connectors for all required devices, and wire them to a MUX IC. If required, you could even daisy-chain these mux's probably. Use an Arduino to control these mux IC's and upon changing computer, disconnect all lines using the Mux (Emulating the unplugging) and then shortly after (say 25ms?) connect them to the correct devices.Since all modern connectors are hot-swappable, this shouldn't cause any issues, besides some flickering as the devices reconfigure themselves.I understand that properly designed KVM's do strange things to make devices not aware of the hot-swap going on, but I would be happy to forgo that in favor of a simpler design.Things I know about so far:I will need to keep coupled traces 'matched' so that they are the same length, and symmetrical.Keep unrelated signals seperated as possibleMinimize overall resistanceSo for instance with DisplayPort,QuoteDo they mean the 'matching' pairs should be seperated by exactly/no more/no less then 5 mils? And is that centre-to-centre distance, or is that the width of the traces themselves? (I will read more into this)But besides what I've listed above, I am basically unaware of any other requirements or design considerations.Something I am worried about is that my may, or may not use "Double Insulated" or "Galvanically isolated" PSU's (or even battery only). As of right now, I do not believe these warrant any considerations, and that everything should work 100% fine. As long as I don't use 2 non-galvanically isolated devices, which are on separate circuits. (Which I won't, but I am not even sure then if that would be an actual issue). I was also planning on power the device, by either a DC power brick connected to mains, or via a USB. I will also purchase the PCB from a manufacturer, and I think I will use hot-air solder paste soldering (since many of these packages use very fine connectors), but I believe that since there are not many IC's it won't be a huge issue.So is there anything I am not understanding here, or can it really be this simple? Is there any special consideration I need to look into for a MUX IC? besides pin count, and voltage? I am kind of assuming that signal integrity won't be significantly affected regardless of the IC I choose. Just an FYI I will obviously seek more advice if this project is practical, such as sharing the schematics ect... before frying all my hardware.

author: jeremy
author_rank: Super Contributor
timestamp: November 16, 2021, 08:11:48 am
content: You could get away with 12mbit USB using this approach, but with DisplayPort you are unlikely to have much luck. At multi Gbit/s data rates (or even before that), the exact geometry of the traces and the dielectric constant of the material that they are running on becomes critical as you will either radiate the signal away into the air, or cause the signal to reflect back into itself, making the data corrupted. See here for some more details on high speed routing:https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/an/an_672.pdfAlso, you need to have a mux which supports these data rates, which you are unlikely to find as a generic mux; it will likely be labelled as a DisplayPort mux specifically.

author: HB9EVI
author_rank: Frequent Contributor
timestamp: November 16, 2021, 03:12:57 pm
content: if your intention is just to have a solution to switch those I/O devices between a set of computers, it's absolutely not worth the pain of homebrewing; 4 channel KVMs are readily available for under 100 bucks

author: NorthernWing
author_rank: Contributor
timestamp: November 17, 2021, 07:48:13 pm
content: QuoteI wouldn't say that, but there's a lot of critical information you're missing. Thetl;dr: Unless you can make do with only USB 2.0 and VGA, just buy one. It's not going to end well trying to beat the price of a retail unit by doing this much work on something using low volume parts.QuoteSignal integrity is absolutely dependent on the IC you use as a switch. Everyone else has already said it, but there's a lot more to it than 'buy connectors and hook them to a mux', and most modern protocols using serial data are far to fast to function with a jellybean CMOS multiplexer.ThelowestDisplayPort bit rate is in 'Reduced Rate' mode at 1.62 Gbps/lane - you either need averyexpensive switch or a dedicated DisplayPort switch IC here, neither of which are going to be available in a package that will be easily assembled. Put a standard multiplexer in here and you're just not going to have a signal coming out the other side. It goes up from there, I think HBR3 mode is something like 8Gb/s. The same thing goes for USB, although I've used Renesas low-capacitance/high-bandwidth analog CMOS switches on USB2.0 (480Mb/s) for one particular application... USB3.0 is out of the question without a dedicated USB switch.QuoteI don't know how NXP is providing these numbers without accompanying board parameters... you need to look up the target impedance of the signals you're routing - DisplayPort is 85Ω IIRC, USB is 90Ω. Your trace width/space depends on the PCB itself... the dielectric material, copper thickness, and layer heights among other things will all affect the impedance of the differential pair. There are calculators out there that you can feed the parameters of your PCB construction and they will give you a target for trace width/space, the 'Saturn PCB Toolkit' is one I think everyone's used at some point.QuoteNot minimize, you need to match the impedance of the signal you're switching as mentioned above.

author: brucehoult
author_rank: Super Contributor
timestamp: November 17, 2021, 11:14:54 pm
content: They used to be very expensive, but there's no way you could match this 4 computer switcher for $70 (supports HDMI 4K@60 Hz), let alone the 2 computer ones for $25 to $30.https://www.amazon.com/GREATHTEK-Switch-HDMI-Port-HDCP2-2/dp/B08J3W2JYZ

author: james_s
author_rank: Super Contributor
timestamp: November 17, 2021, 11:30:47 pm
content: You can buy either a used name brand or new Chinese KVM on ebay for less than you'd spend on parts to build one, even if you don't value your time. Building a KVM could be a fun engineering challenge but it certainly isn't worth doing for any other reason, unless you need something unique that can't be bought off the shelf.

author: amyk
author_rank: Super Contributor
timestamp: November 18, 2021, 03:19:45 am
content: A DIY KVM is definitely feasible if it's a mechanical one.

author: BananaPoop
author_rank: Newbie
timestamp: November 18, 2021, 12:42:41 pm
content: Hi All,Thanks for all the replies.I want to clear some things up that I may not have made clear:I am aware the cheapest way to get the best KVM, is too buy one online, even in just parts aloneIt may in the end be too difficult to manufacture a prototype, since some of the parts use high-density and hard to use footprints. Even if I simply made a schematic and pcb layout, that I was vaguely confident about, that would be a huge win imhoIt may even in the end, be too hard for me to make a viable schematic since I know very little about electronics. But even so I would like to try, so that I can appreciate the technical difficulties in electronics design (and be humbled), and that would also be okayQuote from: jeremy on November 16, 2021, 08:11:48 amOkay, so about the mux, I did some searching and I found a muxhttps://www.ti.com/product/HD3SS214which I could find in stock athttps://au.mouser.com/c/?q=hd3ss214for a reasonable $7 each. This IC supports 8.1Gbps sufficent for DisplayPort 1.4 so more than enough speed.To your second point about the geometry of traces, this is of great concern to me, not because it is infeasible in principle to do, but really because I would need to learn a lot in order to actually accomplish this. Your link was very helpful, what I want to understand is, suppose I try to meet all the requirments, but for various reasons fall short, peraphs the copper layer is quite coarse, or something like that. Now if I just had very short traces, then I imagine the 'total signal loss' would be minimal correct, so maybe a 'good effort' would still be enough to keep signal quality high enough for most DisplayPort functionallity, as well as the fact that I don't have other noisy components polluting my space.I just note that NEXT is measured in noise per distance,Quote from: NorthernWing on November 17, 2021, 07:48:13 pmOkay, so I am not an EE, so as I understood impedance is essentially total resistance which includes extra resistance from the effects of capacitance and inductance which become more significant at higher frequencies. Now you reference target impedance should be 85(or whatever) but here's the part I do not understand. When I connect my computer to my monitor I use a DisplayPort cable and it all works, and I imagine that the impedence from my GPU <-> Cable<-> Monitor IC, is roughly matching the target impedance required by the DisplayPort specification. Now if I were to add some extra connections to make it GPU <-> Cable <-> My Device <-> Cable <-> Monitor IC, since you just add resistances up (and I assume impedence as well?) I'd actually want my device to be as close to 0because the required impedence is already present and any additional impedence might take it out of spec. Like I assume DisplayPort cables are made to as close too 0as is practical and yet that all works fine yes? So should the same logic work for my device?Now, is it because of the mux that I need to modify the impedence? Does the mux somehow 'undo' impedance and hence I'd need readd?Quote from: amyk on November 18, 2021, 03:19:45 amYes, I agree. Technically I believe an 8P2T (Or there abouts) would be all that's needed. And I was even thinking, too be extra cheap. You could buy a bunch of cheap limit switches, And then design a 3d printed mechanism like a flexure, which would lock into 2 positions, one where an arm pushes all the switches down, and another where they are released. Of course, then you cant have software defined switching but you could also use a relay (which I am not sure if that adds impedence).Anyway, I did write up a schematic. I am missing power caps for now, and I am not sure how to mark differential pairs, but I end the flags with either a N/P to mark them. No idea if this is actually a functional schematic but oh well.kvm1.pdf(118.8 kB - downloaded 79 times.)Also, I realize that each connector has grounding on it, I wasn't really sure if it was wise to connect these all to a common ground or not.In case my diagram isn't clear J1, J2 are input DisplayPort connectors, and J3 is the output Displayport connector.If it's possible to do this on a 2 sided PCB, then I 100% want to do it on a 2 sided PCB, for the challenge but also because it's cheaper. However I am aware that placing ground planes above and below is really important for preventing 'crosstalk' (I think?) Would it be possible to pull a thin piece of copper around the entire pcb (cutting out areas for pads,vias and components) and then solder that to ground? I won't actually do this, but just a thought. I imagine 4 sided will be required in the end.I have tried routing my pcb, and I have some questions, it would be very convienant to place a via ontop of the pad so I can avoid having to route unrelated channels near each other, but I have heard many say this is bad practice. Because the joint can wick solder away, but if I am soldering this by hand, I think you could easily just kapton tape of the bottom of the vias, and then fill the vias with solder, before then attempting to solder the component.

author: Jan Audio
author_rank: Frequent Contributor
timestamp: November 18, 2021, 05:18:20 pm
content: KVM switches always break on me i dont buy anymore.Intrested.

author: ejeffrey
author_rank: Super Contributor
timestamp: November 18, 2021, 05:36:17 pm
content: A basic KVM-like design is not too complicated, but there are a bunch of little things that happen behind the scenes.A big thing is that computers detect monitor and keyboard attachments on boot. They may misconfigure the graphics card if no monitor is detected or fail to boot altogether with no keyboard. I still see computers that display the famous "No keyboard detected, press F1 to continue" message on boot. So the KVM will pass the monitor identification information to all computers and emulate a boot-capable USB keyboard and mouse. It would also generally have a USB hub so that it only needs a single USB connection to each host to share keyboard, mouse, and other USB peripherals.Getting all this right doesn't really add hardware cost but is a lot more development work than slapping down some mux chips and calling it a day. You don't necessarily *need* to do all that. You could probably build a functioning 2 port KVM with just some analog switches and it would "sort of" work. But it wouldn't really be reflective of what is needed to make a proper KVM.

author: tooki
author_rank: Super Contributor
timestamp: November 18, 2021, 09:05:15 pm
content: Quote from: amyk on November 18, 2021, 03:19:45 amOnly if by “mechanical” you mean a robot arm that unplugs one DisplayPort cable and plugs in another.The data rates (and thus the signal integrity requirements) of DisplayPort are huge. You can’t just introduce a rotary switch or something and then expect it to work.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: November 19, 2021, 01:57:20 am
content: Monoprice (at least used to) makes and sells these for dirt cheap.

author: BananaPoop
author_rank: Newbie
timestamp: November 19, 2021, 08:45:54 am
content: Quote from: ejeffrey on November 18, 2021, 05:36:17 pmYes, most KVM's actually have more sophisticated features, for starters they'll have USB support which I would look into adding later on, if I can get DisplayPort working, I imagine USB will be far easier to implement. As well as other features like keyboard shortcuts to switch device (I am not interested in adding this), and making your devices unaware of the disconnection (This would be good, but the handshakes seem far too complex too fake, so I wont be adding this).DisplayPort is a hot swappable protocal (Hence why you can unplug it whilst in use) so it should be okay.Quote from: JustMeHere on November 19, 2021, 01:57:20 amThe cheapest DisplayPort KVM which switches 2 to 1, is atleast $100. And if you have more DisplayPort slots, that only goes up. So yes, it is affordable, but if I can get the design right, it will be quite practical for people to DIY based on the schematics/pcb/kits or whatever.Quote from: BananaPoop on November 18, 2021, 12:42:41 pmJust in case you guys didn't see it, my last post has an attached .pdf of the schematic. It's not super clear that there is an attachment on this forum.

author: Keivinstib
author_rank: Newbie
timestamp: November 26, 2021, 12:58:19 pm
content: his is quite simple, get urself some 2channely relays, connect the input of the relays to the data inputs of the usb , connect the output to both to NC and NO

author: tooki
author_rank: Super Contributor
timestamp: November 29, 2021, 11:59:56 am
content: That might work for USB 1 speeds. Maybe. But USB 2 high speed? Not likely. It’s very particular. And DisplayPort? Not a chance.