Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: VegaObscura on July 29, 2012, 12:03:36 AM

Title: Extending Length of USB Camera Cord
Post by: VegaObscura on July 29, 2012, 12:03:36 AM
I have a USB camera that I have been wanting to mount on the outside of my house with a computer controlled tilt/twist base.  The first thing I did was go out and choose a usb camera.  I found a great deal on one in radioshack and snagged it. Plugged it into my computer, works fine.  Cord will have to be a lot longer, though, to reach the outside of my house.

The next thing I did was build the base.  It's a very simple design.  It's made out of wood, and 2 servos, and controlled by a board with an atmega8, just like the board used in the $50 robot tutorial.  The two servos are controlled by uart. No autonomous control whatsoever.  One servo controls the left/right twist, and the other servo controls the up/down tilt. So I got that all put together, started up a hyperterminal, and it worked like a charm first try.

So the next thing to do was make the cords long enough to go from my computer to outside of the house.  I thought this would be the least likely place where I would hit a snag.  But I did.  I went to lowes and picked out a very well priced 22/4 wire (4 wires inside, each at 22 gauge).  It needed to be 25 feet, but I needed one for the uart cable, and one for the camera, so I got 50 feet with the intention of cutting it in half.  50 feet of 22/4 wire only cost around $8.50.

When I got it home I cut into the camera's 6 foot cord, ready to extend it to more like 25-30 feet. I cut back the shielding, and cut and stripped each of the 4 wires inside the usb cord on both sides, soldered 50 foot wire to it (the colors worked out great, considering the original usb cord had red, black, green, and yellow, while the new cord I bought had red, black, green, and white).  Instead of immediately cutting it to 25 feet, I instead decided to see if it would work at 50 feet.  So I soldered the other end of the 50 foot wire to the other half of the camera's usb cord (the side that plugs into the computer) and plugged it in.  So at this point the setup was the camera, with the wire coming out of it soldered into one end of the 50 foot wire, the other end of the 50 foot wire was soldered onto the wire coming out of the usb plug. I plugged it into my computer, hoping it would work.  But instead it said unrecognized USB device.  This was the point where I started to think it might not work.

Then I decided it might just be too long, so I went ahead and cut the 50 foot cord in half like I originally intended.  I resoldered the usb plug onto the end of the now 25 foot cord coming out of the camera, and plugged it in again. This time the computer recognized that it was a camera, but whenever I try to get any sort of image from it, the computer just locks up.  At this point I thought I might have damaged the camera somewhere along the lines.  Just to make sure the camera still works, I removed the 25 foot cord completely, and resoldered the usb plug back into the original cord coming out of the camera and plugged it in.  Then the camera worked fine.

So here's how it looks.  The camera works fine, even if the cord has been cut and resoldered.  It does not, however, work if there is a 25 or 50 foot cord being used to extend the original cord.  There must be some sort of data loss happening because of an excessively long cord.  What can I do to fix this?

I have not yet tried extending the uart cord that will be going into the turn/tilt base.
Title: Re: Extending Length of USB Camera Cord
Post by: waltr on July 29, 2012, 09:14:13 AM
USB2.0 Specs call for a cable no longer than 3 meters and with a controlled impedance. Extending the USB cable as you just doesn't work with USB2.0 HighSpeed. It might work at Full or low speed modes but these probably are not supported by the camera drivers.

Using a USB 2.0 powered hub to extend the USB range to 6 meters is the easiest solution. There are also USB extenders that work if you need even longer cable runs.

For the UART signals: Do use RS232 chips (MAX232 or equivalent) at both ends of the cable. These should work on several hundred feet of cable. You may have problems if the UART signals are at TTL logic levels.
Title: Re: Extending Length of USB Camera Cord
Post by: Soeren on July 29, 2012, 11:06:22 AM
Hi,

Just a quick correction:
The USB spec says 5m max. between hubs.

Further, each point soldered, joined by connectors, or even a kink in the cable will have a large impact on the impedance, giving rise to standing waves that'll muddy up the signal.

It's possible to convert to/from a coax signal at each end, but then a CCTV cam would be an easier solution (and giving a higher quality picture).
Title: Re: Extending Length of USB Camera Cord
Post by: Gertlex on July 29, 2012, 02:33:36 PM
An alternative you might try is to use a WiFi security camera, e.g.  the Trendnet IP110 (http://www.newegg.com/Product/Product.aspx?Item=N82E16881102052&nm_mc=EMC-IGNEFL072712&cm_mmc=EMC-IGNEFL072712-_-EMC-072712-Index-_-SurveillanceCameras-_-81102052-L024A) (I've used this, and its widely used, with a long thread of discussion here (http://forums.trossenrobotics.com/showthread.php?2745-Looking-for-a-good-camera-Trendnet-110-wireless-cam-amp-teardown)).  Or use ethernet with the same camera I linked -  if you have room for an extra ethernet cable on your router or room for an extra ethernet card in a desktop computer.

On another note, mechanically, you might find it ideal to use a 4-bar linkage for the camera tilt... properly done, this reduces the load on the servo, and results in smoother movement. Example using the camera above (http://forums.trossenrobotics.com/gallery/showimage.php?i=4408).
Title: Re: Extending Length of USB Camera Cord
Post by: VegaObscura on July 29, 2012, 02:38:05 PM
I'm going to try changing the location of the camera to where I can get by with 5m and see if it will work with 5m of cable.  I might be able to cut it down to 4m.  Will post back with response.

Also a wireless cam would definitely be the easier solution, but I'm trying to get the whole thing for the smallest possible price.  As for the 4-bar linkage, that sounds like a good idea but I don't know where to get the parts, or if they would be as cheap as the pieces of wood I'm using now.  Even though its working fine for now, I really do feel like there's too much stress on the servo gears and shafts, especially the one that's mounted horizontally.
Title: Re: Extending Length of USB Camera Cord
Post by: VegaObscura on July 29, 2012, 06:57:16 PM
Shortened the camera's cord to about 12feet, now it works like a charm.

Edit: Extended the uart wires out to 12 feet as well.  Worked perfectly first try.