2

For debugging and testing an android device that connects to a custom USB peripheral, we'd like a software controlled way to unplug and replug the USB.

It looks like USB cables have 4 wires so I'm thinking if the specific device I need doesn't exist (I haven't found it) all I really need is a software controlled 4-channel switch so I can just cut the USB cable in half and plug the wires from each side into the switches, and open/close the switch using software.

Sane so far?

I looked around and found devices like this: https://www.amazon.com/SMAKN-Channel-Programmable-Computer-Control/dp/B01KWTL0BQ/.

Here is a diagram of how I imagine this would work:

example diagram

A couple things I'm not clear about:

  • Will this add too much load to the USB +/- signal wires so the timing is messed up and it won't work?
  • Is a relay really a "switch" in the sense I'm hoping for where it just closes an unbuffered circuit I can drive a signal on both directions as required to be inserted into the middle of a USB cable?

In short, should I buy this thing and go for it or is there some critical flaw in this approach?

Thanks!

eagspoo
  • 2,095
  • 3
  • 22
  • 31
  • There are KVM switches that let you choose which computer a keyboard and mouse a plugged into. One of them might work for your situation if you can figure out how to control it from the laptop. – David Grayson Nov 18 '16 at 02:13
  • @DavidGrayson we looked for a device like that but struck out. Some had control software but it was always "transfer control to this device" versus being able to specify which device ("transfer to other device" for example) – eagspoo Nov 18 '16 at 17:26

1 Answers1

1

This will work (as with all things: if done correctly!).

The relay on that board is a hardware relay; when closed, it is electrically indistinguishable from a normal piece of wire. It's rated for 12 V which is fine for this application.

One precaution is that the USB connector is designed so that the different contacts meet in a specific order (e.g. ground first because it is the outer case, then the interior pins are different length so the power pins meet before the data pins) - your controller software should mimic this to avoid causing any potential issues if either device is unprepared for a different connection order.

Ryan Cavanaugh
  • 209,514
  • 56
  • 272
  • 235