USB Relay

I tried to make a rudimentary USB KVM switch with relays; however I could not get the usb device (a hdd) to work. I it got power but it just didn’t start up. It just kept clicking. The drive is good. I believe I connected Black, Red, Green and White wires correctly; so what am I missing?

Is it even possible to splice 2 usb cables together?

You can splice 2 usb cables together, but only the Red and Black. I have an external hdd via usb. I noticed some drives will work with one usb cable and other will do the same, they will click trying to start up. When I use a cable like the following then they start up ok.

Could it be that the EMI shield has to be connected to ground as well?

This is such a mystery. Why would some cables work while others don’t

Some cables use thinner wire than other do.
I have one of these do-dads.

I cannot tell you how many different USB cables I have used on the same device seeing different current draws. Some cables just can’t handle certain loads. For instance, take the USB cable that is used to charge your bluetooth headset. Might draw 150-250ma tops. They are not going to spend the money on a cable that can supply say 1A. Now my phone on the other hand will suck 1.5A from the cable if it will allow it. So the cable that comes with my phone is much thicker than the bluetooth one.

So my plan just fails because manufacturers don’t adhere to usb specs.

no, you fail because you stop trying :slight_smile: It’s not about specs, it’s about cents. If a manufacturer knows they need 100ma capacity and their device will never use more, why would they spend 10 more cents over thousands and thousands of units shipped on a cable rated to meet the spec and be able to deliver 500ma ? They don’t care if you pick up their cable and try to use it with something else, that’s not their concern; their cable is perfectly serviceable with their device, that’s the test.

So then, what’s my course of action? I can’t just buy and destroy cables until a find ones that work.

Perhaps if I power the drive externally? It needs 5v, and I think I have a power brick that supplies that exactly…

Your running into 2 problems.

#1) Low current USB cables. I would start with buying a usb cable for a phone. They typically have the ability to provide 1A of power.
But then you will run into problem #2
#2) USB ports only provide 500ma.

So even if you get a high current cable that wont help you. You will need two cables just to get 1A.
Try a cable like i suggested in my other post. They are for doing exactly what you want.

[quote=“VersaModule”]I would start with buying a usb cable for a phone. They typically have the ability to provide 1A of power.

Having cut open a number of USB cables and found tiny little wires I have to agree on this as an alternative option.

I’ve stopped buying generic USB cables for this reason and switched to using genuine Samsung phone or tablet cables and I now don’t have any issues with power when either charging from 1 or 2A chargers or using with the PC to power devices that need the full 500mA.

1 Like

I truly did not think that the hard part would be in finding a suitable cable. I’m now working on powering the USB hdd externally with a 9v wall wart and an inline regulator. but at this point I might as well build a circuit board and use one of my DPDT 12v relays :frowning:

Just to confirm the poor quality of some USB cables, a while back we bought a bunch to supply with our meters, which use the USB port to charge the on-board Lithium cell at 500mA.
They didn’t work, and on investigating we found the end-end resistance of each core was around 3 Ohms.
So at 500mA and 3 Ohms up and back, of the 5V USB rail only 2V would get to the device, which is not going to work.

These were a thin grey/green looking cable, and on shopping around we found some thicker black ones for not a lot more.
With a 0.1 Ohm end-end resistance they work fine, and we can push 1A into the cells.

On a similar note, there are a LOT of terrible 18650 cells on the market, with huge performance variations between units in a batch.

1 Like

So I dug up some old parts, including a 9V wall wart. I powered the usb device externally, and it still won’t connect.

I don’t understand why it’s not working. This makes no sense.

OK, I assume you are working the GREEN and WHITE to each relay with the COMMON on the relay going to whatever device wants to switch between the 2 USB devices?

Are all the GROUND wires connected together?

Can you show the wiring for the relay contacts?

One of the issues with USB is that ideally the leads need to be kept as equal length (on the PCB at least) and this includes in PCB layout. Is it possible that you have have something too long or too short as this introduces timing issues. I saw this the first time I did a PCB layout for a USB device and didn’t use differential rules to lay the tracks out. It just wouldn’t work reliably. After I redesigned the board to use differential pairs and ran them together the same design worked. :slight_smile:

All grounds are connected together. I don’t really have the wiring for the relay, there are ones that GHI used to sell back in the day.

Why does USB, a non differential signaling serial interface, need to have signal wires of the same length? This is news to me :frowning:

[url]Redirect Notice

[quote]The USB data lines, D- and D+, should be routed as a differential pair. The trace impedance should be matched to the USB cable differential impedance, which is nominally 90 ohms for the signal pair.[/quote] - Section 3.3.1, page 8

So, I may have introduced too much impedance by adding the relays, or by making the cable lengths incorrect.

There is nothing so simple…

@ andre.m - the first run is about 8 feet and the second is about 14 feet. USB max length is 16 feet.

Another thing that can be causing an issue, is on the 3’rd photo you have the 5v regulator, but I do not see any filter caps on the input or output.
Do you have them and I just can see them ?