DIY KVM Switch Lets You Use One Keyboard And Mouse With Multiple Computers

Here’s a quick DIY hack if you happen to have multiple computers at home or at the office and are tired of juggling mice and keyboards. [Kedar Nimbalkar] — striving for a solution — put together a keyboard, video and mouse switcher that allows one set to control two computers.

A DPDT switch is connected to a female USB port, and two male USB cables — with the ground and 5V wires twisted together and connected to the switch — each running to a PC. [Nimbalkar] suggests ensuring that the data lines are correctly wired, and testing that the 5V and ground are connected properly. He then covered the connections with some hot glue to make it a little more robust since it’s about to see a lot of use.

Now all that’s needed is a quick press of the button to change which PC you are working on, streamlining what can be a tedious changeover — especially useful if you have a custom keyboard you want to use all the time.

[Thanks for the submission, Kedar!]

36 thoughts on “DIY KVM Switch Lets You Use One Keyboard And Mouse With Multiple Computers

  1. Hmm. Connecting the two 5V lines together isn’t a great idea. If one PC is off then you’re going to be backfeeding 5V into it from the other PC. It is unlikely to damage it but you may find it acts strangely because part of the motherboard is powered when it isn’t expecting it. If you’re already using a HDMI switch then just get a USB KVM…

    If you really want to do this then you should switch the power lines as well so both PCs are isolated from each other and make sure the switches you use are break-before-make.

        1. Probably not a problem for low-speed stuff like mice and keyboards. Wiring the 5V together though is asking for a nasty explosion, or, hopefully, the USB ports cutting power. Why not just use 1 5V line? Either will do. That, or the Schottky diodes mentioned. USB has enough slack to be OK with that.

    1. Or you can source 5v from only one source.
      PSU (wallwart) is the safest where as 5VSB is usually supplied to USB ports on most modern mainboards.

      If using the motherboard 5VSB approach then just limit your load to 2A (Most PSUs are 2A+ on that rail) or whatever that polyfuse on the MB is rated at and isolate the USB power from the other PC.

      Also if your monitor has built in USB ports (some do) then that is a good source of 5v. Hot monitors don’t want any more loading so sip about 200mA max, or if your monitor is a cold to the touch one then about 500mA or what the manual specifies.

      That will solve power feed through problems.

      P.S. experienced accidentally feeding back 12v and 5v through a proprietary display connector (combines DVI+Power+touchscreen).
      The second machine tried to boot causing the source PSU to overload and shut down.

    2. I very much agree, this isn’t a great idea TBH with the obvious backfeeding, also a real KVM switch will make the switch instantly, this is equivalent to unplugging and plugging it back in. the OS might give a delay before it recognizes. Also the keyboard/mouse never gets unpowered, some might freak out for a moment due to changing host interfaces on the fly, switch bounce, etc.

      The big plus I see is that this will let you use non-standard gaming type keyboards, my old KVM did not pass through the keyboard commands that were non-standard, like hotkey buttons etc.

    1. He has a seperate HDMI switch box just under his monitor… While a proper KVM is a better option DVI or HDMI ones are pretty expensive, you can get HDMI switches off eBay for < $10 and the switch is clearly the cost of a couple of cables and a few dollars in parts if you can't scanvenge them from something.

  2. HDMI switch boxes are handy when you have more than one monitor and you don’t want a $1000+ KVM but windows thinks you actually unplug the monitor and out creates havoc, relocating every open app.

    1. I am a frequent user, and big fan of mouse without borders. It’s great for Windows environments, bit won’t work in Linux. (well, maybe with wine, but doubtfully very well). I’ve also noticed it can randomly wake a sleeping PC, or actively prevent sleep.

      Nice project!

      1. Synergy has license sales occasionally, and the pro license is only needed if you wish to run encryption between the machines on the kvm stream (good idea unless you completely trust your local subnet), plus you can put it on multiple machines, I network 5 machines up to the same synergyd here. I got a free pro license donated from them after submitting a bug report as Ive been a long term user.
        I spent years (decade+) fighting kvm’s of various manufacturers before finding it and sooner or later they all have sync issues or lockups and require the machines rebooting because I have a mixed os environment at my desk and synergy isnt perfect (it occasionally needs the daemon or clients restarting, which I can do via ssh’ing in to the recalcent keyboardless machine and I run the km on the daemon machine obviously) and I still have a dodgy kvm under the desk that I can switch a spot monitor round onto to do earlyboot stuff, but I’m pretty happy with synergy…

  3. Why? I used to rely on a KVM switch until I figured out that remote desktop does this as long as both computers are networked. Heck… I can even use Windows’ RDP on Linux by installing xrdp.

    1. Because sometimes both computers are not networked?
      Because sometimes you need to get into a bios screen, or at some other time before the RDP service (or ssh service) runs?
      Because sometimes your company’s VPN policy doesn’t allow local network access while connected to the VPN?
      Because you might want to play a high frame-rate game that doesn’t so well with RDP?
      Someone can probably think of more if that’s not enough.

  4. Twisted, a ill term for sure. Just don’t let those twisted wires blow a motherboard. Please use chewing gum or epoxy or silicone rubber anything but thermal snot.
    Pun. Why on earth would you need to open the shared earth? If anything you ahould expect not to connect them anytime lest some ground loop crap come up. So sharing plus supplies even worse, unless those grounds are one and indivisable. They are common between the power socket and the hdmi switch.

    1. Anything more than spst is forgotten ancient lore these days…. as are say multi channel switches on an IC…. and the funny thing is you’ll prolly get ppl going all round the houses trying to figure how to signal switch with a xxxduino and end up “discovering” the chip they shoulda used in the 1st place.

  5. I have yet to find a proper Switcher. I have my reg Pc then my server then the raspberry pi then 2 oranges and last but not least my banana.(God sounds like a fruit salad at the end.) And I tel you it all a pain.
    Right now I’m using a 4 port usb switcher with a 5 port hdmi switch.
    I think I’m going to have to make something up because the 5v feed back on there makes booting up each of the computers a problem.
    Why .. Why.. Why.. cant anyone make a proper hdmi switcher that will work with computers game consoles dvd players ect.
    I have 6 so far and they all don’t work one way or another more so with the game consoles and chromecast.
    I’ve been trying to find a mechanical one with no luck anymore.

    1. For a mechanical one, what about the old printer sharing switches? They used giant wafer switches, with maybe a dozen or more sets of contacts. I dunno how fussy HDMI is about impedances and stuff, but you might get away with it. Either get searching dumpsters, or maybe Ebay has some old ones.

      1. I do have some of them. I did use one as a video switcher a while back for DJing.
        It was a lot of work to put together.But I guess if I have to I will. i will have to do a wire count. But I think it was short in connections with hdmi and usb. I guess if I have to i will.
        Thanks for reminding me.

  6. Very Very Very Bad Idea! Connecting the 5v Rails of 2 PCs together is a recipe for a blown Motherboard. Especially if one of the machines happens to be a Mac. They have very weak reverse voltage protection on the USB ports. I have seen multiple reports of “powered USB hubs” wrecking Macs and some branded PCs also. Because they “common up” the 5v in from the wall-wart with the 5v on the USB. This does the same thing.

    Ironically the recommended video I see after this plays is the “USB killer” man… youtube is smart.

  7. I built the thingy and then read all the negative comments about powering back 5v into any of the motherboeards, that is indeed nasty. I am no expert but I believe this is something like taking an extension from the outlet and connecting it to the other side of another outlet, what could be the result in your opinion?
    Please remove this “hack” before someone destroys their expensive PC just to save a few bucks, or at least do it propertly without misleading people.
    One question to the author: did you motherboard blow up after using it for some time? :)
    Luckily mine is still fine and I will surely buy a KVM swich ASAP before that happens.
    A good comment I found here is to power the thingy from another power source, completely independant, at least you avoid destruction.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.