Tuesday, July 05, 2011

Cost effective (cheap!) USB Serial cable for any project

If you've been playing with microcontrollers, or hacking any sort of hardware, you know that it is great to be able to communicate with a computer. A usb cable is often the best option, since usb serial drivers are ubiquitous and easy to work with. However, cheap usb cables are difficult to come by. On this page, you will find instructions to build a very low cost USB serial cable, which can also supply +5V to a board. This is ideal for breadboard arduinos, but will also work great for any microcontroller or TTL circuit.

All instructions here are provided solely as a guide. If you miswire the cable, you might end up burning your computer, your electronic gadgets, or your house. I do not take personal responsibility for your actions.

Cost, parts, and capability

You need a Nokia CA-42 cable, a soldering iron and some method of determining continuity. A multimeter would be handy, but is not required. Assuming you have the tools, the CA-42 cable sells for $3 including free shipping from many sellers on eBay and Amazon. Since the cost of the cable is so low, online fraud is unlikely. The total cost of the project is $3, and you don't need any extra parts.
The final cable works on Linux, without requiring any extra drivers. Most cheap CA-42 cables are made using a PL-2303 chip, which is a cheap RS232 convertor. For data transmission, you only get two lines: RX and TX, but this is usually sufficient. You get +3V and +5V, which are very well regulated and clean sources of power. These could be directly attached to microcontroller boards. I have seen drivers for PL-2303 on Windows and Mac, and you should search for these over the Internet. You might need to mask the device ID, since the cable might announce itself as a Nokia phone cable. You don't need any drivers if you only want to use the cable as a power source.

Make it

The construction is trivial. This is what the cable looks like (image courtesy Timothy Small):

The pinout, from left to right is:
  1. This is body of the cable, and is not connected
  2. The missing pin, no connection
  3. No connection
  4. +3.3V, might be as low as +3V
  5. No connection
  6. RX
  7. TX
  8. GND
It might help to view the pin out diagram (hosted at nas-central.org).

To create the cable, cut the head near the top of the cable, as shown. When you cut the cable, try to match the color of the wire with the pinout given above. I've found the following colors, though you should check your own cable:
  • Black: Ground
  • Red: 3V
  • White: RX data
  • Blue: TX data
  • Green: no connection
Now, the cable has five wires: two are used for data (TX, RX), two are for power (+3.3, GND). There is an extra wire in there, which is useless for our purposes. So we repurpose this wire to carry the +5V connection from the USB port. In my cables, this wire has always been green, though you should check which wire, if any, is unused in your cable. The head of the cable comes off quite easily if you hold it and twist the metal USB connector as though it were a key. Connect the far right metal lead from the USB connector to the green wire. The green wire should be disconnected from the body, but the +5V connect should not be disconnected from the body: the PL-2303 requires +5V power to work.

Here is the final soldered assembly. In this image, the usb connector is the correct side up. For your reference, here is pin-out for the USB A connector. The soldering is done to the +5V wire.



The +5V and ground can be used to power an arduino or most Atmel Atmega AVR microprocessors. The TX wire (colored blue in my cable) goes into the TXD pin of microcontrollers (Arduino: digital 1), and the RX wire (colored white in my cable) goes into the RXD pin of microcontrollers (Arduino: digital 0). I've tested the power using an oscilloscope: the power in my cables is very clean. This means that you can avoid using a 7805 and other circuitry that would provide a clean +5V signal.

Credit: The idea for this cable is due to the the ARM9 Linkstation hackers.