# Sharing a USB keyboard between two PCs on a button flip

The PCB for the task would comprise of a USB connector, two sets of 4 PTH for the two USB cables (one set towards PC 1, the other towards PC 2), shared GND and TX and a DPDT switch for separating the VCC and RX.

Will that do? Could I get away with even a SPDT switch? I doubt I could as I do not have Germanium diodes in order to isolate the two VCCs of the two PCs and neither the parts for a FET and logic gates setup.

• Ok, this is all a bit confusing to me. Especially: Germanium Diodes?! where do these come from? (the only place I see that recommends Germanium Diodes are literally 60 years old amateur radio magazines, and the copiers and the copier-copiers of these. there's literally no reason to use Germanium diodes in this day and age that I'd be aware of. they are obsolete.) and: USB doesn't have a "TX" line, at all. It has a pseudo-differential D+ and D- pair, which is used in half-duplex. – Marcus Müller Feb 10 at 11:19
• @MarcusMüller I am a bit old... Germanium had those nice 0.3V drops instead of 0.7 V the typical Silicone junctions have. Ok, D+ and D-, should have done some research... Guess I'll be needing a 3PDT switch then – kellogs Feb 10 at 11:37
• absolutely nothing wrong with being old (let's call it life-experienced. Makes a lot of things easier and some harder to deal with again) :) You get that and lower drops using Schottky Diodes these days, which are generally faster and tend to be less subject to noise than classical Germanium diodes. And unlike these, they are still in production, and thus cheap :) – Marcus Müller Feb 10 at 11:53
• You CANNOT switch a USB keyboard between two computers without an MCU in the way to handle the protocol. USB is constantly pinging the keyboard to see if there are any actions to take, so switching the keyboard away in the manner you suggest would cause a disconnect. – Jack Creasey Feb 10 at 15:38
• @JackCreasy causing a disconnect is unlikely to be an issue, unlike PS/2 USB was designed for hot plugging. The goal here seems to be something more efficient but not fundamentally different from unplugging it from one computer and plugging it into another. Proper USB mux chips exist; they do nothing protocol wise. – Chris Stratton Feb 10 at 16:05

The PCB for the task would comprise of a USB connector, two sets of 4 PTH for the two USB cables (one set towards PC 1, the other towards PC 2), shared GND and TX and a DPDT switch for separating the VCC and RX.

There is no "TX" or "RX" line in a USB connector. The D+ and D- lines are both used bidirectionally, and must both be switched along with VCC.

That being said, you can use a 3PDT switch to switch a USB connection. Products which include such a switch are readily available -- search for "USB sharing switch" on your favorite online retail site to see some examples.

• DP3T or 3pdt ? – kellogs Feb 11 at 8:02
• 3PDT. I've corrected my post, thanks for pointing out my error. – duskwuff Feb 11 at 8:05

You can totally switch one keyboard between two computers using a 4-pole switch. You could even use a 2-pole switch connected between the USB data lines if you tied all the grounds together and OR'd the power supplies together with diodes (but be careful, check to make sure the is no difference between the grounds and Vccs with a multi-meter before connecting them!).

Each time you throw the switch, you would basically be doing the same thing as unplugging the keyboard from one computer and plugging it into the other.

The downside is that the computers involved will see the keyboard disappear/reappear when you switch, but most operating systems are OK with this and will automatically recognize the keyboard and start using it when it is attached.

(Note this would only likely work for USB 1.0 keyboards. Newer USB needs more wires and is much much faster and will not like going though a switch.)

• USB keyboards are low speed devices effectively by definition, the exception might be something that is a hub with an enclosing keyboard hanging off one of its downstream ports. – Chris Stratton Feb 13 at 23:06
• Even low throughput endpoints can connect using the higher speed USB protocols, it just has to do with the highest versions supported by the host and the slave. – bigjosh Feb 15 at 4:19