I am an electronics novice, so before I start cutting my cable, I want to ask people who know more than me.
I have a project that has a USB 3.0 hub inside, and I want a single switch to handle the DC power and the USB connection to the computer. I saw a video of someone who put an inline switch on a USB 3.0 cable, and he switched power and ground. Is that necessary, or can I get away with switching only one?
-
\$\begingroup\$ It's not a great idea to do any of those things. What is your ultimate goal? There may be some safer, more standard compliant way to accomplish it. \$\endgroup\$– user1850479Nov 29, 2021 at 15:51
-
\$\begingroup\$ I just want all the devices plugged into the hub to disconnect from the computer the hub plugs into which means the hub has to disconnect. Removing the 12v from the hub doesn't seem to get me there. I'm thinking of trying a switch on the 5v. \$\endgroup\$– jsurekeNov 29, 2021 at 19:58
2 Answers
OPTION 1 - DO IT IN SOFTWRE
If you can find the documentation for the upstream hub. There should be a command you can send the hub to turn off a downstream device via software. You can then avoid having to make any wiring modifications at all.
OPTION 2 - REMOVE 5V POWER
If it's not possible to find the documentation, or too complicated to implement the software, then you can disable the downstream devices by removing 5V power, and leaving GND (and all other signals) connected.
As a practical matter, disabling 5V power is going to require cutting into the cable to access the 5V wire (usually red), and putting a switch/relay/transistor in line with it. USB cables typically have a metal braid that is used for RF shielding. If you cut into that braid or move wires around, you might degrade the signal quality, or turn the cable into a source of RF emissions. Be careful with this approach and be prepared for the possibility that the cable no longer works.
OPTION 3 - TOTAL ISOLATION
Removing GND is probably not a good idea unless you have some compelling need to totally isolate the device from the host. GND is used as the reference for all signals. So, if you were going to disconnect GND then you would need to disconnect ALL signals. Having anything else connected, without GND connected could damage either the host or the downstream devices.
Also, it is very important to maintain the integrity of the data signals, so you can't just throw any switching element in line with them and expect it to work. Given the above, I see two possible ways to switch out all the wires.
- Use a chip designed to switch USB 3.0 signals. Texas Instruments and others make these. But since you said you are novice, using such a chip is probably beyond your abilities.
- Use a mechanical relay that is rated for operation in the GHz range. Coto Relay and others make such devices.
-
4\$\begingroup\$ The integrity of data signals is more than just "the right switching element", it's also about length and impedance matching (differential and single-ended) and small loop area... IOW a novice simply trying to wire in a mechanical relay, no matter how the relay is rated, will be a disaster. But your options 1 and 2 are correct and you correctly designated them as preferred so +1 \$\endgroup\$ Nov 29, 2021 at 16:29
-
\$\begingroup\$ My thought was to use option 2. Thanks for the input! \$\endgroup\$– jsurekeNov 29, 2021 at 19:53
You can't get away with that at all. USB3 has bandwidth that require special switches to maintain the impedance. So, no matter what, "switch in the data line" is a bad idea, and should not be done.
Since every USB link is always a point-to-point link (if you want multiple devices talking over the same cable, there's always a hub IC in between), the easiest solution would be just reading the hub IC's data sheet and finding out how to safely disable it. No cutting of cables!
-
\$\begingroup\$ Sorry, I don't know what "the hub IC's data sheet" meanse. I don't think you understand my question. I don't want to put a switch in the data line. I just want to turn off the power going to the hub from the PC, so there is no power going from the hub to the devices plugged into it. I'm only looking at power and ground. \$\endgroup\$– jsurekeNov 29, 2021 at 14:41
-
\$\begingroup\$ you mustn't do that at all, either; your data lines must have a defined relationship to ground and VCC, so making ground relative data lines float from the point of view of the device might damage your receiver. \$\endgroup\$ Nov 29, 2021 at 14:54
-
\$\begingroup\$ @MarcusMüller: switching VBUS is ok, because all the data line pullups (both passive and active) are to VBUS. Remove VBUS and the data lines automatically release at the device, which causes the host to sense a disconnect and release as well. \$\endgroup\$ Nov 29, 2021 at 16:26