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 × Diode, Schottky, B120 B120-E3/5ATGICT-ND
  • 1 × MCP1700 3.3V regulator MCP1700T3302ETTCT-ND
  • 1 × FSUSB30 USB Mux Switch FSUSB30MUXCT-ND
  • 1 × USB Connector, Mini-B 609-4701-1-ND
  • 1 × USB Connector, Std A ED90065-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?



Josh 'Acecool' Moser wrote 07/11/2017 at 15:54 point

This looks very useful - I may order one... I'm currently working on another project, the Logitech G series Pedals and Shifter USB Adapter, and when I'm finished flashing, despite having the reset wire hooked up to STLinkV2 and the device, I have to manually unplug or plug in... I finally used some breakouts and DuPont wires, plus a clicker switch I had in a flashlight to interrupt the power which does the same thing ( I tried using an external power-source, but Windows keeps saying the device malfunctions, but it isn't true because I have a USB standard to DuPont female connectors I made, and I used a neighbor usb port for power and got the same issue... BUT, if I use a USB HUB then I can use a neighbor power source so I believe it is giving that error because Windows wants to be in control of power management - with the external it would've been so easy and clean [ I have a dentist light above my desk with a few other lamps for working, and a power-bar.. From the powerbar I have a 1 foot 3 prong single plug extension hanging down, and plugged into that I have a 1 plug Belkin toggle switch { white with clear switch, green LED } and I could just reach over by my left monitor and toggle ] but that didn't work out... right now this switch works but it creates a few extra wires I'm not a fan of... ) but I'd like a cleaner solution - so I may end up getting a USB hub with the toggle switches..

Although, this could be made to look nice, if I get a 3D printer, because it could be made into a plug with a case and a larger button - usb male to female so I may modify your design a little bit to do this... Cheers for this!

  Are you sure? yes | no

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