Dick Cappels' project pages http://www.projects.cappels.org
Return to HOME (more projects)
USB Printer Sharing Switch

I had two computers, a Mac Mini and a generic Windows computer. Both were on different networks, but in the same room, and I wanted to share a Lexmark USB laser printer between the two of them. I ended up making this switch to share the printer between the two computers.

Find updates at www.projects.cappels.org

Two USB printer cables were cannibalized to make the switch. The square plug (USB Type B) connects to the printer and two rectangular plugs (USB Type A) connect to the computers. If in doubt, just look a the sockets you want to connect to. After this photograph was taken, I added the labels "MAC" and "PC" to the switch. Naturally, the labels were printed on the Lexmark Printer.

The Mac and PC were on different networks, and maybe this is good, but I was getting tired of switching the USB cable from the Lexmark printer between the two computers, and besides, I had not yet found grounded plug strip for the PC and risked getting a 220 VAC tickle whenever I picked up the cable from the PC.  I saw the sparks whenever I connected the PC to the grounded printer and felt that it was only a matter of time before I became part of the circuit. It seemed that some kind of switch that would allow me to switch the printer between the Mac and the PC, all the while keeping the grounds connected, would be the solution. 

The switch doesn't really care which operating systems are used. It could be two Macs, to PCs, or a pair of Linux boxes, as long at its USB, or something vaguely similar, its ok with the switch. The logos of for two popular operating systems and the printer brand have been deliberately blurred because I respect their respective copyrights.

I visited the Fortune IT Mall in Bangkok and a couple of computer stores in other shopping centers, but I did not find a USB peripheral sharing switch. After looking around on the web, I found a couple of USB peripheral sharing switches, starting at about US$39, but shipping would cost me about another $50.  For that kind of money, I can continue to swap cables at the printer. Or, I thought, "Why not look in my junkbox and see if I can do it myself?"

Over the years, I have had one Apple and one Epson ink jet printer go dead on me, leaving me with two perfectly good USB peripheral cables. Those, and the power cords, were about all the worthwhile components I could salvage from the old printers. If I could come up with a 4 pole double through switch, I though, it would be a piece of cake. That way, I could switch all four USB conductors - VBUS (+5 volts), D+, D-, and Ground) between the two computers. Unfortunately for me, the best I could come up with was some double pole double throw (DPDT) toggle switches.

With a DPDT switch, I can switch the two data lines. I tried connecting the shields from the two computers together, the grounds two computers together, switching the D+ and D- lines with the DPDT switch, and leaving the VBus lines float, but for some reason it didn't work. The Lexmark printer seemed to need to see the +5 Volts. It had been many years since I read the USB standard (It was USB 1.0 back then) and I did not recall a function for the VBus beyond providing power to the peripheral, but in true experimentalist fashion, I added a transistor switch to supply VBus to the printer from whichever computer was connected, and the printer started working.

The switch, a miniature DPDT switch from the surplus store, switched the
data lines, and a pair of Schottky diodes provided VBUS (nominally +5 volts)

to the printer from whichever computer was on.

I used a pair of transistors to  "OR" the Vbus voltage from the two cables that go to the computers, but a while after building it, I realised that the "off" transistor could turn on because the backwards transistor (collector and emitter swapped) could still work, but with most transistor types with a lower gain. Modifications to prevent the "off" transistor from turning on would have resulted in a lot of parts, so, abut two years after building the switch, I tried a pair of Schottky diodes as David Hogg, a reader of this web site.

I used 1 Amp diodes instead of the lower current diodes because it will stand up better to abuse, and the 1 Am diodes will have a lower voltage drop than one with a lower current rating at a given current. The diodes work just fine in my office.

While on this subject, a fellow by the name of Jim Glasgow build a switch before he came across this web site. His switch used a four pole break-before-make switch. I think this is a superior method, if you can find such a switch. One possible hitch to switching the ground, is that there is no way to be sure that the ground connects first, so the data or Vbus conductors could connect first, thereby possibly subjecting the circuits in the printer or one of the computers to hazardous voltages. Its best to tie all the grounds together and only switch data and Vbus.

Click on the above image
to see the original circuit.
I no longer recommend this

The common admonishments apply to this circuit: Keep the wires as short as practical, make sure you don't have any shorts, and check operation before closing up the box. CONNECT THE SHIELDS FROM ALL OF THE CABLES TOGETHER.  In the one I built, I did not use any sort of circuit board. I just wired the transistors and resistors to the conductors from the USB cables, using plenty of heat shrink tubing to keep things insulated. As soon as the circuit checked out in operation, I put the cover on the box.

The Lexmark printer is a USB 2.0 printer, and the USB ports on both of the late model computers are USB 2.0, but I doubt that communications were flying along at the blinding 480 Mbps High Speed data rate. More than likely, things are loafing along at 12 Mbps Full Speed data rate. That's my guess. The switch may work at 480 Mbps, but beyond keeping leads short, it may take some luck.

Now a word about this project. This is not a complete do-it-yourself project for the inexperienced. It is merely an example of what I did to solve a problem I had.  The selection of the components used in this project depended mainly upon availability and convenience, and there are likely better choices. If you undertake this project, you may have different results. For example, if the cables are miswired, and your equipment is not grounded, there is a chance of damaging the printer, one of the compuers, or all three. USB is well designed and robust, but its not completely fool proof, especially in cases in which fool connect nonstandard equipment. Though this switch worked on my systems without a hitch, it may not work in your system. This project does not have an assembly diagram, printed circuit board artwork,  or bill of material. You are responsible for any circuit you build. Before you start building, be sure you what you are doing and the implications of any mistakes you might make. 

HOME (More Projects)
Contents ©2006, 2008  Richard Cappels All Rights Reserved. Find updates at www.projects.cappels.org

First posted in July, 2006

You can send  email to me at projects(at)cappels.org. Replace "(at)" with "@" before mailing.

Use of information presented on this page is for personal, nonprofit educational and noncommercial use only. This material (including object files) is copyrighted by Richard Cappels and may not be republished or used directly for commercial purposes. For commercial license, click here.


  Liability Disclaimer and intellectual property notice
(Summary: No warranties, use these pages at your own risk. You may use the information provided here for personal and educational purposes but you may not republish or use this information for any commercial purpose without explicit permission.) I neither express nor imply any warranty for the quality, fitness for any particular purpose or  user, or freedom from patents or other restrictions on the rights of use of any software, firmware, hardware, design, service,information, or advice provided, mentioned,or made reference to in these pages. By utilizing or relying on software, firmware, hardware, design, service,information, or advice provided, mentioned, or made reference to in these pages, the user takes responsibility to assume all risk and associated with said activity and hold Richard Cappels harmless in the event of any loss or expense associated with said activity. The contents of this web site, unless otherwise noted, is copyrighted by Richard Cappels. Use of information presented on this site for personal, nonprofit educational and noncommercial use is encouraged, but unless explicitly stated with respect to particular material, the material itself may not be republished or used directly for commercial purposes. For the purposes of this notice, copying binary data resulting from program files, including assembly source code and object (hex) files into semiconductor memories for personal, nonprofit educational or other noncommercial use is not considered republishing. Entities desiring to use any material published in this pages for commercial purposes should contact the respective copyright holder(s).