Eee 701 Planetoid


Using a USB-serial cable in Linux: first steps

Filed under: Accessories, Hardware, Linux — Tags: , , , , — Tim @ 20:24

When it comes to connecting external devices, the PC user of 2010 really doesn’t know how easy they have it. Thanks to the now-ubiquitous USB port, getting most peripherals to work with your computer is frequently as simple as plugging it in (perhaps with a spot of driver installation if it’s a bit non-specific).

Of course, it wasn’t always this straightforward. Look at the back of a PC older than about 2005, and you start seeing some perhaps unfamiliar sockets. That big thin wide one? Parallel port—used to be used mostly for printers, and early Iomega Zip drives (yes, I had one in the 90s, but that’s a long story).

And what’s that vaguely D-shaped socket with nine chunky metal pins? Now that’s what we’ve come to look at: it’s a DE-9 connector for a serial port (otherwise known as an RS232 interface). Before USB became standardised, serial ports were used to attach peripherals like pointing devices, digital cameras and modems. Whereas even USB 1.0 can shift around 12MB (megabits) of data per second, a fast RS232 serial port is usually limited to about 115,200KB, so the latter is much slower in operation, and also needs some manual setting-up to work properly.

In a nutshell, most modern PCs no longer have serial ports installed, as USB has superseded RS232 for most uses. However, there are still uses for serial ports:

  • “Legacy” devices with a serial connection, may still be of use (e.g. modems).
  • A surprising number of modern devices still use serial ports, as the hardware is cheap and reliable, and the software is easier to write than with USB. A small and random selection of such devices include:
    • many standalone GPS receivers, such as the Garmin eTrex;
    • computer-controllable telescopes, e.g. Meade and Celestron;
    • more specialist computing equipment such as routers and UPSs;
    • point-of-sale equipment, such as cash registers and receipt printers.
  • Some audio/visual equipment (for example, certain Humax digital video recorders) have a serial port for firmware upgrades, requiring a PC to be connected via serial port to transfer the new software.
Photo of USB-serial adapter cable

USB-serial adapter cable

The easiest way to add a serial port to a computer which does not have one installed, is usually a USB-serial adapter. This looks like a cable with a USB A-type connector on one end, and a 9-pin male serial plug on the other; however, it is not a “dumb” cable, as there is a hardware chipset (usually the PL2303) built into the serial connector, which performs the necessary USB-serial conversion.

I bought a USB-serial cable via Amazon recently as an impulse purchase, as it cost less than £4 with free shipping (far cheaper than the likes of Maplin, who ask £15-20 for much the same item). I figured it would be fun to experiment with; it might come in handy one day; and for the price of a large Starbucks coffee: what the hey? 😉

Getting the adapter to work under Linux (certainly, with Ubuntu or the Eeebuntu install on my Eee 701) is easier than Windows or the Mac, both of which require a driver download. The kernel module (driver) for the PL2303 chipset in the adapter, is already present in the system, and the first-time installation is straightforward (on Linux, anyway—if you’re running Mac OS X or Windows, look elsewhere):

  1. Plug the USB end of the cable into your computer.
  2. Wait a few seconds, then open a terminal window and run dmesg You should see some messages in the list along these lines:
    [11563.579898] USB Serial support registered for pl2303
    [11563.579958] pl2303 5-3.4:1.0: pl2303 converter detected
    [11563.582588] usb 5-3.4: pl2303 converter now attached to ttyUSB0
    [11563.582623] usbcore: registered new interface driver pl2303
    [11563.582628] pl2303: Prolific PL2303 USB to serial adaptor driver
  3. If this is the first time you have connected the cable, you may need to load the kernel module manually (just enter sudo modprobe pl2303). You should only need to do this once; at least on Ubuntu and derivatives, after the first time, everything is loaded automatically on connection.

If all has gone well, your cable is now installed and ready for action, but “where” is it? Windows and DOS have a standard port naming sequence for serial ports (COM1, COM2 and so on), but what is the serial port called in Linux? To cut a long story short, as with all “devices” in Linux, it’s in the /dev/ part of the filesystem: as this is a USB-based serial port, it’s called /dev/ttyUSB0 (the “tty” comes from “teletype”, which tells you how far back this goes :-)). Whichever application(s) you use, you will need to specify the serial port as /dev/ttyUSB0, so the software knows where to look.

So, hopefully you now have an operational serial port on your previously non-serial machine—what next? Well, that depends on what you want/need a serial connection for in the first place, but in the next instalment, I’ll look at a couple of things you could try, and the Linux apps you may need for it.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: