Search icon

Download ANY‑maze for free

1Personal details
2Download reason
3Trial licence
  • Some information about you

You’re probably very used to connecting USB devices to your computer – just find a spare port and plug it in! And if there’s no spare port, connect a USB hub to the computer and then plug the devices into that.

For the vast majority of devices it really is that simple, but cameras are an exception. In this guide I’ll explain why and describe how you can overcome the limitations.

 

Section 1

Why connecting lots of USB cameras usually won’t work

The problem with connecting lots of USB cameras to your computer is one of bandwidth. This is simply a measure of how much information can be sent through the USB cable in a unit of time and, as you’d expect, it’s finite. For most devices this doesn’t matter, either because they send such a small amount of information that it uses hardly any of the bandwidth, or because the data isn’t time dependent. Cameras, however, do send a lot of data and it is time dependent, and therein lies the problem.

The USB bandwidth limitation isn’t actually a characteristic of the USB cable, it’s a characteristic of the USB controller and, just to make matters more complicated, a single USB controller typically connects to multiple USB ports. What’s more, connecting a hub to a port doesn’t change things, the bandwidth is limited by the controller and not by the hub.

 

 

In the above (simplified) diagram the computer contains two USB controllers. The ‘blue’ controller connects to an internal device and has a single external USB port, the ‘orange’ controller has three external USB ports, one of which has been connected to a 4-port USB hub.

Let’s say you wanted to connect six cameras to this computer – it looks easy enough, you could just connect four cameras to the hub and the other two to the two empty USB ports on the orange controller, sorted! Unfortunately that won’t work, as all the cameras are connected to the orange controller and all the orange parts of the diagram share that controller’s bandwidth.

As a general rule of thumb, you can usually connect 3 cameras to a single USB controller without exceeding the available bandwidth. So, even if you plug one of the cameras into the blue controller’s external port, you’d still have 5 connected to the orange controller and that still wouldn’t work. The solution would be to move the hub to the blue controller’s port, connect 3 cameras there and connect the other three to the orange controller’s external ports. You’d then have 3 cameras on each controller and everything should work OK.

While all this hopefully makes sense, it leaves quite a few unanswered questions:

  • How do you know which port connects to which controller?
  • Indeed, how do you even know how many USB controllers your computer contains?
  • And what happens if you wanted to connect more than 6 cameras to the computer in the diagram?

In the rest of this guide I’ll answer these questions.

Section 2

The ANY-maze USB viewer

Built into ANY-maze is a ‘USB viewer’, you’ll find it listed on the left side of the Support page. Selecting the viewer will show something like the figure below.

 

 

Here we have just a single controller which connects via a number of hubs to six external USB ports. A couple of things to note:

  • It’s very common for computers to contain built in USB hubs (as is the case here), so the connection from the controller to the external ports usually isn’t as simple as the first diagram implied.
  • You may notice that in the above figure the controller has two ports – Port 1 and Port 4, but what about ports 2 and 3? The answer is that they are internal ports (and connect to such things as a keyboard, a touchpad, a built in webcam, etc.) – the option at the top of the list is causing these internal ports to be hidden.

Anyhow, the important thing about the USB viewer is that you can see how many controllers you have and you can see the ports that connect to them; however, you still won’t know which port on your computer is which. To work that out you should disconnect everything from the USB ports and then connect something to just one port – as you do this the USB viewer will update dynamically to show the newly connected item, meaning you can identify the physical ports on your computer with the ports in the viewer.

Armed with the knowledge of which physical port connects to which controller, you can plug in your cameras making sure no controller has more than three cameras connected to it.

Section 3

What if your computer doesn’t have enough USB controllers for your cameras?

I’ve mentioned a numbered of times that you shouldn’t connect more than three cameras to a single USB controller, but what if you want to connect more cameras to your computer than the number of controllers will support? Well, there are a number of things you can do:

Add more USB controllers

If you’re using a desktop computer, the simplest solution is to plug in a USB controller expansion card. These cards plug in to PCIe (or on older computers, PCI) slots inside the computer. Many suitable cards are available, with some having multiple USB controllers on the same card. Using this approach it’s straightforward to connect even large numbers of cameras, and for this reason, if you want to use more than 3 cameras with ANY-maze, we’d usually recommend a desktop computer over a laptop.

Reduce the bandwidth used by the cameras

If you are using a laptop then you won’t be able to add more USB controllers, so what can you do to break the 3-cameras-per-controller limit? As you’ll recall, the limiting factor is the bandwidth, so the solution is to reduce the amount of bandwidth each camera will require.

As you’d probably expect the bandwidth requirement of a camera is a factor of the image size and the frame rate (the number of images sent by the camera each second). ANY-maze will typically use an image size of 640×480 and a frame rate of 30 frames per second (fps) (which is what the 3-cameras-per-controller recommendation is based on). Reducing the image size isn’t usually a good idea, but reducing the frame rate is normally fine (as the animal’s don’t generally move very fast).

To actually reduce a camera’s frame rate, you should select the camera into a video source in the protocol and then click the Camera properties button in the ribbon bar, this will cause the Camera Properties window to open – see the image below.

 

 

Here you can alter the frame rate, to for example, 15 fps. You might think that by halving the frame rate you’ll halve the camera’s bandwidth usage and so double the number of cameras you can connect, but unfortunately it’s not that simple and with a 15 fps frame rate you will almost certainly be able to connect 4 cameras to a single controller and you may find 5 work, but 6 probably won’t.

Section 4

HD cameras and cameras which have high frame rates

Lots of modern consumer webcams are ‘HD’ (high definition) which means they provide images larger than 640 x 480, the exact size varies but it might be 1280 x 720 or even 1920 x 1080. And some industrial USB cameras offer frame rates above 30fps, such as 76fps.

As you’d expect, larger images or higher frame rates will use more bandwidth, so you may find that with these cameras you can only connect 2 cameras to a single USB controller, not 3. Usually, you can reduce the image size using the options on the camera’s properties page, but this won’t always work as some cameras will still send the full-sized image across the USB connection and then just scale it once it arrives at the PC. Indeed some cameras do the same thing with frame rate, i.e. they still send every frame across USB but then ‘drop’ frames at the PC – in these cases changing the frame size of frame rate won’t alter the bandwidth.

In fact high frame rate cameras are rarely of any benefit in ANY-maze unless your animals move really fast. Large image cameras can be beneficial, although for a single piece of apparatus an image larger than 1280 x 720 is usually excessive. That said, there is one situation in which large images can be particularly useful – when you have a single camera showing multiple apparatus, this is described in detail in this guide.

Section 5

What about USB 3.0 or USB C?

Most modern computers have USB 3.0 ports (which usually include some blue plastic) and some have USB C ports (which are much smaller than traditional USB ports) – both these port types usually have much higher bandwidth than the USB 2.0 ports this article has been describing.

Surely this means you can connect lots of cameras to a USB 3.0 port without exceeding the available bandwidth? Unfortunately not. When you connect a USB 2.0 camera to a USB 3.0 port, the USB controller switches the port to USB 2.0 mode and runs it at the USB 2.0 bandwidth.

What you could do is connect lots of USB 3.0 cameras to a USB 3.0 port and then the available bandwidth would be much greater, but most (if not all) consumer webcams are USB 2.0 devices, and industrial USB 3.0 cameras are significantly more expensive than their USB 2.0 counterparts (although their price is dropping).

Section 6

In summary

As a rule of thumb, you can only connect three USB cameras to a single USB controller. In this guide, we have seen how to find out how many USB controllers your computer contains and which controller the USB ports on your computer connect to.

The easiest way to connect more cameras to your computer than the three-cameras-per-controller rule will allow, is simply to install more controllers, but in laptops that’s not possible, so there you need to reduce the bandwidth used by the cameras, usually by decreasing the frame rate.