Build a Hardened, USB to Serial Cable With CAT5

Synopsis - This project uses CAT5 cable and a USB to serial converter to cheaply extend USB cables long distances. Using a Sparkfun USB to serial breakout board and an RJ-45 breakout, it’s simple to create a cheap USB to serial extension using CAT5 cable. Since there is no enclosure available for a USB to serial device, I also present a whacky way to harden the unit so it can be installed in a rugged environment.

USB-Serial-Extension22

Read on for how to build a rugged USB to TTL serial extension to your microcontroller.

[update: 2/6/09 - I had some great feedback about this project over on the Sparkfun forum ]

Background - This is decidedly one of the lowest-tech articles I’ve put up, but nonetheless, it solves a problem we occasionally run into. The background on this is that the US Army had purchased numerous in-vehicle tracking units from 360VL (I’m a co-founder) for their fire apparatus and later decided they wanted to export the GPS information from the unit to a Toughbook laptop. The 360VL in-vehicle unit is designed so the built-in GPS connects directly to the controller’s serial port and is not available (as designed) to any other device.

The set up sounds simple enough, but there were two problems to solve. Since the fire department installed the unit under the back seat of a crew-cab fire engine and the Toughbook is installed in the front, navigator’s seat, we had to get a serial connection from the unit to the laptop and preferably deliver it as a USB connection to the laptop. That distance, when you consider routing the cable, was at least 15 feet which gets to be a pretty long USB cable. Since it had to integrate with a TTL serial signal on the controller side, buying an off-the-shelf cable of that length would have been difficult or expensive to make.

It can also be difficult to route cable that has connectors on it through headliners and around posts, so it’s beneficial to have the option to terminate the connections after the cable is routed in the vehicle. This is the solution we came up with.

We started with a Sparkfun USB to serial module - a FT232R module which looks much like this:

FT232RL Module from Sparkfun

We then added a Sparkfun RJ45 breakout board to the end of the module to pass any serial signals through a standard CAT 5 cable. CAT 5 is obviously cheap and can be easily terminated on site.

In order to mate the RJ45 with the USB to serial breakout board, connect the TTL serial side of the USB board with a header soldered on the RJ45 breakout board

After soldering the RJ45 plug to the breakout board, solder a 4 pin header to the RJ45 breakout board like this:

USB-Serial-Extension25

USB-Serial-Extension26

You should end up with something that looks like this:

USB-Serial-Extension24

(Note, not all pins are being used on the RJ-45.)

Next line up the 4-pin header with the four through-holes on the USB to Serial breakout:

USB-Serial-Extension27

Mate the two and solder the header to the USB breakout board:
USB-Serial-Extension28

After soldering, you have a single unit that will look like this:

USB-Serial-Extension31

USB-Serial-Extension29

This is a quick, slick way to bring USB serial to your micro controller over a long cable. Obviously, on the other (microcontroller) end of the CAT5, you’d have a twin of the RJ45 breakout you can use to jumper to the microcontroller. Take the breakout’s TX, RX, and GND into your micro (exercise left to the reader.)

This is the USB end that is on the side of the PC:

USB-Serial-Extension1

You could quit right here and have a really nice way to gain a long reach to a micro from your PC, but we still had another problem to work through.

The next problem: this device is to be installed in a fire truck which is a relatively harsh, rugged environment. You can’t buy an enclosure for the Sparkfun USB to serial adapter and there isn’t a lot of space under the dash to put something very large. It has to be extremely durable as well as difficult to accidentally disconnect. As in the movie, The Graduate, the solution is molded plastic. (“Mr. McGuire: There's a great future in plastics. Think about it. Will you think about it?”)

I ordered some polyurethane, the same type you would use to create your own rock-climbing holds, for example. When it dries, it’s very stout - you can stomp on it, hang off it with one arm - it’s tough.

I built a mold from a PVC pipe that was just large enough in diameter to go around the Sparkfun board. The trick is to make sure the connectors are protected from having plastic seep in while it’s curing by coating them with silicon and letting it dry. The second trick is mold the USB cable directly into the unit so it cannot be pulled out accidentally. That still leaves the regular end of the USB cable to go into the laptop. The mold setup looks like this:

USB-Serial-Extension3

A piece of channel plastic for a base, a sawn off piece of PVC and some clay for a bottom seal. Before putting any electronics inside, spray the inside of the mold with a mold release agent (Stoner.)

In order to mold the cable into the unit, it had to either come up from the bottom of the mold or the top. Since the unit has connectors on both ends, I chose to put the usb connector on the bottom of the mold as it would be the easier one to seal. A hole is punched and cable fed through so that the thick part of the cable connection is holding the whole thing vertically like this:

USB-Serial-Extension15

Silicone is used to seal the cable and mold base so plastic will not later leak through the hole in the mold. The PVC is then slipped over the unit and clay used to seal the PVC:

USB-Serial-Extension19

Make sure to position the unit so that the RJ45 jack has some of its end sticking above the mold - this is so that plastic won’t overflow into the connection (sound like someone learned the hard way?)

USB-Serial-Extension20

The mold base is set over a simple standoff so that the cable can easily come up from the bottom.

Once everything is set, it’s time to mix the plastic and lay it into the mold. A gram sale is very useful for this step - 17-19 grams was all I needed - YMMV.

USB-Serial-Extension21

Slowly pour the plastic in the mold up to the brim but be careful not to let the plastic seep into the RJ45:

USB-Serial-Extension7

After the plastic cures - typically 15-20 minutes later - it’s easy to tear the mold base away from the PVC and then slide the mold off the unit. You’re left with a perfect, rock-hard, plastic cylinder that will protect the USB electronics as well as a cable that is molded into the unit and will not pull out.

You can throw this thing on the ground and stomp on it and it’s virtually indestructible. Compared to putting the device in a typical enclosure, not only is this stronger, it’s more compact than an enclosure could make it:

USB-Serial-Extension23

USB-Serial-Extension22

Since the plastic is non-conductive, everything works like you’d expect it to. If you use clear urethane like this, even the LEDs will be visible for statuses.

Summary
This project shows how to build a USB to serial extension cable as well as a way to enclose the electronics and connections so they are extremely robust. It’s not pretty, but very functional.
asdfasdf