I want to use a very long USB cable to place a webcam in a different room. The maximum length that I found was five meters.
What is the maximum length of a USB cable?
What is the maximum length achievable when using USB extension cables?
5 meters is the maximum USB cable. You can get further by connecting USB hubs serially (maximum of 5 hubs chained this way). You can't just use USB extension cables due to timing issues.
From the USB FAQ:
Q1: How long of a cable can I use to connect my device?
A1: In practice, the USB specification limits the length of a cable between full speed devices to 5 meters (a little under 16 feet 5 inches). For a low speed device the limit is 3 meters (9 feet 10 inches).
Q2: Why can't I use a cable longer than 3 or 5m?
A2: USB's electrical design doesn't allow it. When USB was designed, a decision was made to handle the propagation of electromagnetic fields on USB data lines in a way that limited the maximum length of a USB cable to something in the range of 4m. This method has a number of advantages and, since USB is intended for a desktop environment, the range limitations were deemed acceptable. If you're familiar with transmission line theory and want more detail on this topic, take a look at the USB signals section of the developers FAQ.
Q3: How far away from a PC can I put a USB device?
A3: With the maximum of 5 hubs connected with 5m cables and a 5m cable going to your full speed device, this will give you 30m of cable (see section 7.1.19 for details). With a low speed device, you will be able to get a range up to 27m, depending on how long the device's cable is. With a straightforward cable route, you will probably be able to reach out 25m or so from the PC.
Q4: I need to put a USB device X distance from my PC. What do I do?
A4: If X is less than 25m or so (see previous question), buy a bunch of hubs and connect them serially with 5m cables. If you need to go farther than that, put another PC, or maybe a laptop, out where you need the device to be and network it with the first PC using something that's intended to be a long-range connection, such as Ethernet or RS-485. If you need to use nothing but USB, consider using USB based Ethernet adapters to hook the PCs together.
All answers are incorrect if OP meant the link operating at High-Speed USB2.0 communication speed (480 Mbit/s).
The length of a USB communication link is limited by the USB architecture of having five hubs in the link. The USB protocol requires that USB devices send back handshake packets as ACK, NAK, NRDY, etc. These responses must come back to host within a specified time-out, which is set to 1.7 µs. The host controller hardware would set a flag/interrupt if the response is not received in time after 1-2-3 attempts, which would mean the link failure.
Now, what was the basis for this 1.7 µs limitation? It is based on a worst-case round trip of handshake packets. All is explained in USB 2.0 specifications, Section 22.214.171.124. There are three factors:
Physical signal integrity over a twisted-pair differential for a realistically manufacturable cables (impedance matching, cable uniformity, signal loss). This came out as 5 m cable length limit per segment. A 5 m cable has an estimated one-way propagation delay of 26 ns per USB specifications. All six cables will have the round-trip delay of about 300 ns.
Digital signal propagation delay along the hub's repeater path, which is limited to by suggested architecture to 40 HS bit times, which is about 80 ns per hub one-way. Five hubs will have the round-trip delay of about 800 ns.
A USB device is allowed to respond in 192 bit times, which is 400 ns.
So, total response time is 1500 ns. The specification allows some slack, and extends the time-out to 1700 ns.
Therefore, the limit for media propagation time is 1700 ns - 400 ns = 1300 ns, or 650 ns one way. If you can manufacture a cable that has such a low loss over 650 ns of wave propagation that it can deliver an open signal eye meeting USB far-end template, a host with a single USB device can work with it. Taking 26 ns per 5 m, it comes down to 125 m of cable. This is the maximum theoretical limit.
I'd love to see if this kind of cable can be made. Personally I had a good no-error link with 40 ft (12 m) cable made of Cat 5e. But it depends on quality/sensitivity of receivers on both ends of a link.
According to USB specifications, cables longer than 5 meters would cause a too large signal propagation delay to work.
But I've managed to build a 10 m/30 ft passive USB extension cable that worked just fine. All I did was to use an FTP Cat 5e AWG24 100 ohm cable with one twisted pair for data (D+ and D-; I used the green pair), and the other three twisted pairs for power (V+ and V-; in parallel solid to solid and stripe to stripe).
I've had no problem using any USB device over this cable.
If you want to go beyond 5 meters, use a booster.