Programmable USB hub and Arduino

Hi everyone,

Having in hands an USB individual port switch, I’d like to manage the active ports from Arduino, but the ports should actually be used from another device(a computer for example).
But here comes my problem.

The scheme would be : USB devices → USB hub → Arduino → The device that should use the USB devices

But this way, the ports would actually be used by Arduino and not by the device that should actually use them(I guess? I didn’t have yet tried but that what should happen, forgive me if I’m wrong but I shouldn’t)

In my mind, the solution would be make Arduino act both as a the “manager” of the USB hub and act as an USB hub itself, but I have no clue either how to do that / if that is the best solution.
Or either, what I’d need is an USB individual port switch hub that has an additional USB attach that allow it to get managed, while going directly to the interested main device. But I highgly doubt something similar exist.

Any idea?

0day:
In my mind, the solution would be make Arduino act both as a the "manager" of the USB hub and act as an USB hub itself, but I have no clue either how to do that / if that is the best solution.
Or either, what I'd need is an USB individual port switch hub that has an additional USB attach that allow it to get managed, while going directly to the interested main device. But I highgly doubt something similar exist.

Any idea?

I second your thoughts.

If a port shall be disconnected, this can be done by a (multi pole) relay, or according to some electric convention. E.g. lack of the 5V power indicates no-host to a slave, or shorted data lines indicate a dumb power supply. An USB device should not try to communicate with such connections.

Shorting the data lines requires to disconnect the lines to the host, with possible impact on signal quality.

Cutting the 5V line requires a high side switch for 500mA, controllable by the Arduino. This should be the least critical circuit.

No guarantee for correctness, and 2.x/3.x compatibility.

DrDiettrich:
I second your thoughts.

If a port shall be disconnected, this can be done by a (multi pole) relay, or according to some electric convention. E.g. lack of the 5V power indicates no-host to a slave, or shorted data lines indicate a dumb power supply. An USB device should not try to communicate with such connections.

Shorting the data lines requires to disconnect the lines to the host, with possible impact on signal quality.

Cutting the 5V line requires a high side switch for 500mA, controllable by the Arduino. This should be the least critical circuit.

No guarantee for correctness, and 2.x/3.x compatibility

Thank you for the reply. I didn't check the topic in months and I still didn't come to a conclusion / left the project for a while.

When you say that you second my thoughts, you mean that you second my idea of making Arduino act as a USB hub while using a real USB hub, right?

Then I should apply what you wrote regarding port disconnection.

Correct me if I'm wrong

I don't understand.

USB hubs exist. The allow many devices to communicate with a host computer. The hub participates in the connection and disconnection cycle, passing that information upstream to the host.

What do you want to do that a standard USB hub doesn't already do?

MorganS:
I don't understand.

USB hubs exist. The allow many devices to communicate with a host computer. The hub participates in the connection and disconnection cycle, passing that information upstream to the host.

What do you want to do that a standard USB hub doesn't already do?

I want to control the USB hub ports status(on/off) from an external controller.
As I've mentioned, there are individual port switches where you can push a button and change the state of individuals ports, but instead of pushing buttons, I want them to be enabled/disabled by a microcontroller like Arduino.
On those USB hubs, in the circuit there is the so called usb hub controller which (should) do that job

Would that work? Seems to fit exactly my needs, and I've found that just now.

So you want to cut power to the USB ports so that you can leave devices attached without charging their batteries all the time?

In 2018, I don't believe that's a problem but I won't interfere with your belief.

The TPS2540 is an ideal chip for this. It presents as a charging circuit to the connected device and also passes through USB data if you want an actual working hub. It has a simple enable pin that can be controlled by the Arduino. You can also get (basic) feedback on how much current the device is drawing and configure two different charge current limits.

It is really small. Staggeringly small when you consider the current it can handle. The PCB traces required for that current are wider than the pins on the chip. You will need a solder stencil but I've soldered them in a frypan on the stove, so they aren't too difficult.

While you're at it, use a TPD2E001DZDR as ESD protection. You will be surprised how many thousand volts you can get on a USB cable when it's handled by a human. This protects all the power and data lines up to 15kv.

For the actual hub chip, I don't know. I'm sure TI has a solution. I've only ever built 'dumb' chargers and never needed it to work as a data hub.

Or build switches. You know, real toggle switches next to each USB that you want to turn off.

[edit: I just read down to the last comment on the TestDevLab blog. It seems like they are now using TI parts similar to the ones I suggested.]

This post is an answear to what I am looking. I need to dissable and enable the data line from my digital SRL camera to the computer. The camera will not autofocus or shot the pix with the USB cable attached to the file download USB port. Removing the cable is not an option because the camera is at a remote location.

But from the diagram , I am not able to make any sense. My camera uses a USB mini type B USB. This is a 5 pin wired cable. So hwo esxactly the cables lines are attached to this chip and what wires go to the computer?

I think that the "Top-Level Functional Block Diagram" on pg. 9 is most instructive. The right hand side shows the switched output connector, left top shows the control pins and power supply (IN), and left bottom the data pins to the host. GND is common to both sides of the switch.