Low Cost (1,85€) USB to RS232 LVTTL Serial Cable

Hi there! Have you ever needed a USB to RS232 converter to connect to your microcontroller for serial communications? If you have, you probably bought a USB to RS232 converter and then used an external MAX232/DS232 to convert the RS232 voltage levels to TTL levels. That requires a little money, and a little work too. However, there is a simple cable that converts USB to RS232 with LVTTL levels (fully compatible with TTL). Basically you just need to change the connector. The last one I made cost me only 1,85€ with shipping included! :D If you only buy an FTDI chip it will cost you almost the double! (yes, I know that FTDI chips are probably the best USB to RS232 converters but most users don't take require the full features and specifications of an FTDI chip).

(Click the photo for better resolution in Picasa Photostream)

In this post I'll guide you through the process of modifying that cable to get it ready to connect your MCUs to your computer for some data transfer or for some MCU programming using MCU bootloaders. First of all, this hack is not my idea. I saw it in the uCHobby blog and decided to do my little take on it (I think the original post is from Jonathan Thomson's blog. Check out his blog too, he posts some cool stuff).

The first thing you have to do is go to ebay and order some Nokia data cables of the DKU-5 or CA-42 type (other Nokia data cables will not work). Personally, I've always ordered the DKU-5 cables but I think they're pretty much the same as the CA-42. They are really cheap and if you have the oportunity to order more than one at once, I suggest you to do it because this cables are really useful for lots of projects. Although I have always ordered DKU-5, I got two different cables. In the first order I made I got a cable with an ArkMicro chip inside and a 6-wire cable and in the second order I got 4 cables with a Prolific PL2303 chip and a 3-wire cable. No need to worry, although they are different, all of them work perfectly and are fully supported in Ubuntu without having to install any drivers. What's the difference then? The difference is that with the cable with the ArkMicro chip you can power the the device that you connect the cable to with 3.3V from USB. With the cables with the PL2303 chip an external power supply is necessary to power the device that you wish to connect the cable to. However, it is possible to get power from these cables too, but bigger modifications have to be made.

So, here's what you have to do:
  1. Make sure the cable is disconnected from any device in both ends.
  2. Cut the cable about 5cm from the Nokia connector. You now have one big cable with a USB connector and a small cable with a Nokia data connector.
  3. Remove about 1 or 2cm of insulation in both cables. If the cables have 3 wires inside, you'll have the Gnd, Tx and Rx signals. If they have more than 3 cables, you probably have a 3.3V line too. :) Strip the tips of the internal wires too.
  4. Now it's time do some probing to find out which color corresponds to which signal. If you have a sound continuity tester it's great, if not, the resistance meter of your multimeter will do (measuring resistance in the same wire will give you approximately 0Ω resistance). Check the image below where you can see the pinout of the Nokia data connector.
    • Pin 8 - GND (Red in my ArkMicro cable; Black in my PL2303 cables)
    • Pin 7 - Rx (Green in my ArkMicro cable; White in my PL2303 cables)
    • Pin 6 - Tx (White in my ArkMicro cable; Red in my PL2303 cables)
    • Pin 5 - 3.3V (Orange in my ArkMicro cable; doesn't exist in my PL2303 cables)

    (Click the photo for better resolution in Picasa Photostream)
  5. Put one of the probes in one of the connector pins, and with the other probe touch the striped wires one by one until you find which color corresponds to it. Write it down and proceed until you get the colors for all the 3 (or 4) signals.
  6. Now that you know which color corresponds to which signal, get some heat-shrink tubing and put it in the cable with the USB connector. Do not heat it yet.
  7. Get a 3-pin (or 4-pin) connector that suits your needs. I decided to use some small black connectors that you can get from old computers. They are used to connect the case's LEDs and buttons to the motherboard (they're also available in some online shops such as Pololu or Technobots).
  8. First you have to crimp the female crimp pins on the wires and then insert them in the housing. Make sure to crimp them properly. If necessary apply some solder but be carefull not to apply too much or they won't get into the housing.
  9. Finally, pull the heat-shrink to cover a part of the wires and heat it with your soldering iron.
After this 8 steps you should have a good-looking USB to Serial LVTTL cable ready to use :D.

Get the flash player here: http://www.adobe.com/flashplayer

Earlier I mentioned that you can get USB power from the 3-wire cables. To do that you'll have to open the USB connector housing and then look for the VCC pin of the board and solder a wire to it. You'll probably have to get a 4-wire cable to replace the 3-wire cable and resolder the other 3 wires to their respective pins. After this, you may close the USB housing again using some hot glue. It won't be as robust or look as good as the original but it can be done. Personally I didn't do it. If you want some more details on it check the original post from Jonathan Thomson's blog.

To test the cable, plug it into your computer and insert a wire in the housing, connecting Tx to Rx. Then open a terminal and fire up some serial terminal like screen
 screen /dev/ttyUSB0 
If you don't have it installed you can install it by typing
 sudo apt-get install screen 
Then press some keys and you should see the characters appearing.
Personally, since I normally use Tiny Bootloader (tutorial coming soon) and I have tinybldlin installed I use the application's GUI terminal to test the cables.

That's all on this small hack. I hope it's useful for you!



Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! :)

Donate

2 comments:

  1. I wrote the ucHobby article first and then moved it to my own blog sometime later. The article on my blog has a bit more information (e.g. installing an EEPROM to increase the Max Power setting) than the ucHobby article. Thanks for sharing your experience. It's useful to see others' experiences with the many variations of these cables.

    ReplyDelete
  2. Well I guess everyone has to thank you first for sharing your experience and letting all of us know about it and save some money :) Actually, I only found about your blog after I've started to write this article. You've got some cool stuff there! :) I've seen your recent tutorials on using the STM32 board with Linux and I'm sure I'll re-read them when I have some time. I have one of those boards untouched and still in the original package because I didn't knew how to get started with it on linux. Thanks to you, now I know! :D I've decided to write my take on it precisely due to the variations on the cables. I was a little upset when I striped the last cables I ordered and verified that they only had 3 wires :\ However, I decided just to cover the basic changes. For more advanced stuff I'm sure my blog readers will check your original article :) Thanks for you comment! You should post stuff on your blog more often. I'll definetely read it ;)

    ReplyDelete

top