USB Interruptor

Press the button to momentarily disconnect a USB device

Similar projects worth following
This simple board plugs inline with a USB cable. It always passes the 5V power and normally passes the USB data signals. But when you press the button, the USB data signals are momentarily disconnected.

Why would anyone want or need such a thing?

Well, for the last few months I’ve been developing a USB Host Library for powerful but complex EHCI USB port in Teensy 3.6. After several false starts and re-reading the USB 2.0 and EHCI 1.0 specs and datasheet over and over (did I mention this 480 Mbit/sec USB host port is powerful but really complex), it’s finally starting to come together.

Now I’m at the stage where it’s time to begin work on code to handle USB disconnect events. When you unplug the cable, the ECHI work queues need to be removed, periodic schedule bandwidth allocation/planning needs to be undone, memory needs to be freed (hopefully it’s all findable from linked lists), hub/port status needs to be updated, and probably a ton of other stuff needs to happen that I haven’t even considered yet…

Reaching over to physically unplug the USB cable gets old quickly! Really, really old, both hands off my keyboard… right when trying to focus. With 12 Mbit/sec USB ordinary switches can usually work, but this is 480 Mbit/sec and I’m already running it through a USB protocol analyzer and a few cables plugged in tandem, leaving not much signal quality margin left. So I made this handy little board with a proper USB 2.0 high speed mux chip. The control signal is just 3.3V logic, so I might even wire it up to something to automate the process.

Admittedly, not many people develop USB host drivers and software stacks (it’s turning out to be probably the toughest coding I’ve ever done), so this little board might not have really wide applications. But here’s all the details anyway. ;-)

PCB Gerber Files

Zip Archive - 5.83 kB - 02/26/2017 at 10:28


  • 1 × Resistor, 10K, 805 RHM10.0KCHCT-ND
  • 1 × Capacitor, 0.1uF, 805 478-1395-1-ND
  • 3 × Capacitor, 1uF, 805 587-1281-1-ND
  • 1 × Diode, Schottky, B120 B120-E3/5ATGICT-ND
  • 1 × MCP1700 3.3V regulator MCP1700T3302ETTCT-ND

View all 10 components

  • USB Disconnect Leaks Fixed

    Paul Stoffregen02/26/2017 at 22:40 0 comments

    Exciting news: with this commit (and several others just before it), I've finally managed to free all the memory resources when a USB device disconnects.

    I just disconnected and re-enumerated a USB keyboard 60 times in a row. Previously I could only do this a few times (and a week ago not at all due to other limitations) before all the slots in the memory for devices & pipes were used up.

    Now all the resources are being returned, or at least all the ones in use for this simple test. Still so many more cases to consider....

View project log

Enjoy this project?



Arsenijs wrote 05/18/2017 at 01:14 point

That mess of wires in the picture... Why plug wires in parallel like that? =D Also, what is the keyboard connected to, and what does the MicroUSB cable provide - power only? (I guess the Teensy-to-analyzer wires could be shortened to a single cable...)

Nice board! What are the clearances on this? I often order stuff from DirtyPCBs, am wondering if I could panel one of these boards on a 10x10 panel - maybe the via annular rings would be too small though...

  Are you sure? yes | no

Jose Daniel wrote 03/13/2017 at 11:59 point

Admittedly, it is true that not many people develop USB host drivers and software stacks, but this project may be the basis for a programmable USB switch I am looking for. Thanks for sharing your work.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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