How many USB devices can you connect ?

How many USB devices can you connect ?

The USB specification plans for 127 device adresses on the USB bus, and it is tempting to deduce from this that you can connect up to 127 devices on a USB port. Unfortunately, life is not as simple: this naive reasoning does not take into account all constraints imposed by USB controllers. To give you a better and more useful answer, we have decided to test what works in real life...



Our goal is to determine how many Yoctopuce USB devices, either sensors or actuators, you can hope to get working properly on a machine. At the same time, we will let you know what are the ideal conditions to maximize this limit. In order to get real numbers, we have built a batch of USB test devices, which behave like Yoctopuce sensors. Actually these are just Yocto-Demo with a custom firmware allowing to setup at will the number of measures reported per second. In this way, we will be able to run specific tests with devices creating USB trafic at 1Hz, 10Hz, 100Hz or even 1 KHz, which is the maximum message transfer rate allowed by the USB Full Speed standard used by Yoctopuce devices.

The first thing to know is that the maximum number of USB devices that you can use depends as much from the USB hubs as from the USB host controller. We will therefore test these two aspects separately.

We have tested quite a few USB hubs.
We have tested quite a few USB hubs.



USB hub comparison


Our first test is designed to observe how various USB hubs react to a small number of devices configured to send data at high frequency. This reproduces what would happen when you connect for instance several Yocto-3D-V2 inertial sensors, or a few analog interfaces like the Yocto-0-10V-Rx reading fast-changing signals. From this test, we can immediately distinguish between two groups of USB hubs:

  1. Those who loose packets, and happen to be mostly cheap ones purchased from retail outlet;
  2. Those who don't loose packets, and have usually been a bit more expensive

A USB bus is not expected to loose packets: USB is supposed to provide a lossless transport layer. Contrarily to Ethernet or WiFi networks, where packet loss are expected and taken into account, USB protocols are not designed to handle retransmissions. So when a USB hub looses packets, it might go unnoticed for a mouse, but it creates real trouble for measure and control applications.

Multi-TT vs Single-TT USB hubs


Price is obviously not the most relevant factor to determine if a hub might loose packets. What matters is its chipset, and in particular if the chipset can handle Full Speed transactions on all ports simultaneously, or if it can only handle one Full Speed packet at a time because it has only one Transaction Translator. In the first case, we have a Multi-TT hub (MTT), which normally works well. In the second case, it is a Single-TT hub (STT), which will loose packets when they come too quickly.

With a Single-TT hub, when there is heavy Full-Speed traffic, one can observe packet loss as soon as there are 2 devices connected. With moderate traffic, it may work properly up to 3 or 4 devices, but as the number of device increase, packet loss may quickly appear and trigger communication errors.

Using exclusively multi-TT hubs, we have been able to connect up to 30 Full-Speed devices configured to send the most intensive traffic possible, i.e. 1000 messages per second, without seeing any packet loss.

You will find a summary of Single-TT and Multi-TT hubs that we have tested on the table below. If your hub is not in this list, you can try to find on Internet the type of chipset that it uses. You can also open the OS device manager and check the VendorID and DeviceID of the hub. The most common Single-TT chipset is Genesys GL850, which can be recognized by its DeviceID 0x0608.

By the way, we were sorry to find out that the Moxa UPort 207 et Uport 407 hubs, based on a SMSC chipset capable of doing Multi-TT, are nevertheless dropping packets. The manufacturer should probably have spent a little bit more time to check this rather than spending time for replacing SMSC VendorID by its own VendorID.

Moxa industrial hubs look good, but during our load tests they do frequently loose Full-speed packets like any cheap Single-TT hub
Moxa industrial hubs look good, but during our load tests they do frequently loose Full-speed packets like any cheap Single-TT hub



Connection topology


Another limiting factor for connecting many USB devices is the hub connection topology, or in simpler words, the way hubs are connected to each other. Indeed, you cannot link blindly one hub to another indefinitely until all devices are connected: there is a maximum number of hubs that a message can cross between the host controller and the device. Starting from the USB controller and the Root Hub embedded on the host motherboard, a message can only cross 5 external hubs at most. So the best way to connect as many devices as possible is to organize them in a tree, rather than linking them in a chain: on the first external hub, only connect other hubs, on which you can also connect further hubs if needed. This will create a large number of USB ports, with a minimal number of hubs to the host controller.

It looks easy, but there are three traps. First, you must take care about power supply: the USB standard does not allow you to connect a USB hub to another if they don't have their own power supply. Some hubs will even disable their downstream ports when they detect that they are second-layer hubs without external power supply. Generally speaking, if you want to connect many devices, always start by powering all hubs from the beginning, without exception. This is the safest way to go.

Second, if you need some distance between your USB devices and the PC that drives them, be prepared to spend one level of hub for this. Indeed, over 2m distance, USB active extension cables are the only one you can rely on, as long passive cables cause packet loss due to weak signal. But an active extension cable is actually a cable with a built-in USB hub to re-amplify the signal.

Third, you may hope that using 7-port or 10-port hubs can make it much easier since you get more USB ports using less hubs. However it is often not the case: most USB 7-port hubs and 10-port hubs are actually made of two or three USB hubs embedded in the same box. Therefore, they still count as multiple chained hubs for the maximum depth limit. To create an optimized topology and chain them properly as a tree, you need therefore to use the device manager and check the depth of each hub port, which makes it a little bit more difficult to build an optimal tree.

From a topology perspective, the best USB hubs that we have tested are those based on Terminus FE2.1 chipset: they provide 7 flat USB 2.0 ports within a single hub. The hub models which use this chipset are the LogiLink UA0148 and the ExSys EX-1177. Another interesting topology option is the ExSys EX-1116HVMS, which offers 16 USB 3.0 ports, made from 5 hubs organised as a balanced tree of depth 2.

The ExSys EX-1116HVMS hub provides 16 USB 3.1 Gen 1 ports, and is made of 5 hubs connected as a tree
The ExSys EX-1116HVMS hub provides 16 USB 3.1 Gen 1 ports, and is made of 5 hubs connected as a tree



On the other extreme, in the 10-port hubs category, the IcyBox IB-AC6110 is the worst from a topology perspective, as it connects three hubs in a chain without making a tree.

USB 1.1, USB 2.0 and USB 3.x


Yoctopuce devices work in USB Full-Speed mode, as defined in USB 1.1 standard and inherited by USB 2.0. One outstanding question is to know if there is an advantage for this type of traffic to use an hub USB 2.0 hub over a more recent USB 3.x host.

According to the specifications, USB 3.x remains compatible with 2.0 devices. If you look at the datasheet of USB 3.x chipsets, you will notice that they all include a USB 2.0 hub in one form or another.

This is verified in real life: we have observed identical performances for Full-Speed traffic routing on USB 2.0 and USB 3.x hubs. The only advantage in favor of USB 3.x hubs is that they usually include an individual status LED on each port, which is seldom the case for USB 2.0 hubs. The only USB 2.0 hub with individual status LEDs that we have seen is the LogiLink UA0148.

The USB 2.0 hub LogiLink UA0148 is Multi-TT and includes individual status LEDs for each port
The USB 2.0 hub LogiLink UA0148 is Multi-TT and includes individual status LEDs for each port



USB hub comparison table


Here is a summary table to conclude this UBS hub test bench. Note that our comparison is focused on the performance for handling multiple Yoctopuce devices. We have not tested high-speed USB 3.x throughput, nor fast-charging capabilities for instance. We have also added at the end of the list our own Micro-USB-Hub-V2 for comparison purpose, even though it does not really belong to the same category since it is designed to be embedded rather than used stand-alone.

ModelChipsetPortsMTTtopologyform factorprice
Maxxtro MX-USLGenesys GL8507xUSB23+4desktop15€
Maxxtro MX-UA6Genesys GL85010xUSB22+4+4desktop30€
Maxxtro MX-U3HU05Realtek 54017xUSB33+4desktop34€
D-Link DUB-H7Genesys GL8505xUSB23+2desktop37€
IcyBox IB-AC618VIA VL8127xUSB33+4desktop52€
IcyBox IB-AC6110VIA VL81210xUSB33+3+4desktop74€
LogiLink UA0126Moai MA860113xUSB21+4+4+4desktop19€
LogiLink UA0148Terminus FE2.17xUSB27industrial19€
Moxa UPort 207SMSC USB25077xUSB27desktop181€
Moxa UPort 407SMSC USB25077xUSB27industrial255€
ExSys EX-1177HMVTerminus FE2.17xUSB27industrial48€
ExSys EX-1181Genesis GL352010xUSB32+4+4industrial83€
ExSys EX-1187HMVSGenesis GL35207xUSB33+4industrial86€
ExSys EX-1188HMSGenesis GL35207xUSB33+4industrial82€
ExSys EX-1189HMVSGenesis GL35207xUSB33+4industrial89€
ExSys EX-1116HMVSGenesis GL352016xUSB34+4+4+4industrial225€
Yoctopuce MHUB0002SMSC USB2514BI4xUSB24embedded29€



The best quality/price ratio for an industrial Multi-TT hub is clearly the LogiLink UA0148. At this price point, we can only hope that the workers who built it have received enough money to make a living.

Alternatively, the ExSys hubs are both affordable and of good quality. Most of them feature an industrial 7-24V terminal connector for power supply.

Load test with ExSys industrial USB hubs
Load test with ExSys industrial USB hubs



USB host comparison


Once we know how to connect many USB devices using hubs, we must still make sure that the host will be able to handle them all. First the CPU must be powerful enough to handle all traffic. But in addition, there are sometimes constraints in the USB controller itself which limit the maximum number of usable devices. Here is the results of our experiments.

PC (Windows 7.0 and 10.0)


On slightly older motherboards featuring several USB 2.0 controllers, we have been able to connect without problem up to 16 devices on the "Enhanced" controller and up to 7 devices on each of the standard USB controller. Make sure not to get tricked by the fact that several USB ports may actually correspond to the same controller: you need to verify how devices are spread on controllers using the Device Manager. With a bit of care, we have been able in this way to use about fifty devices on a single machine, each sending 1000 messages per second.

On some recent machines, there is just one Intel xHCI USB 3.0 controller, which handles all USB ports. The problem is that, by design, this controller cannot talk to more than about 20 USB 2.0 devices in total. So if you have a mouse, a keyboard and a few hubs, you will not be able to use more than 13 to 15 Yoctopuce devices.

Mac


On the iMac that we have tested, we have been able to connect 30 devices, each sending 1000 messages per second, on each of the two USB 2.0 ports. The EHCI controller used by Apple seems to be robust.

Raspberry Pi 2


The Raspberry Pi 2 appears to work with 10 devices sending messages at 100Hz: this eats up about 12% of its CPU time. Over 10 devices, the handling of High-Speed devices seems to slow down exponentially, and it is even impossible to get 17 devices to work simultaneously, even when they send almost no data.

Intel Edison


The Intel Edison is capable of handling 12 devices sending messages at 100Hz: this eats up 9% of its CPU time. It is impossible to connect more than 13 devices, as the USB controller does not have enough ressources. However the Intel Edison is also capable of handling devices sending messages at 1 KHz, as long as you don't push to far: it is still a small machine...

Conclusion


Here is what you should keep from these tests:

  • If you use more than one USB device per USB port, always use Multi-TT hubs. Forget cheap USB hubs sold in retail outlets, they are no good for USB Full-Speed traffic.
  • As soon as you use more than 4 devices per port, provide a power supply to all USB hubs.
  • To connect many devices, you must create a tree topology.
  • Don't expect to use more than 10 devices on a mini-PC like the Raspberry Pi or the Intel Edison.
  • No more than 13 devices in total on recent PC using Intel USB3 xHCI controller.
  • Apart from than, on a robust machine, you can connect up to 50-60 devices USB in total if you select properly your USB hubs and the connection topology.


And don't forget that your real-world tests are the only proof that your design works. We can give you hints at how to get the best results, but ultimately it is your hardware and your design that will make the difference.




1 - mvuilleu (Yocto-Team)Wednesday,august 24,2016 14H36

One more comment about the Moxa hubs: a quick check with an USB analyzer shows that the hub advertise itself as Multi-TT... but for some reason they are nevertheless loosing packets. Strange...

2 - voyager62 Tuesday,april 11,2017 21H50

What are "loose packets"? What kind of packets are attached to hubs and become loose on cheap ones. I thought packets consisted of data and not a physical part and therefore would never loosen.

3 - martinm (Yocto-Team)Wednesday,april 12,2017 7H59

Welcome to the real world :-) if a poorly designed USB hub accepts more USB packets than it can handle, it will just drop some of them.

4 - konstantin Friday,july 07,2017 15H28

Looking into designing or ordering some USB hub to embed it to my network appliance.

If you'd have to get somewhere embeddable 4x, 7x or 24 port USB hub or design it by yourself, what chipset you'd choose for that task?

5 - martinm (Yocto-Team)Monday,july 10,2017 4H47

@konstantin: we use a multi-TT USB2514BI chipset from SMSC (now Microchip) in our Micro-USB-HUB-V2 (www.yoctopuce.com/EN/products/micro-usb-hub-v2). Never had to complain about it.

6 - emissary Wednesday,june 09,2021 1H06

Fantastic article, but I'm wondering how much of this still applies in 2021? In particular I'm wondering about limits on the newer Raspberry Pi 4, and also I have been reading people on various forums saying that with usb 3.0 MTT isn't something to worry about anymore. Is that true?

7 - mvuilleu (Yocto-Team)Friday,june 11,2021 9H22

@emissary: we will rerun tests on newer chipsets to write an updated version of this article, but there were already some USB 3.0 hubs back in 2016 and some of them did not handle USB 1.1 traffic better than USB 2.0 hubs. The problem of split transactions to handle remains the same in 2021...

8 - mvuilleu (Yocto-Team)Friday,june 25,2021 17H54

@emissary: The new serie of tests is now available: see https://www.yoctopuce.com/EN/article/how-many-usb-sensors-can-you-connect-in-2021

9 - sfr75 Friday,august 26,2022 21H47

Very interesting article. I'm building an art installation, where I need to connect up to 300 USB keyboards. What would be the best course of action given the fact that keyboards are very low-traffic devices. I've seen that on alibaba they are selling 100-port "industrial hubs".

https://www.alibaba.com/product-detail/100-port-Industrial-USB-Hub_1600107784064.html

Any experience with those ? Obviously I need to keep the cost down, but register the keypresses from all the keyboards )

10 - martinm (Yocto-Team)Monday,august 29,2022 16H10

@sfr75 : Well that's quite an ambitious project. I'm not even sure if this can be done or if this so called 100 port Industrial USB Hub will actually work. Also I guess you will have to use very long USB cables, which will cause problems as well.
Expect a lot of trial and errors.

Yoctopuce, get your stuff connected.